@@ -110,6 +110,37 @@ REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING
110110REFERENCE_LIST_SYNTAX_TYPE_REGEX
111111REFERENCE_LIST_SYNTAX_TYPE_CIDR` ,
112112 },
113+ "scope_info" : {
114+ Type : schema .TypeList ,
115+ Optional : true ,
116+ Description : `ScopeInfo specifies the scope info of the reference list.` ,
117+ MaxItems : 1 ,
118+ Elem : & schema.Resource {
119+ Schema : map [string ]* schema.Schema {
120+ "reference_list_scope" : {
121+ Type : schema .TypeList ,
122+ Optional : true ,
123+ Description : `ReferenceListScope specifies the list of scope names of the reference list.` ,
124+ MaxItems : 1 ,
125+ Elem : & schema.Resource {
126+ Schema : map [string ]* schema.Schema {
127+ "scope_names" : {
128+ Type : schema .TypeList ,
129+ Optional : true ,
130+ DiffSuppressFunc : tpgresource .ProjectNumberDiffSuppress ,
131+ Description : `Optional. The list of scope names of the reference list. The scope names should be
132+ full resource names and should be of the format:
133+ "projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope_name}".` ,
134+ Elem : & schema.Schema {
135+ Type : schema .TypeString ,
136+ },
137+ },
138+ },
139+ },
140+ },
141+ },
142+ },
143+ },
113144 "display_name" : {
114145 Type : schema .TypeString ,
115146 Computed : true ,
@@ -142,35 +173,6 @@ This is returned only when the view is REFERENCE_LIST_VIEW_FULL.`,
142173 Type : schema .TypeString ,
143174 },
144175 },
145- "scope_info" : {
146- Type : schema .TypeList ,
147- Computed : true ,
148- Description : `ScopeInfo specifies the scope info of the reference list.` ,
149- Elem : & schema.Resource {
150- Schema : map [string ]* schema.Schema {
151- "reference_list_scope" : {
152- Type : schema .TypeList ,
153- Required : true ,
154- Description : `ReferenceListScope specifies the list of scope names of the reference list.` ,
155- MaxItems : 1 ,
156- Elem : & schema.Resource {
157- Schema : map [string ]* schema.Schema {
158- "scope_names" : {
159- Type : schema .TypeList ,
160- Optional : true ,
161- Description : `Optional. The list of scope names of the reference list. The scope names should be
162- full resource names and should be of the format:
163- "projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope_name}".` ,
164- Elem : & schema.Schema {
165- Type : schema .TypeString ,
166- },
167- },
168- },
169- },
170- },
171- },
172- },
173- },
174176 "project" : {
175177 Type : schema .TypeString ,
176178 Optional : true ,
@@ -202,6 +204,12 @@ func resourceChronicleReferenceListCreate(d *schema.ResourceData, meta interface
202204 } else if v , ok := d .GetOkExists ("entries" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (entriesProp )) && (ok || ! reflect .DeepEqual (v , entriesProp )) {
203205 obj ["entries" ] = entriesProp
204206 }
207+ scopeInfoProp , err := expandChronicleReferenceListScopeInfo (d .Get ("scope_info" ), d , config )
208+ if err != nil {
209+ return err
210+ } else if v , ok := d .GetOkExists ("scope_info" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (scopeInfoProp )) && (ok || ! reflect .DeepEqual (v , scopeInfoProp )) {
211+ obj ["scopeInfo" ] = scopeInfoProp
212+ }
205213 syntaxTypeProp , err := expandChronicleReferenceListSyntaxType (d .Get ("syntax_type" ), d , config )
206214 if err != nil {
207215 return err
@@ -356,6 +364,12 @@ func resourceChronicleReferenceListUpdate(d *schema.ResourceData, meta interface
356364 } else if v , ok := d .GetOkExists ("entries" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , entriesProp )) {
357365 obj ["entries" ] = entriesProp
358366 }
367+ scopeInfoProp , err := expandChronicleReferenceListScopeInfo (d .Get ("scope_info" ), d , config )
368+ if err != nil {
369+ return err
370+ } else if v , ok := d .GetOkExists ("scope_info" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , scopeInfoProp )) {
371+ obj ["scopeInfo" ] = scopeInfoProp
372+ }
359373 syntaxTypeProp , err := expandChronicleReferenceListSyntaxType (d .Get ("syntax_type" ), d , config )
360374 if err != nil {
361375 return err
@@ -380,6 +394,10 @@ func resourceChronicleReferenceListUpdate(d *schema.ResourceData, meta interface
380394 updateMask = append (updateMask , "entries" )
381395 }
382396
397+ if d .HasChange ("scope_info" ) {
398+ updateMask = append (updateMask , "scopeInfo" )
399+ }
400+
383401 if d .HasChange ("syntax_type" ) {
384402 updateMask = append (updateMask , "syntaxType" )
385403 }
@@ -571,6 +589,48 @@ func expandChronicleReferenceListEntriesValue(v interface{}, d tpgresource.Terra
571589 return v , nil
572590}
573591
592+ func expandChronicleReferenceListScopeInfo (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
593+ l := v .([]interface {})
594+ if len (l ) == 0 || l [0 ] == nil {
595+ return nil , nil
596+ }
597+ raw := l [0 ]
598+ original := raw .(map [string ]interface {})
599+ transformed := make (map [string ]interface {})
600+
601+ transformedReferenceListScope , err := expandChronicleReferenceListScopeInfoReferenceListScope (original ["reference_list_scope" ], d , config )
602+ if err != nil {
603+ return nil , err
604+ } else if val := reflect .ValueOf (transformedReferenceListScope ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
605+ transformed ["referenceListScope" ] = transformedReferenceListScope
606+ }
607+
608+ return transformed , nil
609+ }
610+
611+ func expandChronicleReferenceListScopeInfoReferenceListScope (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
612+ l := v .([]interface {})
613+ if len (l ) == 0 || l [0 ] == nil {
614+ return nil , nil
615+ }
616+ raw := l [0 ]
617+ original := raw .(map [string ]interface {})
618+ transformed := make (map [string ]interface {})
619+
620+ transformedScopeNames , err := expandChronicleReferenceListScopeInfoReferenceListScopeScopeNames (original ["scope_names" ], d , config )
621+ if err != nil {
622+ return nil , err
623+ } else if val := reflect .ValueOf (transformedScopeNames ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
624+ transformed ["scopeNames" ] = transformedScopeNames
625+ }
626+
627+ return transformed , nil
628+ }
629+
630+ func expandChronicleReferenceListScopeInfoReferenceListScopeScopeNames (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
631+ return v , nil
632+ }
633+
574634func expandChronicleReferenceListSyntaxType (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
575635 return v , nil
576636}
0 commit comments