@@ -17,8 +17,8 @@ import (
1717
1818func ResourceTencentCloudRumProject () * schema.Resource {
1919 return & schema.Resource {
20- Read : resourceTencentCloudRumProjectRead ,
2120 Create : resourceTencentCloudRumProjectCreate ,
21+ Read : resourceTencentCloudRumProjectRead ,
2222 Update : resourceTencentCloudRumProjectUpdate ,
2323 Delete : resourceTencentCloudRumProjectDelete ,
2424 Importer : & schema.ResourceImporter {
@@ -68,9 +68,9 @@ func ResourceTencentCloudRumProject() *schema.Resource {
6868 },
6969
7070 "desc" : {
71- Type : schema .TypeString ,
72- Optional : true ,
73- Description : " Description of the created project (optional and up to 1,000 characters)." ,
71+ Type : schema .TypeString ,
72+ Optional : true ,
73+ Description : "Description of the created project (optional and up to 1,000 characters)." ,
7474 },
7575
7676 "creator" : {
@@ -82,7 +82,7 @@ func ResourceTencentCloudRumProject() *schema.Resource {
8282 "create_time" : {
8383 Type : schema .TypeString ,
8484 Computed : true ,
85- Description : "Creata Time." ,
85+ Description : "Create Time." ,
8686 },
8787
8888 "key" : {
@@ -122,9 +122,8 @@ func resourceTencentCloudRumProjectCreate(d *schema.ResourceData, meta interface
122122 defer tccommon .LogElapsed ("resource.tencentcloud_rum_project.create" )()
123123 defer tccommon .InconsistentCheck (d , meta )()
124124
125- logId := tccommon .GetLogId (tccommon .ContextNil )
126-
127125 var (
126+ logId = tccommon .GetLogId (tccommon .ContextNil )
128127 request = rum .NewCreateProjectRequest ()
129128 response * rum.CreateProjectResponse
130129 id uint64
@@ -170,6 +169,7 @@ func resourceTencentCloudRumProjectCreate(d *schema.ResourceData, meta interface
170169 log .Printf ("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n " ,
171170 logId , request .GetAction (), request .ToJsonString (), result .ToJsonString ())
172171 }
172+
173173 response = result
174174 return nil
175175 })
@@ -180,7 +180,6 @@ func resourceTencentCloudRumProjectCreate(d *schema.ResourceData, meta interface
180180 }
181181
182182 id = * response .Response .ID
183-
184183 d .SetId (strconv .Itoa (int (id )))
185184 return resourceTencentCloudRumProjectRead (d , meta )
186185}
@@ -189,15 +188,14 @@ func resourceTencentCloudRumProjectRead(d *schema.ResourceData, meta interface{}
189188 defer tccommon .LogElapsed ("resource.tencentcloud_rum_project.read" )()
190189 defer tccommon .InconsistentCheck (d , meta )()
191190
192- logId := tccommon . GetLogId ( tccommon . ContextNil )
193- ctx := context . WithValue ( context . TODO (), tccommon .LogIdKey , logId )
194-
195- service : = RumService {client : meta .(tccommon.ProviderMeta ).GetAPIV3Conn ()}
196-
197- projectId := d . Id ( )
191+ var (
192+ logId = tccommon . GetLogId ( tccommon .ContextNil )
193+ ctx = context . WithValue ( context . TODO (), tccommon . LogIdKey , logId )
194+ service = RumService {client : meta .(tccommon.ProviderMeta ).GetAPIV3Conn ()}
195+ projectId = d . Id ()
196+ )
198197
199198 project , err := service .DescribeRumProject (ctx , projectId )
200-
201199 if err != nil {
202200 return err
203201 }
@@ -274,19 +272,18 @@ func resourceTencentCloudRumProjectUpdate(d *schema.ResourceData, meta interface
274272 defer tccommon .LogElapsed ("resource.tencentcloud_rum_project.update" )()
275273 defer tccommon .InconsistentCheck (d , meta )()
276274
277- logId := tccommon . GetLogId ( tccommon . ContextNil )
278-
279- request : = rum .NewModifyProjectRequest ()
280-
281- projectId := d . Id ( )
275+ var (
276+ logId = tccommon . GetLogId ( tccommon . ContextNil )
277+ request = rum .NewModifyProjectRequest ()
278+ projectId = d . Id ()
279+ )
282280
283281 id , e := strconv .Atoi (projectId )
284282 if e != nil {
285283 return fmt .Errorf ("[ERROR]%s api[%s] sting to uint64 error, err [%s]" , logId , request .GetAction (), e )
286284 }
287285
288286 request .ID = helper .Uint64 (uint64 (id ))
289-
290287 if d .HasChange ("name" ) {
291288 if v , ok := d .GetOk ("name" ); ok {
292289 request .Name = helper .String (v .(string ))
@@ -297,7 +294,6 @@ func resourceTencentCloudRumProjectUpdate(d *schema.ResourceData, meta interface
297294 if v , ok := d .GetOk ("instance_id" ); ok {
298295 request .InstanceID = helper .String (v .(string ))
299296 }
300-
301297 }
302298
303299 if d .HasChange ("rate" ) {
@@ -344,11 +340,12 @@ func resourceTencentCloudRumProjectUpdate(d *schema.ResourceData, meta interface
344340 log .Printf ("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n " ,
345341 logId , request .GetAction (), request .ToJsonString (), result .ToJsonString ())
346342 }
343+
347344 return nil
348345 })
349346
350347 if err != nil {
351- log .Printf ("[CRITAL]%s create rum project failed, reason:%+v" , logId , err )
348+ log .Printf ("[CRITAL]%s update rum project failed, reason:%+v" , logId , err )
352349 return err
353350 }
354351
@@ -359,12 +356,12 @@ func resourceTencentCloudRumProjectDelete(d *schema.ResourceData, meta interface
359356 defer tccommon .LogElapsed ("resource.tencentcloud_rum_project.delete" )()
360357 defer tccommon .InconsistentCheck (d , meta )()
361358
362- logId := tccommon . GetLogId ( tccommon . ContextNil )
363- ctx := context . WithValue ( context . TODO (), tccommon .LogIdKey , logId )
364-
365- service : = RumService {client : meta .(tccommon.ProviderMeta ).GetAPIV3Conn ()}
366-
367- projectId := d . Id ( )
359+ var (
360+ logId = tccommon . GetLogId ( tccommon .ContextNil )
361+ ctx = context . WithValue ( context . TODO (), tccommon . LogIdKey , logId )
362+ service = RumService {client : meta .(tccommon.ProviderMeta ).GetAPIV3Conn ()}
363+ projectId = d . Id ()
364+ )
368365
369366 if err := service .DeleteRumProjectById (ctx , projectId ); err != nil {
370367 return err
0 commit comments