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

Add commands to work with api testing project vaults #776

Merged
merged 36 commits into from
May 24, 2023
Merged

Add commands to work with api testing project vaults #776

merged 36 commits into from
May 24, 2023

Conversation

mhan83
Copy link
Contributor

@mhan83 mhan83 commented May 17, 2023

Proposed changes

Adds the following commands to work with an api testing project vault:

saucectl apit vault get [--project PROJECT_NAME]
saucectl apit vault get-variable NAME [--project PROJECT_NAME]
saucectl apit vault set-variable NAME VALUE [--project PROJECT_NAME]
saucectl apit vault get-snippet NAME [--project PROJECT_NAME]
saucectl apit vault set-snippet NAME FILE_PATH|- [--project PROJECT_NAME]

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have updated the json schema (if appropriate)

Further comments

  • Opted to make project a flag and not a positional arg. I opted for that because a command like get-variable feels like it wants the variable-in-question as the positional arg. Having the project be positional felt a bit awkward and unintuitive. But we already have some commands that have a "resource" as a positional arg, e.g artifacts download JOB_ID FILE_PATTERN. So if we prefer consistency, I'm happy to go that route.
  • If --project is not specified and the terminal is a tty, user will be prompted to choose from a list of projects:
    demo1
  • A snippet is structured data (at the moment an xml document, but will eventually be yaml) so I've implemented set-variable to take either a path to a file or - to denote stdin. Accepting from stdin is slightly pedantic, but experienced cli users may expect it.

internal/cmd/apit/get.go Outdated Show resolved Hide resolved
internal/cmd/apit/get.go Outdated Show resolved Hide resolved
internal/cmd/apit/get.go Outdated Show resolved Hide resolved
internal/cmd/apit/getsnippet.go Outdated Show resolved Hide resolved
internal/cmd/apit/getvariable.go Outdated Show resolved Hide resolved
internal/cmd/apit/vault.go Outdated Show resolved Hide resolved
internal/cmd/apit/vault.go Outdated Show resolved Hide resolved
internal/cmd/apit/vault.go Outdated Show resolved Hide resolved
internal/http/apitester.go Outdated Show resolved Hide resolved
internal/http/apitester.go Outdated Show resolved Hide resolved
@alexplischke
Copy link
Contributor

I'm on board with --project 👍

@mhan83 mhan83 marked this pull request as ready for review May 18, 2023 02:40
@mhan83 mhan83 requested a review from a team as a code owner May 18, 2023 02:40
Co-authored-by: Alex Plischke <alex.plischke@saucelabs.com>
@mhan83 mhan83 merged commit 8b3e193 into main May 24, 2023
@mhan83 mhan83 deleted the DEVX-2302 branch May 24, 2023 16:10
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.

2 participants