%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/modules/ |
Current File : //usr/lib/python2.7/site-packages/salt/modules/boto_efs.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l m Z y d d l Z e Z Wn e k rm e Z n Xd d l Z e j e � Z d � Z d d d d d � Z d d d d d d d � Z d d d d d d d � Z d d d d d � Z d d d d d � Z d d d d d � Z d d d d d � Z d d d d d d d � Z d d d d d d d � Z d d d d d � Z d d d d d � Z d S( u� Connection module for Amazon EFS .. versionadded:: 2017.7.0 :configuration: This module accepts explicit EFS 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/efs/latest/ug/ access-control-managing-permissions.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 efs.keyid: GKTADJGHEIQSXMKKRBJ08H efs.key: askd+ghsdfjkghWupU/asdflkdfklgjsdfjajkghs A region may also be specified in the configuration .. code-block:: yaml efs.region: us-east-1 If a region is not specified, the default is us-east-1. It's also possible to speficy 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: askd+ghsdfjkghWupU/asdflkdfklgjsdfjajkghs region: us-east-1 :depends: boto3 i ( t absolute_importt print_functiont unicode_literalsN( t sixc C@ s t j j j d d d t � S( ui Only load if boto3 libraries exist and if boto3 libraries are greater than a given version. t boto3_veru 1.0.0t check_boto( t saltt utilst versionst check_boto_reqst False( ( ( s9 /usr/lib/python2.7/site-packages/salt/modules/boto_efs.pyt __virtual__G s c K@ sh d } | rV t | t j � r� | t k r7 t | } qS | t k rS t | } qS q� nT | sh | sh | r� i } | r� | | d <n | r� | | d <n | r� | | d <q� n t | t � rUd | k r� | d | d <| j d d � n d | k r| d | d <| j d d � n d | k r@| d | d <| j d d � n t j d | � } n t j d � } | S( u1 Create a boto3 client connection to EFS u keyu keyidu regionu region_nameu aws_secret_access_keyu aws_access_key_idu efsN( t Nonet isinstanceR t string_typest __pillar__t __opts__t dictt popt boto3t client( t keyt keyidt profilet regiont kwargsR ( ( s9 /usr/lib/python2.7/site-packages/salt/modules/boto_efs.pyt _get_connR s8 u generalPurposec K@ s� | d k r | } n i d d 6| d 6} t d | d | d | d | � } | j d | d | � } d | k r� | j d | d d | � n d | k r� | | d <n | S( u_ Creates a new, empty file system. name (string) - The name for the new file system performance_mode (string) - The PerformanceMode of the file system. Can be either generalPurpose or maxIO creation_token (string) - A unique name to be used as reference when creating an EFS. This will ensure idempotency. Set to name if not specified otherwise returns (dict) - A dict of the data for the elastic file system CLI Example: .. code-block:: bash salt 'my-minion' boto_efs.create_file_system efs-name generalPurpose u Nameu Keyu ValueR R R R t CreationTokent PerformanceModeu FileSystemIdt FileSystemIdt TagsN( R R t create_file_systemt create_tags( t namet performance_modeR R R R t creation_tokenR t tagsR t response( ( s9 /usr/lib/python2.7/site-packages/salt/modules/boto_efs.pyR | s ! c K@ s� t d | d | d | d | � } | d k rO | d k rO | j d | d | � S| d k rw | j d | d | d | � S| d k r� | j d | d | d | � S| j d | d | d | d | � S( u� Creates a mount target for a file system. You can then mount the file system on EC2 instances via the mount target. You can create one mount target in each Availability Zone in your VPC. All EC2 instances in a VPC within a given Availability Zone share a single mount target for a given file system. If you have multiple subnets in an Availability Zone, you create a mount target in one of the subnets. EC2 instances do not need to be in the same subnet as the mount target in order to access their file system. filesystemid (string) - ID of the file system for which to create the mount target. subnetid (string) - ID of the subnet to add the mount target in. ipaddress (string) - Valid IPv4 address within the address range of the specified subnet. securitygroups (list[string]) - Up to five VPC security group IDs, of the form sg-xxxxxxxx. These must be for the same VPC as subnet specified. returns (dict) - A dict of the response data CLI Example: .. code-block:: bash salt 'my-minion' boto_efs.create_mount_target filesystemid subnetid R R R R R t SubnetIdt SecurityGroupst IpAddressN( R R t create_mount_target( t filesystemidt subnetidt ipaddresst securitygroupsR R R R R R ( ( s9 /usr/lib/python2.7/site-packages/salt/modules/boto_efs.pyR) � s /!c K@ s| t d | d | d | d | � } g } x8 t j | � D]'