Bug on delete Account operation
There is a bug on arguments for delete account method delete_account. The method should accept account_name (means Name of the Account - as described on the method) but it accept only account_id.
The Error
respDelAcc = client.delete_account('MyAccountName')
---------------------------------------------------------------------------
SpotinstClientException Traceback (most recent call last)
<ipython-input-24-3f1331453d1c> in <module>
----> 1 respDelAcc = client.delete_account('MyAccountName')
/opt/conda/lib/python3.8/site-packages/spotinst_sdk/__init__.py in delete_account(self, account_name)
1400 (Object): Spotinst API response
1401 """
-> 1402 response = self.send_delete(
1403 url=self.__base_setup_url +
1404 "/account/" + account_name,
/opt/conda/lib/python3.8/site-packages/spotinst_sdk/__init__.py in send_delete(self, url, entity_name)
3554 return True
3555 else:
-> 3556 self.handle_exception("deleting {}".format(entity_name), result)
3557
3558 def send_delete_with_body(self, body, url, entity_name):
/opt/conda/lib/python3.8/site-packages/spotinst_sdk/__init__.py in handle_exception(self, action_string, result)
3685 self.print_output(response_json)
3686
-> 3687 raise SpotinstClientException(
3688 "Error encountered while " +
3689 action_string,
SpotinstClientException: Error encountered while deleting account
{"status": {"code": 400, "message": "Bad Request"}, "errors": [{"code": "DELETION_FAILED", "message": "Account not found"}]}
When a account name is sent to the method, the API returns that the account was not found.
Success
When I sent the AccountId the API return success (True)
respDelAcc = client.delete_account('act-1234556')
The same happened to me. It seems like the SDK and the API are not the focus of Spot.
The same happened to me. It seems like the SDK and the API are not the focus of Spot.
Yes, seems be!
There is an "desired" workflow that dont cover all cases, like why I need to create an session to manage accounts when I am using organization token?
I've created a PR https://github.com/spotinst/spotinst-sdk-python/pull/62 with suggestions.