@@ -78,12 +78,14 @@ func (a *SDKAPI) GetOperationMap(cfg *ackgenconfig.Config) *OperationMap {
78
78
// create an index of Operations by operation types and resource name
79
79
opMap := OperationMap {}
80
80
for opID , op := range a .API .Operations {
81
- opTypeArray , resName := getOpTypeAndResourceName (opID , cfg )
81
+ opTypeArray , resList := getOpTypeAndResourceName (opID , cfg )
82
82
for _ , opType := range opTypeArray {
83
83
if _ , found := opMap [opType ]; ! found {
84
84
opMap [opType ] = map [string ]* awssdkmodel.Operation {}
85
85
}
86
- opMap [opType ][resName ] = op
86
+ for _ , resName := range resList {
87
+ opMap [opType ][resName ] = op
88
+ }
87
89
}
88
90
}
89
91
@@ -98,16 +100,18 @@ func (a *SDKAPI) GetOperationMap(cfg *ackgenconfig.Config) *OperationMap {
98
100
//
99
101
// see: https://github.com/aws-controllers-k8s/community/issues/1555
100
102
for opID , opCfg := range cfg .Operations {
101
- if opCfg .ResourceName == "" {
103
+ if opCfg .ResourceName == nil {
102
104
continue
103
105
}
104
106
op , found := a .API .Operations [opID ]
105
107
if ! found {
106
108
panic ("operation " + opID + " in generator.yaml 'operations:' object does not exist." )
107
109
}
108
110
for _ , operationType := range opCfg .OperationType {
109
- opType := OpTypeFromString (operationType )
110
- opMap [opType ][opCfg.ResourceName ] = op
111
+ for _ , resName := range opCfg .ResourceName {
112
+ opType := OpTypeFromString (operationType )
113
+ opMap [opType ][resName ] = op
114
+ }
111
115
}
112
116
}
113
117
a .opMap = & opMap
@@ -360,20 +364,19 @@ func NewSDKAPI(api *awssdkmodel.API, apiGroupSuffix string) *SDKAPI {
360
364
}
361
365
362
366
// Override the operation type and/or resource name, if specified in config
363
- func getOpTypeAndResourceName (opID string , cfg * ackgenconfig.Config ) ([]OpType , string ) {
367
+ func getOpTypeAndResourceName (opID string , cfg * ackgenconfig.Config ) ([]OpType , [] string ) {
364
368
opType , resName := GetOpTypeAndResourceNameFromOpID (opID , cfg )
365
369
opTypes := []OpType {opType }
370
+ resList := []string {resName }
366
371
367
372
if operationConfig , exists := cfg .GetOperationConfig (opID ); exists {
368
- if operationConfig .ResourceName != "" {
369
- resName = operationConfig .ResourceName
370
- }
373
+ resList = operationConfig .ResourceName
371
374
for _ , operationType := range operationConfig .OperationType {
372
375
opType = OpTypeFromString (operationType )
373
376
opTypes = append (opTypes , opType )
374
377
}
375
378
}
376
- return opTypes , resName
379
+ return opTypes , resList
377
380
}
378
381
379
382
// getMemberByPath returns a ShapeRef given a root Shape and a dot-notation
0 commit comments