Add new cloudapi/v6 package with auth feature #5465
+22,664
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This PR introduces a new
cloudapi/v6package (internal for now) that calls the k6 Cloud API v6 instead of v1. It only supports validating token as it's the first step we need to retrieve the stack ID (see #5420). Then, I'll iterate on it to introduce more features.The main differences with the existing
cloudapipackage are:CheckResponsehas minor updates and theResponseErrortype now contains and parses thek6cloud.ErrorApiModeltype)LegacyCloudConfigKey(loadimpact). I believe there are many more improvements to be made in this file but it will be easier to review if I keep them in a separate PR - especially as the changes will be visible in the same file instead of having to compare the old and new files side by side).Why?
We want to migrate to the k6 Cloud API v6 for k6 cloud commands. This is a preliminary work that should help adding support to configure the default stack used by Cloud commands. Then, we'll iterate on it to add more features and use them in the Cloud commands.
Checklist
make check) and all pass.Checklist: Documentation (only for k6 maintainers and if relevant)
Please do not merge this PR until the following items are filled out.
Related PR(s)/Issue(s)
Part of #4008 and #5009