Update docstring and args type hints for the method DecortController.account_find

This commit is contained in:
2024-07-19 13:09:43 +03:00
parent 3b2be18346
commit a0805d45b3

View File

@@ -2004,21 +2004,44 @@ class DecortController(object):
self.result['changed'] = True self.result['changed'] = True
return return
def account_find(self, account_name, account_id=0, def account_find(self, account_name: str, account_id=0,
resource_consumption=False, resource_consumption=False,
resource_groups_params: None | dict = None, resource_groups_params: None | dict = None,
computes_params: None | dict = None, computes_params: None | dict = None,
fail_if_not_found=False): fail_if_not_found=False):
"""Find cloud account specified by the name and return facts about the account. Knowing account is """
required for certain cloud resource management tasks (e.g. creating new RG). Find account specified by account ID or name and return
a turple with account ID and account info dict.
@param (string) account_name: name of the account to find. Pass empty string if you want to @param (string) account_name: name of the account to find.
find account by ID and make sure you specifit posisite arg_account_id. Pass empty string if you want to find account by ID.
@param (int) ccount_id: ID of the account to find. If arg_account_name is empty string, then
arg_account_id must be positive, and method will look for account by the specified ID.
Returns non zero account ID and a dictionary with account details on success, 0 and empty @param (int) account_id: ID of the account to find.
dictionary otherwise.
@param (bool) resource_consumption: If `True` is specified,
then the method `account_resource_consumption`
will be called passing founded account ID and result of
the call will be added to
account info dict (key `resource_consumption`).
@param (None | dict) resource_groups_params: If dict is
specified, then the method `account_resource_groups`
will be called passing founded account ID
and `**resource_groups_params`. Result of the call will
be added to account info dict (key `resource_groups`).
@param (None | dict) computes_params: If dict is
specified, then the method `account_computes`
will be called passing founded account ID
and `**computes_params`. Result of the call will
be added to account info dict (key `computes`).
@param (bool) fail_if_not_found: If `True` is specified, then
the method `self.amodule.fail_json(**self.result)` will be
called if account is not found.
Returns non zero account ID and account info dict on success,
0 and empty dict otherwise (if `fail_if_not_found=False`).
""" """
self.result['waypoints'] = "{} -> {}".format(self.result['waypoints'], "account_find") self.result['waypoints'] = "{} -> {}".format(self.result['waypoints'], "account_find")