-
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
Allow separate service ID and alias #211
Allow separate service ID and alias #211
Conversation
Note to the reviewers: I'm happy to discuss changing the template variable |
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
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.
Looks good!
pkg/testutil/schema_helper.go
needs some changes as well
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: A-Hilaly, RedbackThomson, vijtrip2 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 |
@@ -34,6 +31,9 @@ type MetaVars struct { | |||
// for custom resources, e.g. "sns.services.k8s.aws" or | |||
// "sfn.services.k8s.aws" | |||
APIGroup string | |||
// AWSSDKModelServiceID is the exact string that appears in the AWS service API's | |||
// api-2.json descriptor file under `metadata.serviceId` | |||
AWSSDKModelServiceID string |
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 probably could have just been SDKModelServiceID
to match the SDKAPIInterfaceTypeName
field below.
This reverts commit 15c7f5c.
Description of changes: Reverts aws-controllers-k8s#214 and aws-controllers-k8s#211 in favour of using the `generator.yaml` file to store the service model name By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: aws-controllers-k8s/community#994 Description of changes: This pull request replaces all templates and variables with a defined nomenclature. The current code-generator uses service name terms interchangeably, which eventually lead to the linked issue. While PR #211 solved the logical issue of overriding the service model name, in some cases, it did not do a clear job of clarifying what names exist for any service and when they are applicable. There are 3 different names that are used to programmatically reference a service. Here are the terms I am using in this PR to refer to them, and their given purpose: - Service ID - The `metadata.serviceID` field from the model `api-2.json` file - Service model name - The path to the model `api-2.json` file - Service package name - The AWS SDK Go package path - Used by the ACK controller's for their name Some examples on when these differ: - Step Functions uses `sfn` for its ID and alias, but `states` for its model name - Elastic Load Balancing v2 uses `elbv2` for its alias, but `elasticloadbalancingv2` for its ID and model name There are also 2 names defined in the controller metadata file that are not used in any parts of the code, but are used in documentation: - Service name - The full name of the service as defined by the product's documentation page (eg. `Amazon Elastic Cloud Compute`) - Service short name - An informal, shortened name of the service (eg. `EC2`) 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
command line argument for anyack-generate
generator verb. The generator will use this argument to override the service name when looking up the API files inaws-sdk-go/models/apis
.Currently we reference the
metadata.serviceId
field from theapi-2.json
file as theServiceIDClean
variable.ServiceIDClean
is used in all code generator templates as the import path foraws-sdk-go
and when referencing the controller name (eg.{{ .ServiceIDClean}}-controller
). This pull request will redirectServiceIDClean
to use the service alias provided when callingack-generate
, instead. Therefore, all subsequent ACK repositories should be named according to the AWS SDK Go package name, rather than the API file's definition ofserviceId
.ServiceID
has been removed from the template variables, instead replaced byAWSSDKModelServiceID
if it is needed.ServiceIDClean
now refers to the name of the AWS SDK Go package name.For services that need to use the
--model-name
command line argument, such asopensearchservice
andelbv2
, developers should use theACK_GENERATE_MODEL_NAME
environment variable when callingmake build-controller
. Changes to the CI/CD system will need to be made to accommodate this customisation.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.