spotinst-sdk-python
spotinst-sdk-python copied to clipboard
[src] Avoid creating accounts with duplicate names
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
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)
@guyalt3 @zivmessing Please review and approve