-
Notifications
You must be signed in to change notification settings - Fork 226
Create sdk package
#221
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
Create sdk package
#221
Conversation
vijtrip2
left a comment
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.
👍
pkg/sdk/op.go
Outdated
| // permissions and limitations under the License. | ||
|
|
||
| package model | ||
| package sdk |
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 file should stay in pkg/model because it is part of ACK's model, not aws-sdk-go's model.
If you want to move line 42 to the pkg/sdk package, that's fine.
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 will probably need to move it into the util package, to resolve circular dependencies between pkg and model.
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 moved it into a new operations package, instead. util feels more like helper methods than functional logic.
pkg/sdk/sdk_helper.go
Outdated
|
|
||
| // SDKHelper is a helper struct that helps work with the aws-sdk-go models and | ||
| // API model loader | ||
| type SDKHelper struct { |
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.
Maybe we can call this just Helper now? And NewSDKHelper can be just NewHelper.
a703770 to
e563ebe
Compare
|
/test dynamodb-controller-test |
0fa0716 to
96161d5
Compare
a-hilaly
left a comment
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! Left one change request
pkg/generate/code/check.go
Outdated
| var op *awssdkmodel.Operation | ||
| switch opType { | ||
| case model.OpTypeGet: | ||
| case operations.OpTypeGet: |
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.
package operations should be renamed to operation and optionally we can rename OpTypeGet to TypeGet - https://rakyll.org/style-packages/
| func NewSDKHelper(basePath string) *SDKHelper { | ||
| return &SDKHelper{ | ||
| // NewHelper returns a new SDKHelper object | ||
| func NewHelper(basePath string) *Helper { |
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.
👍
jaypipes
left a comment
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.
Sorry @RedbackThomson I don't support the new operations package. That stuff belongs in the model package. Just move the definition of the OperationMap type to the new sdk package and make it unexported IMHO.
ee2b291 to
70f6fd2
Compare
|
As of this commit, I have merged |
|
/test s3-controller-test |
jaypipes
left a comment
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.
Almost there :)
pkg/generate/code/set_sdk.go
Outdated
| // or field to a scalar value. For target variables that are structs, we output | ||
| // the aws-sdk-go's common SetXXX() method. For everything else, we output | ||
| // normal assignment operations. | ||
| // normal assignment model. |
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.
think this is a find/replace oopsie.
pkg/generate/code/set_resource.go
Outdated
| // resources. This heuristic is simplistic (just look for the field with a | ||
| // list type) but seems to be followed consistently by the aws-sdk-go for | ||
| // List operations. | ||
| // List model. |
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.
think this is a find/replace oopsie.
pkg/generate/code/set_resource.go
Outdated
| // resources. This heuristic is simplistic (just look for the field with a | ||
| // list type) but seems to be followed consistently by the aws-sdk-go for | ||
| // List operations. | ||
| // List model. |
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.
think this is a find/replace oopsie.
jaypipes
left a comment
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.
muy bueno, gracias @RedbackThomson!
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jaypipes, 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 |
Description of changes:
Creates a new
sdkpackage that strictly serves the purpose of loading the operations and shapes from the AWS SDK. This is useful to isolate creating the custom fields that need to be injected during this stage.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.