Skip to content

enrollmenttokenapi:Add Region param and WithRegion - #137

Merged
marclop merged 1 commit into
elastic:masterfrom
marclop:f/add-region-to-enrollmenttokenapi-params
Jun 12, 2020
Merged

marclop merged 1 commit into
elastic:masterfrom
marclop:f/add-region-to-enrollmenttokenapi-params

Conversation

@marclop

@marclop marclop commented Jun 11, 2020

Copy link
Copy Markdown
Collaborator

Description

This patch modifies all enrollmenttokenapi public functions to have a
Region string required parameter which is then used to create a new
context.Context: api.WithRegion(context.Background(), params.Region)
and pass it as the API operation context.

Additionally, all the unit tests have been modified to include a request
assertion which ensures that the region path interpolation is used when
the /platform APIs are being called.

Furthermore, the single errors have been removed in favor of prefixed
multi-errors.

Last, the token.go and params.go file have been split into multiple
files each containing a single API context and its parameters.

Related Issues

Part of #129

How Has This Been Tested?

Unit and make fake-sdk in ecctl

Types of Changes

  • Breaking change (fix or feature that would cause existing functionality to change)

This patch modifies all `enrollmenttokenapi` public functions to have a
`Region string` required parameter which is then used to create a new
`context.Context`: `api.WithRegion(context.Background(), params.Region)`
and pass it as the API operation context.

Additionally, all the unit tests have been modified to include a request
assertion which ensures that the region path interpolation is used when
the `/platform` APIs are being called.

Furthermore, the single errors have been removed in favor of prefixed
multi-errors.

Last, the `token.go` and `params.go` file have been split into multiple
files each containing a single API context and its parameters.

Signed-off-by: Marc Lopez <marc5.12@outlook.com>
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := Delete(tt.args.params); !reflect.DeepEqual(err, tt.err) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we start using testify like the other PRs?

@marclop
marclop merged commit 470a54b into elastic:master Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants