Improve code style and docstring for the method `DecortController.account_find`

main
Dmitriy Smirnov 7 months ago
parent 8e4ce18d8a
commit 53938d9d94

@ -2024,49 +2024,52 @@ class DecortController(object):
self.result['changed'] = True
return
def account_find(self, account_name: str, account_id=0,
def account_find(
self,
account_id=0,
account_name: str = '',
computes_args: None | dict = None,
fail_if_not_found=False,
resource_consumption=False,
resource_groups_args: None | dict = None,
computes_args: None | dict = None,
vinses_args: None | dict = None,
fail_if_not_found=False):
):
"""
Find account specified by account ID or name and return
a turple with account ID and account info dict.
@param (int) account_id: ID of the account to find.
@param (string) account_name: name of the account to find.
Pass empty string if you want to find account by ID.
@param (int) account_id: ID of the account to find.
@param (None | dict) computes_args: If dict is
specified, then the method `self.account_computes`
will be called passing founded account ID
and `**computes_args`. 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.
@param (bool) resource_consumption: If `True` is specified,
then the method `account_resource_consumption`
then the method `self.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_args: If dict is
specified, then the method `account_resource_groups`
specified, then the method `self.account_resource_groups`
will be called passing founded account ID
and `**resource_groups_args`. Result of the call will
be added to account info dict (key `resource_groups`).
@param (None | dict) computes_args: If dict is
specified, then the method `account_computes`
will be called passing founded account ID
and `**computes_args`. Result of the call will
be added to account info dict (key `computes`).
@param (None | dict) vinses_args: If dict is
specified, then the method `account_vinses`
specified, then the method `self.account_vinses`
will be called passing founded account ID
and `**vinses_args`. Result of the call will
be added to account info dict (key `vinses`).
@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`).
"""

Loading…
Cancel
Save