@@ -40,10 +40,10 @@ func (me *TdmqService) DescribeTdmqInstanceById(ctx context.Context,
40
40
logId , request .GetAction (), request .ToJsonString (), errRet .Error ())
41
41
}
42
42
}()
43
+
43
44
request .ClusterIdList = []* string {& clusterId }
44
45
45
46
var response * tdmq.DescribeClustersResponse
46
-
47
47
var iacExtInfo connectivity.IacExtInfo
48
48
iacExtInfo .InstanceId = clusterId
49
49
if err := resource .Retry (tccommon .ReadRetryTimeout , func () * resource.RetryError {
@@ -52,6 +52,7 @@ func (me *TdmqService) DescribeTdmqInstanceById(ctx context.Context,
52
52
if err != nil {
53
53
return tccommon .RetryError (err , tccommon .InternalError )
54
54
}
55
+
55
56
response = result
56
57
return nil
57
58
}); err != nil {
@@ -62,6 +63,7 @@ func (me *TdmqService) DescribeTdmqInstanceById(ctx context.Context,
62
63
if len (response .Response .ClusterSet ) < 1 {
63
64
return
64
65
}
66
+
65
67
has = true
66
68
info = response .Response .ClusterSet [0 ]
67
69
return
@@ -104,14 +106,17 @@ func (me *TdmqService) DeleteTdmqInstance(ctx context.Context, clusterId string)
104
106
logId , request .GetAction (), request .ToJsonString (), errRet .Error ())
105
107
}
106
108
}()
109
+
107
110
request .ClusterId = & clusterId
108
111
response , err := me .client .UseTdmqClient ().DeleteCluster (request )
109
112
if err != nil {
110
113
errRet = err
111
114
return err
112
115
}
116
+
113
117
log .Printf ("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n " ,
114
118
logId , request .GetAction (), request .ToJsonString (), response .ToJsonString ())
119
+
115
120
return
116
121
}
117
122
@@ -140,13 +145,15 @@ func (me *TdmqService) CreateTdmqNamespace(ctx context.Context, environName stri
140
145
if err != nil {
141
146
return tccommon .RetryError (err )
142
147
}
148
+
143
149
response = result
144
150
return nil
145
151
}); err != nil {
146
152
log .Printf ("[CRITAL]%s create tdmq namespace failed, reason: %v" , logId , err )
147
153
errRet = err
148
154
return
149
155
}
156
+
150
157
environId = * response .Response .EnvironmentId
151
158
return
152
159
}
@@ -161,27 +168,34 @@ func (me *TdmqService) DescribeTdmqNamespaceById(ctx context.Context,
161
168
logId , request .GetAction (), request .ToJsonString (), errRet .Error ())
162
169
}
163
170
}()
164
- request . EnvironmentId = & environId
171
+
165
172
request .ClusterId = & clusterId
173
+ request .Filters = []* tdmq.Filter {
174
+ {
175
+ Name : common .StringPtr ("EnvironmentId" ),
176
+ Values : common .StringPtrs ([]string {environId }),
177
+ },
178
+ }
166
179
167
180
var response * tdmq.DescribeEnvironmentsResponse
168
-
169
181
if err := resource .Retry (tccommon .ReadRetryTimeout , func () * resource.RetryError {
170
182
ratelimit .Check (request .GetAction ())
171
183
result , err := me .client .UseTdmqClient ().DescribeEnvironments (request )
172
184
if err != nil {
173
185
return tccommon .RetryError (err , tccommon .InternalError )
174
186
}
187
+
175
188
response = result
176
189
return nil
177
190
}); err != nil {
178
- log .Printf ("[CRITAL]%s read tdmq failed, reason: %v" , logId , err )
191
+ log .Printf ("[CRITAL]%s read tdmq namespace failed, reason: %v" , logId , err )
179
192
return nil , false , err
180
193
}
181
194
182
195
if len (response .Response .EnvironmentSet ) < 1 {
183
196
return
184
197
}
198
+
185
199
has = true
186
200
info = response .Response .EnvironmentSet [0 ]
187
201
return
@@ -209,11 +223,13 @@ func (me *TdmqService) ModifyTdmqNamespaceAttribute(ctx context.Context, environ
209
223
if err != nil {
210
224
return tccommon .RetryError (err , tccommon .InternalError )
211
225
}
226
+
212
227
return nil
213
228
}); err != nil {
214
229
log .Printf ("[CRITAL]%s modify tdmq namespace failed, reason: %v" , logId , err )
215
230
return err
216
231
}
232
+
217
233
return
218
234
}
219
235
@@ -226,6 +242,7 @@ func (me *TdmqService) DeleteTdmqNamespace(ctx context.Context, environId string
226
242
logId , request .GetAction (), request .ToJsonString (), errRet .Error ())
227
243
}
228
244
}()
245
+
229
246
request .EnvironmentIds = []* string {& environId }
230
247
request .ClusterId = & clusterId
231
248
if err := resource .Retry (tccommon .ReadRetryTimeout , func () * resource.RetryError {
@@ -234,11 +251,13 @@ func (me *TdmqService) DeleteTdmqNamespace(ctx context.Context, environId string
234
251
if err != nil {
235
252
return tccommon .RetryError (err , tccommon .InternalError )
236
253
}
254
+
237
255
return nil
238
256
}); err != nil {
239
257
log .Printf ("[CRITAL]%s delete tdmq namespace failed, reason: %v" , logId , err )
240
258
return err
241
259
}
260
+
242
261
return
243
262
}
244
263
@@ -291,18 +310,24 @@ func (me *TdmqService) DescribeTdmqTopicById(ctx context.Context,
291
310
logId , request .GetAction (), request .ToJsonString (), errRet .Error ())
292
311
}
293
312
}()
313
+
294
314
request .EnvironmentId = & environId
295
- request .TopicName = & topicName
296
315
request .ClusterId = & clusterId
316
+ request .Filters = []* tdmq.Filter {
317
+ {
318
+ Name : common .StringPtr ("TopicName" ),
319
+ Values : common .StringPtrs ([]string {topicName }),
320
+ },
321
+ }
297
322
298
323
var response * tdmq.DescribeTopicsResponse
299
-
300
324
if err := resource .Retry (tccommon .ReadRetryTimeout , func () * resource.RetryError {
301
325
ratelimit .Check (request .GetAction ())
302
326
result , err := me .client .UseTdmqClient ().DescribeTopics (request )
303
327
if err != nil {
304
328
return tccommon .RetryError (err , tccommon .InternalError )
305
329
}
330
+
306
331
response = result
307
332
return nil
308
333
}); err != nil {
@@ -313,6 +338,7 @@ func (me *TdmqService) DescribeTdmqTopicById(ctx context.Context,
313
338
if len (response .Response .TopicSets ) < 1 {
314
339
return
315
340
}
341
+
316
342
has = true
317
343
info = response .Response .TopicSets [0 ]
318
344
return
@@ -328,6 +354,7 @@ func (me *TdmqService) ModifyTdmqTopicAttribute(ctx context.Context, environId s
328
354
logId , request .GetAction (), request .ToJsonString (), errRet .Error ())
329
355
}
330
356
}()
357
+
331
358
request .EnvironmentId = & environId
332
359
request .TopicName = & topicName
333
360
request .Partitions = & partitions
@@ -340,11 +367,13 @@ func (me *TdmqService) ModifyTdmqTopicAttribute(ctx context.Context, environId s
340
367
if err != nil {
341
368
return tccommon .RetryError (err , tccommon .InternalError )
342
369
}
370
+
343
371
return nil
344
372
}); err != nil {
345
373
log .Printf ("[CRITAL]%s modify tdmq topic failed, reason: %v" , logId , err )
346
374
return err
347
375
}
376
+
348
377
return
349
378
}
350
379
@@ -357,11 +386,11 @@ func (me *TdmqService) DeleteTdmqTopic(ctx context.Context, environId string, to
357
386
logId , request .GetAction (), request .ToJsonString (), errRet .Error ())
358
387
}
359
388
}()
360
- var (
361
- topicRecord tdmq.TopicRecord
362
- )
389
+
390
+ var topicRecord tdmq.TopicRecord
363
391
topicRecord .TopicName = & topicName
364
392
topicRecord .EnvironmentId = & environId
393
+
365
394
request .TopicSets = []* tdmq.TopicRecord {& topicRecord }
366
395
request .ClusterId = & clusterId
367
396
@@ -371,11 +400,13 @@ func (me *TdmqService) DeleteTdmqTopic(ctx context.Context, environId string, to
371
400
if err != nil {
372
401
return tccommon .RetryError (err , tccommon .InternalError )
373
402
}
403
+
374
404
return nil
375
405
}); err != nil {
376
406
log .Printf ("[CRITAL]%s delete tdmq topic failed, reason: %v" , logId , err )
377
407
return err
378
408
}
409
+
379
410
return
380
411
}
381
412
0 commit comments