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

New API Token cmdlets #317

Merged
merged 9 commits into from
Jun 26, 2019
Merged

New API Token cmdlets #317

merged 9 commits into from
Jun 26, 2019

Conversation

chriswahl
Copy link
Contributor

Description

I would like to be able to programmatically request a new API Token as part of an automated workflow for token rotation.

Related Issue

Fixes #316

Motivation and Context

Even though a user can generate a new API Token using the GUI, there exists the need to rotate those tokens on a regular basis. This can be done through regular expiration / creation cycles, or by forcing an expiration of a token arbitrarily and creating a new token on demand.

How Has This Been Tested?

  • Tested against CDM 5.0 with several variety of API Tokens generated with different tags, expiration dates, and organizations.
  • Tested with Pester to ensure null and empty parameters are handled properly.

Screenshots (if appropriate):

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (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 change)

Checklist:

Go over all the following points, and put an x in all the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help!

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTION document.
  • I have updated the CHANGELOG file accordingly for the version that this merge modifies.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@chriswahl chriswahl changed the title Api token New API Token cmdlets Jun 25, 2019
@chriswahl
Copy link
Contributor Author

This cmdlet is only supported in 5.0 (new feature). Because of this, it appears that Pester tests for the Get-RubrikAPIData function are failing since there is no compatibility with 4.0, 4.1, and 4.2.

@chriswahl chriswahl self-assigned this Jun 25, 2019
@mwpreston mwpreston self-requested a review June 26, 2019 02:53
mwpreston
mwpreston previously approved these changes Jun 26, 2019
Copy link
Contributor

@mwpreston mwpreston left a comment

Choose a reason for hiding this comment

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

@jaapbrasser - I'm not sure if we can exclude different api version from the pester tests on the Get-RubrikAPIData cmdlet? Either way, other than that this code looks good to me... I'll leave the merge to you :)

Copy link
Contributor

@jaapbrasser jaapbrasser left a comment

Choose a reason for hiding this comment

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

Reviewed, looks good thanks for the work here @chriswahl & @mwpreston

@jaapbrasser jaapbrasser merged commit 99829e1 into master Jun 26, 2019
@jaapbrasser jaapbrasser deleted the api-token branch June 26, 2019 14:39
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.

API Token Creation and Removal
3 participants