当前位置: 首页>>代码示例>>Python>>正文


Python session.get_config_variable方法代码示例

本文整理汇总了Python中botocore.session.get_config_variable方法的典型用法代码示例。如果您正苦于以下问题:Python session.get_config_variable方法的具体用法?Python session.get_config_variable怎么用?Python session.get_config_variable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在botocore.session的用法示例。


在下文中一共展示了session.get_config_variable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_aws_session

# 需要导入模块: from botocore import session [as 别名]
# 或者: from botocore.session import get_config_variable [as 别名]
def _create_aws_session(profile):

    def _create_and_verify(profile_to_use=None):
        session = botocore.session.Session(profile=profile_to_use)
        session.get_config_variable('region')
        return session

    try:
        session = _create_and_verify(profile)
    except botocore.exceptions.ProfileNotFound:
        try:
            session = _create_and_verify('default')
        except botocore.exceptions.ProfileNotFound:
            session = _create_and_verify()

    return session 
开发者ID:venth,项目名称:aws-adfs,代码行数:18,代码来源:prepare.py

示例2: _deploy_app

# 需要导入模块: from botocore import session [as 别名]
# 或者: from botocore.session import get_config_variable [as 别名]
def _deploy_app(temp_dirname):
    factory = CLIFactory(temp_dirname)
    config = factory.create_config_obj(
        chalice_stage_name='dev',
        autogen_policy=True
    )
    session = factory.create_botocore_session()
    d = factory.create_default_deployer(session, config, UI())
    region = session.get_config_variable('region')
    deployed = _deploy_with_retries(d, config)
    application = SmokeTestApplication(
        region=region,
        deployed_values=deployed,
        stage_name='dev',
        app_name=RANDOM_APP_NAME,
        app_dir=temp_dirname,
    )
    return application 
开发者ID:aws,项目名称:chalice,代码行数:20,代码来源:test_features.py

示例3: _get_presigned_url

# 需要导入模块: from botocore import session [as 别名]
# 或者: from botocore.session import get_config_variable [as 别名]
def _get_presigned_url(self, cluster_name, role_arn):
        session = self._session_handler.get_session(
            self._region_name,
            role_arn
        )

        if self._region_name is None:
            self._region_name = session.get_config_variable('region')

        loader = botocore.loaders.create_loader()
        data = loader.load_data("endpoints")
        endpoint_resolver = botocore.regions.EndpointResolver(data)
        endpoint = endpoint_resolver.construct_endpoint(
            AUTH_SERVICE,
            self._region_name
        )
        signer = RequestSigner(
            ServiceId(AUTH_SERVICE),
            self._region_name,
            AUTH_SERVICE,
            AUTH_SIGNING_VERSION,
            session.get_credentials(),
            session.get_component('event_emitter')
        )
        action_params='Action=' + AUTH_COMMAND + '&Version=' + AUTH_API_VERSION
        params = {
            'method': 'GET',
            'url': 'https://' + endpoint["hostname"] + '/?' + action_params,
            'body': {},
            'headers': {CLUSTER_NAME_HEADER: cluster_name},
            'context': {}
        }

        url=signer.generate_presigned_url(
            params,
            region_name=endpoint["credentialScope"]["region"],
            operation_name='',
            expires_in=URL_TIMEOUT
        )
        return url 
开发者ID:gkrizek,项目名称:bash-lambda-layer,代码行数:42,代码来源:get_token.py

示例4: create_adfs_default_config

# 需要导入模块: from botocore import session [as 别名]
# 或者: from botocore.session import get_config_variable [as 别名]
def create_adfs_default_config(profile):
    config = type('', (), {})()

    # Use botocore session API to get defaults
    session = _create_aws_session(profile)

    # region: The default AWS region that this script will connect
    # to for all API calls
    config.region = session.get_config_variable('region') or 'eu-central-1'

    # aws cli profile to store config and access keys into
    config.profile = session.profile or 'default'

    # output format: The AWS CLI output format that will be configured in the
    # adf profile (affects subsequent CLI calls)
    config.output_format = session.get_config_variable('format') or 'json'

    # aws credential location: The file where this script will store the temp
    # credentials under the configured profile
    config.aws_credentials_location = os.path.expanduser(session.get_config_variable('credentials_file'))
    config.aws_config_location = os.path.expanduser(session.get_config_variable('config_file'))

    # cookie location: The file where this script will store the ADFS session cookies
    config.adfs_cookie_location = os.path.join(os.path.dirname(config.aws_credentials_location), 'adfs_cookies')

    # SSL certificate verification: Whether or not strict certificate
    # verification is done, False should only be used for dev/test
    config.ssl_verification = True

    # Override CA bundle for SSL certificate verification for ADFS server only.
    config.adfs_ca_bundle = None

    # AWS role arn
    config.role_arn = None

    config.adfs_host = None

    config.adfs_user = None

    # aws provider id. (Optional - 9/10 times it will always be urn:amazon:websevices)
    config.provider_id = 'urn:amazon:webservices'

    # Note: if your bucket require CORS, it is advised that you use path style addressing
    # (which is set by default in signature version 4).
    config.s3_signature_version = None

    # AWS STS session duration, default is 3600 seconds
    config.session_duration = int(3600)

    # Whether SSPI is enabled
    config.sspi = system() == "Windows"

    # Whether to also trigger the default authentication method when U2F is available
    config.u2f_trigger_default = True

    return config 
开发者ID:venth,项目名称:aws-adfs,代码行数:58,代码来源:prepare.py


注:本文中的botocore.session.get_config_variable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。