@@ -130,19 +130,20 @@ type ServicePackageSDKListResource struct {
130130}
131131
132132type Identity struct {
133- IsGlobalResource bool // All
134- IsSingleton bool // Singleton
135- IsARN bool // ARN
136- IsGlobalARNFormat bool // ARN
137- IdentityAttribute string // ARN
138- IDAttrShadowsAttr string
139- Attributes []IdentityAttribute
140- IdentityDuplicateAttrs []string
141- IsSingleParameter bool
142- IsMutable bool
143- IsSetOnUpdate bool
144- customInherentRegion bool
145- version int64
133+ IsGlobalResource bool // All
134+ IsSingleton bool // Singleton
135+ IsARN bool // ARN
136+ IsGlobalARNFormat bool // ARN
137+ IdentityAttribute string // ARN
138+ IDAttrShadowsAttr string
139+ Attributes []IdentityAttribute
140+ IdentityDuplicateAttrs []string
141+ IsSingleParameter bool
142+ IsMutable bool
143+ IsSetOnUpdate bool
144+ IsCustomInherentRegion bool
145+ customInherentRegionParser RegionalCustomInherentRegionIdentityFunc
146+ version int64
146147}
147148
148149func (i Identity ) HasInherentRegion () bool {
@@ -155,7 +156,7 @@ func (i Identity) HasInherentRegion() bool {
155156 if i .IsARN && ! i .IsGlobalARNFormat {
156157 return true
157158 }
158- if i .customInherentRegion {
159+ if i .IsCustomInherentRegion {
159160 return true
160161 }
161162 return false
@@ -165,6 +166,10 @@ func (i Identity) Version() int64 {
165166 return i .version
166167}
167168
169+ func (i Identity ) CustomInherentRegionParser () RegionalCustomInherentRegionIdentityFunc {
170+ return i .customInherentRegionParser
171+ }
172+
168173func RegionalParameterizedIdentity (attributes []IdentityAttribute , opts ... IdentityOptsFunc ) Identity {
169174 baseAttributes := []IdentityAttribute {
170175 StringIdentityAttribute ("account_id" , false ),
@@ -255,14 +260,15 @@ func arnIdentity(isGlobalResource bool, name string, opts []IdentityOptsFunc) Id
255260 return identity
256261}
257262
258- func RegionalCustomInherentRegionIdentity (name string , opts ... IdentityOptsFunc ) Identity {
263+ func RegionalCustomInherentRegionIdentity (name string , parser RegionalCustomInherentRegionIdentityFunc , opts ... IdentityOptsFunc ) Identity {
259264 identity := Identity {
260265 IsGlobalResource : false ,
261266 IdentityAttribute : name ,
262267 Attributes : []IdentityAttribute {
263268 StringIdentityAttribute (name , true ),
264269 },
265- customInherentRegion : true ,
270+ IsCustomInherentRegion : true ,
271+ customInherentRegionParser : parser ,
266272 }
267273
268274 for _ , opt := range opts {
@@ -272,6 +278,13 @@ func RegionalCustomInherentRegionIdentity(name string, opts ...IdentityOptsFunc)
272278 return identity
273279}
274280
281+ type BaseIdentity struct {
282+ AccountID string
283+ Region string
284+ }
285+
286+ type RegionalCustomInherentRegionIdentityFunc func (value string ) (BaseIdentity , error )
287+
275288func RegionalResourceWithGlobalARNFormat (opts ... IdentityOptsFunc ) Identity {
276289 return RegionalResourceWithGlobalARNFormatNamed (names .AttrARN , opts ... )
277290}
0 commit comments