Python botocore.session.get_config_variable() Examples
The following are 4
code examples of botocore.session.get_config_variable().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
botocore.session
, or try the search function
.
Example #1
Source File: prepare.py From aws-adfs with MIT License | 6 votes |
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
Example #2
Source File: test_features.py From chalice with Apache License 2.0 | 6 votes |
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
Example #3
Source File: get_token.py From bash-lambda-layer with MIT License | 5 votes |
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
Example #4
Source File: prepare.py From aws-adfs with MIT License | 4 votes |
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