def get_account_name(identifier): """Fetches account name from SWAG. :param identifier: identifier to fetch """ log.debug(f'Fetching account information. Name: {identifier}') account_data = swag.get(f"[?id=='{identifier}']") if not account_data: raise ResolveException(f'Unable to find any account information. Identifier: {identifier}') return account_data['name']
def get_account_name(identifier): """Fetches account name from SWAG. :param identifier: identifier to fetch """ log.debug(f"Fetching account information. Name: {identifier}") account_data = swag.get(f"[?id=='{identifier}']") if not account_data: raise ResolveException( f"Unable to find any account information. Identifier: {identifier}" ) return account_data["name"]
def get_account_id(identifier): """Fetches account id from SWAG. :param identifier: identifier to fetch """ log.debug(f'Fetching account information. Identifier: {identifier}') account_data = swag.get(f"[?id=='{identifier}']") if not account_data: account_data = swag.get_by_name(identifier, alias=True) if not account_data: raise ResolveException(f'Unable to find any account information. Identifier: {identifier}') if len(account_data) > 1: raise ResolveException( f'Unable to resolve to a single account. Accounts: {len(account_data)} Identifier: {identifier}' ) return account_data[0]['id'] return account_data['id']
def get_account_id(identifier): """Fetches account id from SWAG. :param identifier: identifier to fetch """ log.debug(f"Fetching account information. Identifier: {identifier}") account_data = swag.get(f"[?id=='{identifier}']") if not account_data: account_data = swag.get_by_name(identifier, alias=True) if not account_data: raise ResolveException( f"Unable to find any account information. Identifier: {identifier}" ) if len(account_data) > 1: raise ResolveException( f"Unable to resolve to a single account. Accounts: {len(account_data)} Identifier: {identifier}" ) return account_data[0]["id"] return account_data["id"]