@@ -145,10 +145,11 @@ type SyncedCondition struct {
145
145
// Example usage from the AmazonMQ generator config:
146
146
//
147
147
// resources:
148
- // Broker:
149
- // hooks:
150
- // sdk_update_pre_build_request:
151
- // code: if err := rm.requeueIfNotRunning(latest); err != nil { return nil, err }
148
+ //
149
+ // Broker:
150
+ // hooks:
151
+ // sdk_update_pre_build_request:
152
+ // code: if err := rm.requeueIfNotRunning(latest); err != nil { return nil, err }
152
153
//
153
154
// Note that the implementor of the AmazonMQ service controller for ACK should
154
155
// ensure that there is a `requeueIfNotRunning()` method implementation in
@@ -159,10 +160,11 @@ type SyncedCondition struct {
159
160
// `template_path` field:
160
161
//
161
162
// resources:
162
- // Broker:
163
- // hooks:
164
- // sdk_update_pre_build_update_request:
165
- // template_path: templates/sdk_update_pre_build_request.go.tpl
163
+ //
164
+ // Broker:
165
+ // hooks:
166
+ // sdk_update_pre_build_update_request:
167
+ // template_path: templates/sdk_update_pre_build_request.go.tpl
166
168
type HooksConfig struct {
167
169
// Code is the Go code to be injected at the hook point
168
170
Code * string `json:"code,omitempty"`
@@ -187,27 +189,27 @@ type CompareConfig struct {
187
189
// API accepts a parameter called "Attributes" that can contain one of four
188
190
// keys:
189
191
//
190
- // * DeliveryPolicy – The policy that defines how Amazon SNS retries failed
191
- // deliveries to HTTP/S endpoints.
192
- // * DisplayName – The display name to use for a topic with SMS subscriptions
193
- // * Policy – The policy that defines who can access your topic.
194
- // * KmsMasterKeyId - The ID of an AWS-managed customer master key (CMK) for
195
- // Amazon SNS or a custom CMK.
192
+ // - DeliveryPolicy – The policy that defines how Amazon SNS retries failed
193
+ // deliveries to HTTP/S endpoints.
194
+ // - DisplayName – The display name to use for a topic with SMS subscriptions
195
+ // - Policy – The policy that defines who can access your topic.
196
+ // - KmsMasterKeyId - The ID of an AWS-managed customer master key (CMK) for
197
+ // Amazon SNS or a custom CMK.
196
198
//
197
199
// The `CreateTopic` API call **returns** only a single field: the TopicARN.
198
200
// But there is a separate `GetTopicAttributes` call that needs to be made that
199
201
// returns the above attributes (that are ReadWrite) along with a set of
200
202
// key/values that are ReadOnly:
201
203
//
202
- // * Owner – The AWS account ID of the topic's owner.
203
- // * SubscriptionsConfirmed – The number of confirmed subscriptions for the
204
- // topic.
205
- // * SubscriptionsDeleted – The number of deleted subscriptions for the topic.
206
- // * SubscriptionsPending – The number of subscriptions pending confirmation
207
- // for the topic.
208
- // * TopicArn – The topic's ARN.
209
- // * EffectiveDeliveryPolicy – The JSON serialization of the effective delivery
210
- // policy, taking system defaults into account.
204
+ // - Owner – The AWS account ID of the topic's owner.
205
+ // - SubscriptionsConfirmed – The number of confirmed subscriptions for the
206
+ // topic.
207
+ // - SubscriptionsDeleted – The number of deleted subscriptions for the topic.
208
+ // - SubscriptionsPending – The number of subscriptions pending confirmation
209
+ // for the topic.
210
+ // - TopicArn – The topic's ARN.
211
+ // - EffectiveDeliveryPolicy – The JSON serialization of the effective delivery
212
+ // policy, taking system defaults into account.
211
213
//
212
214
// This structure instructs the code generator about the above real, schema'd
213
215
// fields that are masquerading as raw key/value pairs.
@@ -534,6 +536,42 @@ func (c *Config) GetResourceFieldName(
534
536
return renamed
535
537
}
536
538
539
+ // GetOriginalMemberName returns the original struct member name within an
540
+ // Input or Output shape given a resource and field name. This accounts for any
541
+ // renames that may have occurred. It is the reverse of the
542
+ // Config.GetResourceFieldName method.
543
+ func (c * Config ) GetOriginalMemberName (
544
+ resourceName string ,
545
+ opID string ,
546
+ fieldName string ,
547
+ ) string {
548
+ if c == nil {
549
+ return fieldName
550
+ }
551
+ rConfig , ok := c .Resources [resourceName ]
552
+ if ! ok {
553
+ return fieldName
554
+ }
555
+ if rConfig .Renames == nil {
556
+ return fieldName
557
+ }
558
+ oRenames , ok := rConfig .Renames .Operations [opID ]
559
+ if ! ok {
560
+ return fieldName
561
+ }
562
+ for from , to := range oRenames .InputFields {
563
+ if to == fieldName {
564
+ return from
565
+ }
566
+ }
567
+ for from , to := range oRenames .OutputFields {
568
+ if to == fieldName {
569
+ return from
570
+ }
571
+ }
572
+ return fieldName
573
+ }
574
+
537
575
// GetResourceShortNames returns the CRD list of aliases
538
576
func (c * Config ) GetResourceShortNames (resourceName string ) []string {
539
577
if c == nil {
0 commit comments