Skip to content
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

Adds list of string to endpoint/auth scheme parameters and support for JmesPath-defined operation context parameters #5168

Merged
merged 16 commits into from May 13, 2024

Conversation

cenedhryn
Copy link
Contributor

@cenedhryn cenedhryn commented Apr 30, 2024

Motivation and Context

Endpoint and auth scheme parameters are currently limited to String and Boolean types, which does not support use cases where endpoint resolution or authentication logic needs to evaluate lists of values. With this change, the SDK

  • Supports List as a valid type for Endpoint and Auth Scheme params
  • Adds OperationContextParams as a concept for a service API parameter that
    • is added to a service API at the operation level
    • must contain a JmesPath expression that at runtime can evaluate the request object against the expression in order to resolve an endpoint/authscheme param
    • must correspond to an endpoint parameter as defined in endpoint rules or in the customization.config file

Limitation:

  • OperationContextParams must be defined in the customization.config file at this time. Eventually, there will be service model support

Modifications

List of string as endpoint param type
  • Adds stringarray to the endpoint/auth scheme params
Operation Context Params
  • Adds OperationContextParams to the codegen intermediate model
  • Adds OperationContextParams to the customization.config which is added to the intermediate model when the code generator interprets the service model.
JmesPath
  • Refactors the current JmesPath runtime, used by Waiters, to be a JmesPathRuntime available to all of the SDK components
  • Refactors the current codegen of JmesPath expressions to be more generic
  • Adds the functions keys and wildcard to the JmesPath expression parser, code generator and runtime
S3
  • Adds DeleteObjectKeys as a new OperationContextParam (and EndpointParam) in customization.config. The JmesPath expression is Delete.Objects[*].Key, and will return all values of the ObjectIdentifier field key in a request object.

Testing

Unit and functional testing. See especially

  • JmesPathRuntimeValueTest.java (tests JmesPathRuntime)
  • OperationContextParametersTest.java (functional OperationContextParam test)
  • ListOfStringsAuthParamPluginTest.java (Tests S3 DeleteObjectKeys OperationContextParam)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

joviegas and others added 10 commits April 22, 2024 12:46
…nd Auth schemes params based on end-point-rule-set.json. (#5122)

* feat(StringArrayEndpointParams) Codegen String Array Enpoint params and Auth schemes params based on end-point-rule-set.json.

* addressed review comments v1
…s-sdk-java-v2 into feature/StringArrayEndpointParams
…ts, until all SDKs add support for string array. (#5137)

* new(StringArrayEndpointParams) Customization of  String Array Enpoint params  because S3 Access grants will not update the models until all sdks support stringarray endpoint params

* addressed review comments v1
…ms defined for a Operation. (#5146)

* new(StringArrayEndpointParams) Codegeneration of OperationContextParams defined for a Operation

* addressed review comments v1
…text params and adding customizations for S3"

This reverts commit 0afffa3.
* Extracting existing JMESPath runtime to a separate class that can be used by waiters and other components

* Deleted temp file

* Changing name from JPath to JmesPath
…ams and adding customizations for S3 (#5159)

new(StringArrayEndpointParams) Customization of Operation Context params and adding customizations for S3
@cenedhryn cenedhryn requested a review from a team as a code owner April 30, 2024 20:30
* Converts endpoint param list of string to list of value, so that the rules engine can handle it

* Moved to identifier token
* Generates JmesPath expressions for operation context parameters

* Added test cases for runtime value functions

* Updating exceptions
* Supporting wildcard and keys fn in JmesPathRuntime

* Removing try catch, fixes test bug and filters null elements
@cenedhryn cenedhryn changed the title [Draft] Feature/string array endpoint params Adds list of string to endpoint/auth scheme parameters and support for JmesPath-defined operation context parameters May 13, 2024
@cenedhryn cenedhryn enabled auto-merge (squash) May 13, 2024 03:41
"stringarray".equals(parameterModel.getType().toLowerCase(Locale.US));
}

//TODO (string-array-params): resolve this logical test before finalizing coding
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding handling this TODO to the fast-follow cleanup task.

Copy link

sonarcloud bot commented May 13, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
77.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@cenedhryn cenedhryn merged commit 6cf81c7 into master May 13, 2024
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants