%PDF- %PDF-
| Direktori : /lib/python2.7/site-packages/salt/modules/ |
| Current File : //lib/python2.7/site-packages/salt/modules/boto_cloudfront.pyc |
�
���^c @@ s? d Z d d l m Z m Z m Z d d l Z d d l j j Z d d l m
Z
d d l Z y; d d l
Z
d d l Z e j d � j e j � e Z Wn e k
r� e Z n Xe j e � Z d � Z d d d d d d � Z d d d d d � Z d d d d d � Z d d d d d d
� Z d d d d d d � Z d S( u�
Connection module for Amazon CloudFront
.. versionadded:: 2018.3.0
:depends: boto3
:configuration: This module accepts explicit AWS credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles or
it can read them from the ~/.aws/credentials file or from these
environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY.
Dynamic credentials are then automatically obtained from AWS API and no
further configuration is necessary. More information available at:
.. code-block:: text
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/
iam-roles-for-amazon-ec2.html
http://boto3.readthedocs.io/en/latest/guide/
configuration.html#guide-configuration
If IAM roles are not used you need to specify them either in a pillar or
in the minion's config file:
.. code-block:: yaml
cloudfront.keyid: GKTADJGHEIQSXMKKRBJ08H
cloudfront.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
A region may also be specified in the configuration:
.. code-block:: yaml
cloudfront.region: us-east-1
If a region is not specified, the default is us-east-1.
It's also possible to specify key, keyid and region via a profile, either
as a passed in dict, or as a string to pull from pillars or minion config:
.. code-block:: yaml
myprofile:
keyid: GKTADJGHEIQSXMKKRBJ08H
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
region: us-east-1
i ( t absolute_importt print_functiont unicode_literalsN( t OrderedDictu boto3c C@ s6 t j j j � } | t k r2 t d t d � n | S( u-
Only load if boto3 libraries exist.
u boto3.assign_funcsu
cloudfront( t saltt utilst versionst check_boto_reqst Truet __utils__t __name__( t
has_boto_reqs( ( s@ /usr/lib/python2.7/site-packages/salt/modules/boto_cloudfront.pyt __virtual__L s c c@ s� x�| j d � j � D]v} | d } d | k r8 q n xQ| d D]E} | j d | d � } t d � | d d D� � } | d }
d | k r� t j d
|
� qC n | j d d � } | d k r� | | k r� qC n t d d | d
| d | d | d | �} | r| | f VqC n | j d |
� }
i |
d d 6|
d d 6| d 6} t d d | d | d
| d | d | d | �| | f VqC Wq Wd S( u�
Private function that returns an iterator over all CloudFront distributions.
The caller is responsible for all boto-related error handling.
name
(Optional) Only yield the distribution with the given name
u list_distributionsu DistributionListu Itemst Resourceu ARNc s@ s# | ] } | d | d f Vq d S( u Keyu ValueN( ( t .0t kv( ( s@ /usr/lib/python2.7/site-packages/salt/modules/boto_cloudfront.pys <genexpr>m s u Tagsu Idu Nameu+ CloudFront distribution %s has no Name tag.u
cloudfrontt sub_resourcet regiont keyt keyidt profilet Idu Distributionu distributionu ETagu etagu tagst resource_idN(
t
get_paginatort paginatet list_tags_for_resourcet dictt logt warningt popt Nonet _cache_idt get_distribution( t connt nameR R R R t dl_t distribution_listt partial_distt tagst id_t distribution_namet distributiont dist_with_etag( ( s@ /usr/lib/python2.7/site-packages/salt/modules/boto_cloudfront.pyt _list_distributionsV sN
c C@ s? t d d | d | d | d | d | �} | r; i | d 6St d | d | d | d | � } yk xd t | d | d | d | d | d | �D]8 \ } } | d
k r� d } i | j | � d
6S| } q� WWn+ t j j k
r� }
i t d |
� d
6SX| si d
d 6St d d | d | d | d | d | d | �i | d 6S( u
Get information about a CloudFront distribution (configuration, tags) with a given name.
name
Name of the CloudFront distribution
region
Region to connect to
key
Secret key to use
keyid
Access key to use
profile
A dict with region, key, and keyid,
or a pillar key (string) that contains such a dict.
CLI Example:
.. code-block:: bash
salt myminion boto_cloudfront.get_distribution name=mydistribution profile=awsprofile
u
cloudfrontR R R R R u resultR"