spotinst-sdk-python icon indicating copy to clipboard operation
spotinst-sdk-python copied to clipboard

[src] Avoid creating accounts with duplicate names

Open YarinPinyan opened this issue 2 years ago • 1 comments

This is the default pull request template. You can customize it by adding a pull_request_template.md at the root of your repo or inside the .github folder.

Demo

With the following code, that the first account that exists under your entered Spotinst creds file, it should raise a SpotinstClientException

spotinst = SpotinstSession()

client = spotinst.client(service="admin")
my_accounts = client.get_accounts()
if my_accounts:
    sample_name: str = my_accounts[0]['name']
    client.create_account(sample_name)

Output

image

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have validated all the requirements in the Jira task were answered
  • [x] I have all necessary approvals for the design/mini design of this task
  • [x] I have approved the API changes and granular permission patterns (documentation subtask) (For public services only)

YarinPinyan avatar Mar 25 '22 13:03 YarinPinyan

@guyalt3 @zivmessing Please review and approve

YarinPinyan avatar Mar 25 '22 13:03 YarinPinyan