How to use the yandexcloud._auth_fabric.ServiceAccountAuth function in yandexcloud

To help you get started, we’ve selected a few yandexcloud examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yandex-cloud / python-sdk / yandexcloud / _auth_fabric.py View on Github external
def get_auth_token_requester(token=None, service_account_key=None, metadata_addr=_MDS_ADDR):
    if token is not None and service_account_key is not None:
        raise RuntimeError("Conflicting API credentials properties 'token' and 'service_account_key' are set.")

    if token is not None:
        return TokenAuth(token=token)

    if service_account_key is not None:
        __validate_service_account_key(service_account_key)
        return ServiceAccountAuth(service_account_key)

    return MetadataAuth(metadata_addr=metadata_addr)