-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load service model name from generator #216
Load service model name from generator #216
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Teeny suggestion if you re-spin, but I'm good with this as-is. Thank you @RedbackThomson!
@a-hilaly @brycahta since Vijay is out today and tomorrow, please review and lgtm if all good with this.
@@ -207,3 +212,67 @@ func getSDKVersionFromGoMod(goModPath string) (string, error) { | |||
} | |||
return "", fmt.Errorf("couldn't find %s in the go.mod require block", sdkModule) | |||
} | |||
|
|||
// loadModelWithLatestAPIVersion finds the AWS SDK for a given service alias and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and the code below, considering (in a future PR if you agree with me) perhaps putting this into an importable package under pkg/
} | ||
|
||
// loadModel finds the AWS SDK for a given service alias and creates a new model | ||
// with the given API version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if apiVersion
is empty string?
m, err := ackmodel.New( | ||
sdkAPI, "", optGeneratorConfigPath, ackgenerate.DefaultConfig, | ||
) | ||
m, err := loadModel(svcAlias, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could you add a comment as to why the apiVersion is empty here? If it doesn't matter, then loadModelWithLatestAPIVersion
would be clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually couldn't tell you why apiVersion
needs to be empty string, only for release. I get an abstract error when I provide the latest API version. I believe this may because of the multiversion support - you would not need to specify an API version since it assumes each of them individually to create the webhook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a-hilaly I would love your input on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brycahta, jaypipes, RedbackThomson The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes aws-controllers-k8s/community#994 Description of changes: This pull request supports including an optional `model_name` field in the `generator.yaml` file. The generator will use this argument to override the service name when looking up the API files in aws-sdk-go/models/apis. Currently `ServiceIDClean` is used in all code generator templates as the import path for aws-sdk-go and when referencing the controller name (eg. `{{ .ServiceIDClean}}-controller`). This pull request will remove `ServiceIDClean` and instead use the service alias (as `ServiceAlias`) when referencing the controller and the aws-sdk-go packages. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Fixes aws-controllers-k8s/community#994
Description of changes:
This pull request supports including an optional
model_name
field in thegenerator.yaml
file. The generator will use this argument to override the service name when looking up the API files in aws-sdk-go/models/apis.Currently
ServiceIDClean
is used in all code generator templates as the import path for aws-sdk-go and when referencing the controller name (eg.{{ .ServiceIDClean}}-controller
). This pull request will removeServiceIDClean
and instead use the service alias (asServiceAlias
) when referencing the controller and the aws-sdk-go packages.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.