%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/modules/ |
Current File : //lib/python2.7/site-packages/salt/modules/boto_elbv2.pyc |
� ���^c @@ sa d Z d d l m Z m Z m Z d d l Z e j e � Z d d l m Z d d l Z yK d d l Z d d l Z d d l m Z e j d � j e j � e Z Wn e k r� e Z n Xd � Z d d d d d 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 d � Z d d d d d � Z d d d d d � Z d S( u� Connection module for Amazon ALB .. versionadded:: 2017.7.0 :configuration: This module accepts explicit elb credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. 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 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 elbv2.keyid: GKTADJGHEIQSXMKKRBJ08H elbv2.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs elbv2.region: us-west-2 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 :depends: boto3 i ( t absolute_importt print_functiont unicode_literalsN( t six( t ClientErroru 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 elbv2( 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_elbv2.pyt __virtual__E s u HTTPu traffic-portu /i i i c C@ s t d | d | d | d | � } t | | | | | � r= t Sy� | j d | d | d | d | d | d | d | d | d | d | d | � } | r� t j d | | d d d � t St j d | � t SWnH t k r} t j d | | j d d | j d d d t j �n Xd S( u� Create target group if not present. name (string) - The name of the target group. protocol (string) - The protocol to use for routing traffic to the targets port (int) - The port on which the targets receive traffic. This port is used unless you specify a port override when registering the traffic. vpc_id (string) - The identifier of the virtual private cloud (VPC). health_check_protocol (string) - The protocol the load balancer uses when performing health check on targets. The default is the HTTP protocol. health_check_port (string) - The port the load balancer uses when performing health checks on targets. The default is 'traffic-port', which indicates the port on which each target receives traffic from the load balancer. health_check_path (string) - The ping path that is the destination on the targets for health checks. The default is /. health_check_interval_seconds (integer) - The approximate amount of time, in seconds, between health checks of an individual target. The default is 30 seconds. health_check_timeout_seconds (integer) - The amount of time, in seconds, during which no response from a target means a failed health check. The default is 5 seconds. healthy_threshold_count (integer) - The number of consecutive health checks successes required before considering an unhealthy target healthy. The default is 5. unhealthy_threshold_count (integer) - The number of consecutive health check failures required before considering a target unhealthy. The default is 2. returns (bool) - True on success, False on failure. CLI example: .. code-block:: bash salt myminion boto_elbv2.create_target_group learn1give1 protocol=HTTP port=54006 vpc_id=vpc-deadbeef t regiont keyt keyidt profilet Namet Protocolt Portt VpcIdt HealthCheckProtocolt HealthCheckPortt HealthCheckPatht HealthCheckIntervalSecondst HealthCheckTimeoutSecondst HealthyThresholdCountt UnhealthyThresholdCountu Created ALB %s: %su TargetGroupsi u TargetGroupArnu Failed to create ALB %su Failed to create ALB %s: %s: %su Erroru Codeu Messaget exc_info_on_loglevelN( t _get_connt target_group_existsR t create_target_groupt logt infot errort FalseR t responset loggingt DEBUG( t namet protocolt portt vpc_idR R R R t health_check_protocolt health_check_portt health_check_patht health_check_interval_secondst health_check_timeout_secondst healthy_threshold_countt unhealthy_threshold_countt connt albR# ( ( s; /usr/lib/python2.7/site-packages/salt/modules/boto_elbv2.pyR O s. ;! c C@ s t d | d | d | d | � } t | | | | | � s= t Sy� | j d � rr | j d | � t j d | � nd | j d | g � } t | d � d k r� t S| d d d } | j d | � t j d | | � t SWn- t k r } t j d | d t j �t SXd S( up Delete target group. name (string) - Target Group Name or Amazon Resource Name (ARN). returns (bool) - True on success, False on failure. CLI example: .. code-block:: bash salt myminion boto_elbv2.delete_target_group arn:aws:elasticloadbalancing:us-west-2:644138682826:targetgroup/learn1give1-api/414788a16b5cf163 R R R R u arn:aws:elasticloadbalancingt TargetGroupArnu Deleted target group %st Namesu TargetGroupsi i u TargetGroupArnu Deleted target group %s ARN %su Failed to delete target group %sR N( R R R t startswitht delete_target_groupR! R"