B ’äî\žLã@stddlZddlZddlZddlmZddlmZmZddl Z ddl Z ddl m Z m Z ddlmZGdd„deƒZdS) éN)ÚConfig)ÚDataNotFoundErrorÚUnknownServiceError)ÚResourceNotExistsErrorÚUnknownAPIVersionErroré)ÚResourceFactoryc @s eZdZdZd$dd„Zdd„Zedd„ƒZed d „ƒZed d „ƒZ ed d„ƒZ dd„Z dd„Z dd„Z dd„Zd%dd„Zdd„Zd&dd„Zd'd d!„Zd"d#„ZdS)(ÚSessiona/ A session stores configuration state and allows you to create service clients and resources. :type aws_access_key_id: string :param aws_access_key_id: AWS access key ID :type aws_secret_access_key: string :param aws_secret_access_key: AWS secret access key :type aws_session_token: string :param aws_session_token: AWS temporary session token :type region_name: string :param region_name: Default region when creating new connections :type botocore_session: botocore.session.Session :param botocore_session: Use this Botocore session instead of creating a new default one. :type profile_name: string :param profile_name: The name of a profile to use. If not given, then the default profile is used. NcCsÜ|dk r||_n tj ¡|_|jjdkrnd |jj¡}|jjrT|jjd|7_n||j_d|j_tj |j_|dk r„|j  d|¡|s|s|r |j  |||¡|dk r¶|j  d|¡t |j  d¡ƒ|_| ¡| ¡dS)NZBotocorez Botocore/{0}ú ZBoto3ÚprofileÚregionÚ event_emitter)Ú_sessionÚbotocoreÚsessionZ get_sessionZuser_agent_nameÚformatZuser_agent_versionÚuser_agent_extraÚboto3Ú __version__Zset_config_variableZset_credentialsrÚ get_componentÚresource_factoryÚ _setup_loaderÚ_register_default_handlers)ÚselfÚaws_access_key_idÚaws_secret_access_keyÚaws_session_tokenÚ region_nameZbotocore_sessionÚ profile_nameZ botocore_info©rú./tmp/pip-build-uw_ogi45/boto3/boto3/session.pyÚ__init__0s,      zSession.__init__cCsd |jjt|j d¡ƒ¡S)Nz{0}(region_name={1})r )rÚ __class__Ú__name__ÚreprrÚget_config_variable)rrrr Ú__repr__SszSession.__repr__cCs |jjp dS)z1 The **read-only** profile name. Údefault)rr )rrrr rXszSession.profile_namecCs |j d¡S)z0 The **read-only** region name. r )rr%)rrrr r_szSession.region_namecCs |j d¡S)z1 The event emitter for a session r )rr)rrrr ÚeventsfszSession.eventscCs|jjS)zC The profiles available to the session credentials )rÚavailable_profiles)rrrr r)mszSession.available_profilescCs2|j d¡|_|jj tj tj t ¡d¡¡dS)zC Setup loader paths so that we can load resources. Z data_loaderÚdataN) rrÚ_loaderZ search_pathsÚappendÚosÚpathÚjoinÚdirnameÚ__file__)rrrr rtszSession._setup_loadercCs |j ¡S)z¾ Get a list of available services that can be loaded as low-level clients via :py:meth:`Session.client`. :rtype: list :return: List of service names )rÚget_available_services)rrrr r2|szSession.get_available_servicescCs|jjddS)z¿ Get a list of available services that can be loaded as resource clients via :py:meth:`Session.resource`. :rtype: list :return: List of service names z resources-1)Z type_name)r+Zlist_available_services)rrrr Úget_available_resources†szSession.get_available_resourcescCs |j ¡S)zŠLists the available partitions :rtype: list :return: Returns a list of partition names (e.g., ["aws", "aws-cn"]) )rÚget_available_partitions)rrrr r4sz Session.get_available_partitionsÚawsFcCs|jj|||dS)aàLists the region and endpoint names of a particular partition. :type service_name: string :param service_name: Name of a service to list endpoint for (e.g., s3). :type partition_name: string :param partition_name: Name of the partition to limit endpoints to. (e.g., aws for the public AWS endpoints, aws-cn for AWS China endpoints, aws-us-gov for AWS GovCloud (US) Endpoints, etc.) :type allow_non_regional: bool :param allow_non_regional: Set to True to include endpoints that are not regional endpoints (e.g., s3-external-1, fips-us-gov-west-1, etc). :return: Returns a list of endpoint names (e.g., ["us-east-1"]). )Ú service_nameÚpartition_nameÚallow_non_regional)rÚget_available_regions)rr6r7r8rrr r9˜szSession.get_available_regionscCs |j ¡S)a# Return the :class:`botocore.credential.Credential` object associated with this session. If the credentials have not yet been loaded, this will attempt to load them. If they have already been loaded, this will return the cached credentials. )rÚget_credentials)rrrr r:¯szSession.get_credentialsTc Cs |jj||||||||| | d S)aá Create a low-level service client by name. :type service_name: string :param service_name: The name of a service, e.g. 's3' or 'ec2'. You can get a list of available services via :py:meth:`get_available_services`. :type region_name: string :param region_name: The name of the region associated with the client. A client is associated with a single region. :type api_version: string :param api_version: The API version to use. By default, botocore will use the latest API version when creating a client. You only need to specify this parameter if you want to use a previous API version of the client. :type use_ssl: boolean :param use_ssl: Whether or not to use SSL. By default, SSL is used. Note that not all services support non-ssl connections. :type verify: boolean/string :param verify: Whether or not to verify SSL certificates. By default SSL certificates are verified. You can provide the following values: * False - do not validate SSL certificates. SSL will still be used (unless use_ssl is False), but SSL certificates will not be verified. * path/to/cert/bundle.pem - A filename of the CA cert bundle to uses. You can specify this argument if you want to use a different CA cert bundle than the one used by botocore. :type endpoint_url: string :param endpoint_url: The complete URL to use for the constructed client. Normally, botocore will automatically construct the appropriate URL to use when communicating with a service. You can specify a complete URL (including the "http/https" scheme) to override this behavior. If this value is provided, then ``use_ssl`` is ignored. :type aws_access_key_id: string :param aws_access_key_id: The access key to use when creating the client. This is entirely optional, and if not provided, the credentials configured for the session will automatically be used. You only need to provide this argument if you want to override the credentials used for this specific client. :type aws_secret_access_key: string :param aws_secret_access_key: The secret key to use when creating the client. Same semantics as aws_access_key_id above. :type aws_session_token: string :param aws_session_token: The session token to use when creating the client. Same semantics as aws_access_key_id above. :type config: botocore.client.Config :param config: Advanced client configuration options. If region_name is specified in the client config, its value will take precedence over environment variables and configuration values, but not over a region_name value passed explicitly to the method. See `botocore config documentation `_ for more details. :return: Service client instance ) rÚ api_versionÚuse_sslÚverifyÚ endpoint_urlrrrÚconfig)rZ create_client) rr6rr;r<r=r>rrrr?rrr Úclient¹s IzSession.clientc  Cs,y|j |d|¡} Wnftk rH| ¡} || ¡k} t|| | ƒ‚Yn4tk rz|j |d¡}t||d  |¡ƒ‚YnX|dkr’|j  |d¡}| dk r¶| j dkrÀt   | ¡} d| _ n tdd} |j||||||||| | d }|jj}tjj||| dtj |j||¡d}|jj|| d |d }||d S) až Create a resource service client by name. :type service_name: string :param service_name: The name of a service, e.g. 's3' or 'ec2'. You can get a list of available services via :py:meth:`get_available_resources`. :type region_name: string :param region_name: The name of the region associated with the client. A client is associated with a single region. :type api_version: string :param api_version: The API version to use. By default, botocore will use the latest API version when creating a client. You only need to specify this parameter if you want to use a previous API version of the client. :type use_ssl: boolean :param use_ssl: Whether or not to use SSL. By default, SSL is used. Note that not all services support non-ssl connections. :type verify: boolean/string :param verify: Whether or not to verify SSL certificates. By default SSL certificates are verified. You can provide the following values: * False - do not validate SSL certificates. SSL will still be used (unless use_ssl is False), but SSL certificates will not be verified. * path/to/cert/bundle.pem - A filename of the CA cert bundle to uses. You can specify this argument if you want to use a different CA cert bundle than the one used by botocore. :type endpoint_url: string :param endpoint_url: The complete URL to use for the constructed client. Normally, botocore will automatically construct the appropriate URL to use when communicating with a service. You can specify a complete URL (including the "http/https" scheme) to override this behavior. If this value is provided, then ``use_ssl`` is ignored. :type aws_access_key_id: string :param aws_access_key_id: The access key to use when creating the client. This is entirely optional, and if not provided, the credentials configured for the session will automatically be used. You only need to provide this argument if you want to override the credentials used for this specific client. :type aws_secret_access_key: string :param aws_secret_access_key: The secret key to use when creating the client. Same semantics as aws_access_key_id above. :type aws_session_token: string :param aws_session_token: The session token to use when creating the client. Same semantics as aws_access_key_id above. :type config: botocore.client.Config :param config: Advanced client configuration options. If region_name is specified in the client config, its value will take precedence over environment variables and configuration values, but not over a region_name value passed explicitly to the method. If user_agent_extra is specified in the client config, it overrides the default user_agent_extra provided by the resource API. See `botocore config documentation `_ for more details. :return: Subclass of :py:class:`~boto3.resources.base.ServiceResource` z resources-1z, NÚResource)r) rr;r<r=r>rrrr?Ú resources)r6Ú service_modelZresource_json_definitionsZservice_waiter_modelZservice)Ú resource_nameZsingle_resource_json_definitionÚservice_context)r@)r+Zload_service_modelrr3r2rrZlist_api_versionsrr/Zdetermine_latest_versionrÚcopyÚdeepcopyrr@ÚmetarCrÚutilsZServiceContextZLazyLoadedWaiterModelrrZload_from_definition)rr6rr;r<r=r>rrrr?Zresource_modelÚ availableZhas_low_level_clientZavailable_api_versionsr@rCrEÚclsrrr Úresource sLJ      zSession.resourcecCsÂ|j dtj d¡¡|j dtj d¡¡|j dtj d¡¡|j dtj d¡¡|jjd tj d ¡d d |jjd tj d¡dd |j dtj d¡¡|j dtjjd|jd¡dS)Nzcreating-client-class.s3z*boto3.s3.inject.inject_s3_transfer_methodsz!creating-resource-class.s3.Bucketz%boto3.s3.inject.inject_bucket_methodsz!creating-resource-class.s3.Objectz%boto3.s3.inject.inject_object_methodsz(creating-resource-class.s3.ObjectSummaryz-boto3.s3.inject.inject_object_summary_methodsz creating-resource-class.dynamodbz6boto3.dynamodb.transform.register_high_level_interfacezhigh-level-dynamodb)Z unique_idz&creating-resource-class.dynamodb.Tablez+boto3.dynamodb.table.register_table_methodszhigh-level-dynamodb-tablez+creating-resource-class.ec2.ServiceResourcez'boto3.ec2.createtags.inject_create_tagsz$creating-resource-class.ec2.Instancez'boto3.ec2.deletetags.inject_delete_tags)r )rÚregisterrrIZ lazy_callr()rrrr ršsFz"Session._register_default_handlers)NNNNNN)r5F) NNTNNNNNN) NNTNNNNNN)r#Ú __module__Ú __qualname__Ú__doc__r!r&Úpropertyrrr(r)rr2r3r4r9r:r@rLrrrrr r s4 !         M r )rFr-Zbotocore.sessionrZbotocore.clientrZbotocore.exceptionsrrrZ boto3.utilsZboto3.exceptionsrrZresources.factoryrÚobjectr rrrr Ús