@@ -61,6 +61,42 @@ func ApigatewayApiResource() *schema.Resource {
6161 Computed : true ,
6262 Elem : schema .TypeString ,
6363 },
64+ "locks" : {
65+ Type : schema .TypeList ,
66+ Optional : true ,
67+ Computed : true ,
68+ Elem : & schema.Resource {
69+ Schema : map [string ]* schema.Schema {
70+ // Required
71+ "type" : {
72+ Type : schema .TypeString ,
73+ Required : true ,
74+ },
75+
76+ // Optional
77+ "message" : {
78+ Type : schema .TypeString ,
79+ Optional : true ,
80+ Computed : true ,
81+ },
82+
83+ // Computed
84+ "related_resource_id" : {
85+ Type : schema .TypeString ,
86+ Computed : true ,
87+ },
88+ "time_created" : {
89+ Type : schema .TypeString ,
90+ Computed : true ,
91+ },
92+ },
93+ },
94+ },
95+ "is_lock_override" : {
96+ Type : schema .TypeBool ,
97+ Optional : true ,
98+ Computed : true ,
99+ },
64100
65101 // Computed
66102 "lifecycle_details" : {
@@ -75,6 +111,11 @@ func ApigatewayApiResource() *schema.Resource {
75111 Type : schema .TypeString ,
76112 Computed : true ,
77113 },
114+ "system_tags" : {
115+ Type : schema .TypeMap ,
116+ Computed : true ,
117+ Elem : schema .TypeString ,
118+ },
78119 "time_created" : {
79120 Type : schema .TypeString ,
80121 Computed : true ,
@@ -210,6 +251,23 @@ func (s *ApigatewayApiResourceCrud) Create() error {
210251 request .FreeformTags = tfresource .ObjectMapToStringMap (freeformTags .(map [string ]interface {}))
211252 }
212253
254+ if locks , ok := s .D .GetOkExists ("locks" ); ok {
255+ interfaces := locks .([]interface {})
256+ tmp := make ([]oci_apigateway.AddResourceLockDetails , len (interfaces ))
257+ for i := range interfaces {
258+ stateDataIndex := i
259+ fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "locks" , stateDataIndex )
260+ converted , err := s .mapToAddResourceLockDetails (fieldKeyFormat )
261+ if err != nil {
262+ return err
263+ }
264+ tmp [i ] = converted
265+ }
266+ if len (tmp ) != 0 || s .D .HasChange ("locks" ) {
267+ request .Locks = tmp
268+ }
269+ }
270+
213271 request .RequestMetadata .RetryPolicy = tfresource .GetRetryPolicy (s .DisableNotFoundRetries , "apigateway" )
214272
215273 response , err := s .Client .CreateApi (context .Background (), request )
@@ -409,6 +467,11 @@ func (s *ApigatewayApiResourceCrud) Update() error {
409467 request .FreeformTags = tfresource .ObjectMapToStringMap (freeformTags .(map [string ]interface {}))
410468 }
411469
470+ if isLockOverride , ok := s .D .GetOkExists ("is_lock_override" ); ok {
471+ tmp := isLockOverride .(bool )
472+ request .IsLockOverride = & tmp
473+ }
474+
412475 request .RequestMetadata .RetryPolicy = tfresource .GetRetryPolicy (s .DisableNotFoundRetries , "apigateway" )
413476
414477 response , err := s .Client .UpdateApi (context .Background (), request )
@@ -430,6 +493,11 @@ func (s *ApigatewayApiResourceCrud) Delete() error {
430493 tmp := s .D .Id ()
431494 request .ApiId = & tmp
432495
496+ if isLockOverride , ok := s .D .GetOkExists ("is_lock_override" ); ok {
497+ tmp := isLockOverride .(bool )
498+ request .IsLockOverride = & tmp
499+ }
500+
433501 request .RequestMetadata .RetryPolicy = tfresource .GetRetryPolicy (s .DisableNotFoundRetries , "apigateway" )
434502
435503 response , err := s .Client .DeleteApi (context .Background (), request )
@@ -463,12 +531,22 @@ func (s *ApigatewayApiResourceCrud) SetData() error {
463531 s .D .Set ("lifecycle_details" , * s .Res .LifecycleDetails )
464532 }
465533
534+ locks := []interface {}{}
535+ for _ , item := range s .Res .Locks {
536+ locks = append (locks , ResourceLockToMap (item ))
537+ }
538+ s .D .Set ("locks" , locks )
539+
466540 if s .Res .SpecificationType != nil {
467541 s .D .Set ("specification_type" , * s .Res .SpecificationType )
468542 }
469543
470544 s .D .Set ("state" , s .Res .LifecycleState )
471545
546+ if s .Res .SystemTags != nil {
547+ s .D .Set ("system_tags" , tfresource .SystemTagsToMap (s .Res .SystemTags ))
548+ }
549+
472550 if s .Res .TimeCreated != nil {
473551 s .D .Set ("time_created" , s .Res .TimeCreated .String ())
474552 }
@@ -486,6 +564,21 @@ func (s *ApigatewayApiResourceCrud) SetData() error {
486564 return nil
487565}
488566
567+ func (s * ApigatewayApiResourceCrud ) mapToAddResourceLockDetails (fieldKeyFormat string ) (oci_apigateway.AddResourceLockDetails , error ) {
568+ result := oci_apigateway.AddResourceLockDetails {}
569+
570+ if message , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "message" )); ok {
571+ tmp := message .(string )
572+ result .Message = & tmp
573+ }
574+
575+ if type_ , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "type" )); ok {
576+ result .Type = oci_apigateway .AddResourceLockDetailsTypeEnum (type_ .(string ))
577+ }
578+
579+ return result , nil
580+ }
581+
489582func ApiSummaryToMap (obj oci_apigateway.ApiSummary ) map [string ]interface {} {
490583 result := map [string ]interface {}{}
491584
@@ -511,12 +604,22 @@ func ApiSummaryToMap(obj oci_apigateway.ApiSummary) map[string]interface{} {
511604 result ["lifecycle_details" ] = string (* obj .LifecycleDetails )
512605 }
513606
607+ locks := []interface {}{}
608+ for _ , item := range obj .Locks {
609+ locks = append (locks , ResourceLockToMap (item ))
610+ }
611+ result ["locks" ] = locks
612+
514613 if obj .SpecificationType != nil {
515614 result ["specification_type" ] = string (* obj .SpecificationType )
516615 }
517616
518617 result ["state" ] = string (obj .LifecycleState )
519618
619+ if obj .SystemTags != nil {
620+ result ["system_tags" ] = tfresource .SystemTagsToMap (obj .SystemTags )
621+ }
622+
520623 if obj .TimeCreated != nil {
521624 result ["time_created" ] = obj .TimeCreated .String ()
522625 }
@@ -555,6 +658,11 @@ func (s *ApigatewayApiResourceCrud) updateCompartment(compartment interface{}) e
555658 compartmentTmp := compartment .(string )
556659 changeCompartmentRequest .CompartmentId = & compartmentTmp
557660
661+ if isLockOverride , ok := s .D .GetOkExists ("is_lock_override" ); ok {
662+ tmp := isLockOverride .(bool )
663+ changeCompartmentRequest .IsLockOverride = & tmp
664+ }
665+
558666 changeCompartmentRequest .RequestMetadata .RetryPolicy = tfresource .GetRetryPolicy (s .DisableNotFoundRetries , "apigateway" )
559667
560668 response , err := s .Client .ChangeApiCompartment (context .Background (), changeCompartmentRequest )
0 commit comments