How to use the awsume.awsumepy.default_plugins.get_credentials function in awsume

To help you get started, we’ve selected a few awsume 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 trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
auto_refresh=False,
        region=None,
    )
    profiles = {
        'role': {
            'role_arn': 'myrolearn',
            'source_profile': 'user',
        },
        'user': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
            'mfa_serial': 'mymfaserial',
        },
    }

    result = default_plugins.get_credentials(config, arguments, profiles)
    aws_lib.get_session_token.assert_not_called()
    aws_lib.assume_role.assert_called_with(
        { 'AccessKeyId': 'AKIA...', 'SecretAccessKey': 'SECRET', 'SessionToken': None, 'Region': None },
        'myrolearn',
        'mysessionname',
        region=None,
        external_id='myexternalid',
        role_duration='43200',
        mfa_serial='mymfaserial',
        mfa_token='123123',
    )
    assert result == aws_lib.assume_role.return_value
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
auto_refresh=False,
        region=None,
    )
    profiles = {
        'role': {
            'role_arn': 'myrolearn',
            'source_profile': 'user',
        },
        'user': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
            'mfa_serial': 'mymfaserial',
        },
    }

    result = default_plugins.get_credentials(config, arguments, profiles)
    aws_lib.get_session_token.assert_called_with(
        { 'AccessKeyId': 'AKIA...', 'SecretAccessKey': 'SECRET', 'SessionToken': None, 'Region': None },
        region=None,
        mfa_serial='mymfaserial',
        mfa_token='123123',
        ignore_cache=True,
    )
    assert result == aws_lib.get_session_token.return_value
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
auto_refresh=True,
        region=None,
    )
    profiles = {
        'role': {
            'role_arn': 'myrolearn',
            'source_profile': 'user',
        },
        'user': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
            'mfa_serial': 'mymfaserial',
        },
    }

    result = default_plugins.get_credentials(config, arguments, profiles)
    aws_lib.get_session_token.assert_called_with(
        { 'AccessKeyId': 'AKIA...', 'SecretAccessKey': 'SECRET', 'SessionToken': None, 'Region': None },
        region=None,
        mfa_serial='mymfaserial',
        mfa_token='123123',
        ignore_cache=True,
    )
    aws_lib.assume_role.assert_called_with(
        aws_lib.get_session_token.return_value,
        'myrolearn',
        'mysessionname',
        region=None,
        external_id='myexternalid',
        role_duration=0,
    )
    assert result == aws_lib.assume_role.return_value
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
auto_refresh=True,
        region=None,
    )
    profiles = {
        'role': {
            'role_arn': 'myrolearn',
            'source_profile': 'user',
        },
        'user': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
            'mfa_serial': 'mymfaserial',
        },
    }
    with pytest.raises(SystemExit):
        default_plugins.get_credentials(config, arguments, profiles)
    safe_print.assert_called()
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
force_refresh=True,
        auto_refresh=False,
        region=None,
    )
    profiles = {
        'role': {
            'role_arn': 'myrolearn',
            'source_profile': 'user',
        },
        'user': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
        },
    }

    result = default_plugins.get_credentials(config, arguments, profiles)
    aws_lib.get_session_token.assert_not_called()
    aws_lib.assume_role.assert_called_with(
        { 'AccessKeyId': 'AKIA...', 'SecretAccessKey': 'SECRET', 'SessionToken': None, 'Region': None },
        'myrolearn',
        'mysessionname',
        region=None,
        external_id='myexternalid',
        role_duration=0,
    )
    assert result == aws_lib.assume_role.return_value
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
force_refresh=True,
        auto_refresh=False,
        region=None,
    )
    profiles = {
        'role': {
            'role_arn': 'myrolearn',
            'source_profile': 'user',
        },
        'user': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
        },
    }

    result = default_plugins.get_credentials(config, arguments, profiles)
    assert result == assume_role_from_cli.return_value
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
force_refresh=True,
        auto_refresh=False,
        region=None,
    )
    profiles = {
        'role': {
            'role_arn': 'myrolearn',
            'source_profile': 'user',
        },
        'user': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
        },
    }

    result = default_plugins.get_credentials(config, arguments, profiles)
    aws_lib.get_session_token.assert_not_called()
    aws_lib.assume_role.assert_not_called()
    assert result == {
        'AccessKeyId': 'AKIA...',
        'SecretAccessKey': 'SECRET',
        'SessionToken': None,
        'Region': None,
    }
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
auto_refresh=False,
        region=None,
    )
    profiles = {
        'role': {
            'role_arn': 'myrolearn',
            'source_profile': 'user',
        },
        'user': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
            'mfa_serial': 'mymfaserial',
        },
    }

    result = default_plugins.get_credentials(config, arguments, profiles)
    aws_lib.get_session_token.assert_called_with(
        { 'AccessKeyId': 'AKIA...', 'SecretAccessKey': 'SECRET', 'SessionToken': None, 'Region': None },
        region=None,
        mfa_serial='mymfaserial',
        mfa_token='123123',
        ignore_cache=True,
    )
    aws_lib.assume_role.assert_called_with(
        aws_lib.get_session_token.return_value,
        'myrolearn',
        'mysessionname',
        region=None,
        external_id='myexternalid',
        role_duration=0,
    )
    assert result == aws_lib.assume_role.return_value