%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/states/azurearm_resource.pyo

�
���^c@@s�dZddlmZddlZddlZddlZdZeje	�Z
d�Zeeed�Z
ed�Zeeeeeeeeedeeeed	�Zed
�Zeeeeed�Zed�ZdS(
s�
Azure (ARM) Resource State Module

.. versionadded:: 2019.2.0

:maintainer: <devops@decisionlab.io>
:maturity: new
:depends:
    * `azure <https://pypi.python.org/pypi/azure>`_ >= 2.0.0
    * `azure-common <https://pypi.python.org/pypi/azure-common>`_ >= 1.1.8
    * `azure-mgmt <https://pypi.python.org/pypi/azure-mgmt>`_ >= 1.0.0
    * `azure-mgmt-compute <https://pypi.python.org/pypi/azure-mgmt-compute>`_ >= 1.0.0
    * `azure-mgmt-network <https://pypi.python.org/pypi/azure-mgmt-network>`_ >= 1.7.1
    * `azure-mgmt-resource <https://pypi.python.org/pypi/azure-mgmt-resource>`_ >= 1.1.0
    * `azure-mgmt-storage <https://pypi.python.org/pypi/azure-mgmt-storage>`_ >= 1.0.0
    * `azure-mgmt-web <https://pypi.python.org/pypi/azure-mgmt-web>`_ >= 0.32.0
    * `azure-storage <https://pypi.python.org/pypi/azure-storage>`_ >= 0.34.3
    * `msrestazure <https://pypi.python.org/pypi/msrestazure>`_ >= 0.4.21
:platform: linux

:configuration: This module requires Azure Resource Manager credentials to be passed as a dictionary of
    keyword arguments to the ``connection_auth`` parameter in order to work properly. Since the authentication
    parameters are sensitive, it's recommended to pass them to the states via pillar.

    Required provider parameters:

    if using username and password:
      * ``subscription_id``
      * ``username``
      * ``password``

    if using a service principal:
      * ``subscription_id``
      * ``tenant``
      * ``client_id``
      * ``secret``

    Optional provider parameters:

    **cloud_environment**: Used to point the cloud driver to different API endpoints, such as Azure GovCloud. Possible values:
      * ``AZURE_PUBLIC_CLOUD`` (default)
      * ``AZURE_CHINA_CLOUD``
      * ``AZURE_US_GOV_CLOUD``
      * ``AZURE_GERMAN_CLOUD``

    Example Pillar for Azure Resource Manager authentication:

    .. code-block:: yaml

        azurearm:
            user_pass_auth:
                subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
                username: fletch
                password: 123pass
            mysubscription:
                subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
                tenant: ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF
                client_id: ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF
                secret: XXXXXXXXXXXXXXXXXXXXXXXX
                cloud_environment: AZURE_PUBLIC_CLOUD

    Example states using Azure Resource Manager authentication:

    .. code-block:: jinja

        {% set profile = salt['pillar.get']('azurearm:mysubscription') %}
        Ensure resource group exists:
            azurearm_resource.resource_group_present:
                - name: my_rg
                - location: westus
                - tags:
                    how_awesome: very
                    contact_name: Elmer Fudd Gantry
                - connection_auth: {{ profile }}

        Ensure resource group is absent:
            azurearm_resource.resource_group_absent:
                - name: other_rg
                - connection_auth: {{ profile }}

i(tabsolute_importNtazurearm_resourcecC@sdtkrtStS(sV
    Only make this state available if the azurearm_resource module is available.
    s0azurearm_resource.resource_group_check_existence(t__salt__t__virtualname__tFalse(((sA/usr/lib/python2.7/site-packages/salt/states/azurearm_resource.pyt__virtual__asc
	K@s&i|d6td6dd6id6}t|t�s?d|d<|Si}td||�}|rtd||�}td	|jd
i�|p�i�|d<|ds�t|d<dj|�|d<|Stdrvd
j|�|d<d|d<i|jd
i�d6|d6|d<|Sn_tdrvdj|�|d<d|d<iid6i|d6|d6|d6|d
6d6|d<|S|j
�}	|	j|�td||d|d
||	�}td||�}|rt|d<dj|�|d<iid6|d6|d<|Sdj||jd��|d<|S(s
    .. versionadded:: 2019.2.0

    Ensure a resource group exists.

    :param name:
        Name of the resource group.

    :param location:
        The Azure location in which to create the resource group. This value cannot be updated once
        the resource group is created.

    :param managed_by:
        The ID of the resource that manages this resource group. This value cannot be updated once
        the resource group is created.

    :param tags:
        A dictionary of strings can be passed as tag metadata to the resource group object.

    :param connection_auth:
        A dict with subscription and authentication parameters to be used in connecting to the
        Azure Resource Manager API.

    Example usage:

    .. code-block:: yaml

        Ensure resource group exists:
            azurearm_resource.resource_group_present:
                - name: group1
                - location: eastus
                - tags:
                    contact_name: Elmer Fudd Gantry
                - connection_auth: {{ profile }}

    tnametresultttcommenttchangessHConnection information must be specified via connection_auth dictionary!s0azurearm_resource.resource_group_check_existences$azurearm_resource.resource_group_getsdictdiffer.deep_diffttagss&Resource group {0} is already present.ttests)Resource group {0} tags would be updated.toldtnews$Resource group {0} would be created.tlocationt
managed_bys1azurearm_resource.resource_group_create_or_updates$Resource group {0} has been created.s*Failed to create resource group {0}! ({1})terrorN(Rt
isinstancetdictRt	__utils__tgettTruetformatt__opts__tNonetcopytupdate(
RRRRtconnection_authtkwargstrettgrouptpresenttgroup_kwargs((sA/usr/lib/python2.7/site-packages/salt/states/azurearm_resource.pytresource_group_presenthsj%

)






	
cC@ssi|d6td6dd6id6}t|t�s?d|d<|Si}td||�}|st|d<dj|�|d<|Std	r�td
||�}dj|�|d<d|d<i|d6id
6|d<|Std
||�}td||�}|r
t}ntd||�}|s\t|d<dj|�|d<i|d6id
6|d<|Sdj|�|d<|S(sC
    .. versionadded:: 2019.2.0

    Ensure a resource group does not exist in the current subscription.

    :param name:
        Name of the resource group.

    :param connection_auth:
        A dict with subscription and authentication parameters to be used in connecting to the
        Azure Resource Manager API.
    RRRR	R
sHConnection information must be specified via connection_auth dictionary!s0azurearm_resource.resource_group_check_existences%Resource group {0} is already absent.Rs$azurearm_resource.resource_group_gets$Resource group {0} would be deleted.R
Rs'azurearm_resource.resource_group_deletes$Resource group {0} has been deleted.s$Failed to delete resource group {0}!N(RRRRRRRR(RRRRR tdeleted((sA/usr/lib/python2.7/site-packages/salt/states/azurearm_resource.pytresource_group_absent�sH





	
tjinjac$K@si|d6td6dd6id6}t|t�s?d|d<|S|rb|rb|	rbd|d<|Std�|||	gD��d	kr�d
|d<|S|s�|	r�|s�|s�|s�|s�|s�|r�d|d<|Si}|rytj|�}Wq3tk
r}dj|�|d<|SXn|	r3yDtd
d|
|	||dddt
ddd|
|�\}}}Wn*tk
r�}dj|	|�|d<|SX|s�dj|	�|d<|Sy4tjj
j|d��}tj|�}WdQXWn*tk
r}dj|	|�|d<|SX|r3tjj
j|�q3n|}|sE|	r&|jd�rf|jd�}n|jdi�jd�}|jdi�jd�}|jdi�jd�}|jdi�jd�}|jdi�jd�}|jdi�jd�}|jdi�jd�}ntd|dd|�}d|kr�|r�|j�|jd d�j�kr�i|jd �d!6|d"6|dd <n|p�dj�|jdd�j�kr�i|jd�d!6|d"6|dd<n|p�dj�|jd#d�j�krAi|jd#�d!6|d"6|dd#<n|pJdj�|jdd�j�kr�i|jd�d!6|d"6|dd<ntd$|jd%i�|p�i�}|r�||dd%<ntd$|jdi�|p�i�}|r||dd<ntd$|jdi�|p*i�}|rG||dd<n|dsrt|d<d&j|�|d<|Std'r�d(j|�|d<d|d<|SnPiid!6i|d6|d 6|d6|d#6|d6|d6|d6|d%6d"6|d<td'rd)j|�|d<d|d<|St|t�rEtjtj|��}nt|t�rotjtj|��}n|j�}|j|�td*d|d%|d |d|d#|d|d|d||�}d|kr�t|d<d+j|�|d<|Sd,j||jd��|d<|S(-s�
    .. versionadded:: 2019.2.0

    Ensure a security policy definition exists.

    :param name:
        Name of the policy definition.

    :param policy_rule:
        A YAML dictionary defining the policy rule. See `Azure Policy Definition documentation
        <https://docs.microsoft.com/en-us/azure/azure-policy/policy-definition#policy-rule>`_ for details on the
        structure. One of ``policy_rule``, ``policy_rule_json``, or ``policy_rule_file`` is required, in that order of
        precedence for use if multiple parameters are used.

    :param policy_rule_json:
        A text field defining the entirety of a policy definition in JSON. See `Azure Policy Definition documentation
        <https://docs.microsoft.com/en-us/azure/azure-policy/policy-definition#policy-rule>`_ for details on the
        structure. One of ``policy_rule``, ``policy_rule_json``, or ``policy_rule_file`` is required, in that order of
        precedence for use if multiple parameters are used. Note that the `name` field in the JSON will override the
        ``name`` parameter in the state.

    :param policy_rule_file:
        The source of a JSON file defining the entirety of a policy definition. See `Azure Policy Definition
        documentation <https://docs.microsoft.com/en-us/azure/azure-policy/policy-definition#policy-rule>`_ for
        details on the structure. One of ``policy_rule``, ``policy_rule_json``, or ``policy_rule_file`` is required,
        in that order of precedence for use if multiple parameters are used. Note that the `name` field in the JSON
        will override the ``name`` parameter in the state.

    :param skip_verify:
        Used for the ``policy_rule_file`` parameter. If ``True``, hash verification of remote file sources
        (``http://``, ``https://``, ``ftp://``) will be skipped, and the ``source_hash`` argument will be ignored.

    :param source_hash:
        This can be a source hash string or the URI of a file that contains source hash strings.

    :param source_hash_name:
        When ``source_hash`` refers to a hash file, Salt will try to find the correct hash by matching the
        filename/URI associated with that hash.

    :param policy_type:
        The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Only used with the
        ``policy_rule`` parameter.

    :param mode:
        The policy definition mode. Possible values are NotSpecified, Indexed, and All. Only used with the
        ``policy_rule`` parameter.

    :param display_name:
        The display name of the policy definition. Only used with the ``policy_rule`` parameter.

    :param description:
        The policy definition description. Only used with the ``policy_rule`` parameter.

    :param metadata:
        The policy definition metadata defined as a dictionary. Only used with the ``policy_rule`` parameter.

    :param parameters:
        Required dictionary if a parameter is used in the policy rule. Only used with the ``policy_rule`` parameter.

    :param connection_auth:
        A dict with subscription and authentication parameters to be used in connecting to the
        Azure Resource Manager API.

    Example usage:

    .. code-block:: yaml

        Ensure policy definition exists:
            azurearm_resource.policy_definition_present:
                - name: testpolicy
                - display_name: Test Policy
                - description: Test policy for testing policies.
                - policy_rule:
                    if:
                      allOf:
                        - equals: Microsoft.Compute/virtualMachines/write
                          source: action
                        - field: location
                          in:
                            - eastus
                            - eastus2
                            - centralus
                    then:
                      effect: deny
                - connection_auth: {{ profile }}

    RRRR	R
sHConnection information must be specified via connection_auth dictionary!sLOne of "policy_rule", "policy_rule_json", or "policy_rule_file" is required!cs@s|]}|dk	VqdS(N(R(t.0tx((sA/usr/lib/python2.7/site-packages/salt/states/azurearm_resource.pys	<genexpr>�sisPOnly one of "policy_rule", "policy_rule_json", or "policy_rule_file" is allowed!s]Policy definitions cannot be passed when "policy_rule_json" or "policy_rule_file" is defined!s&Unable to load policy rule json! ({0})sfile.get_managedtskip_verifys.Unable to locate policy rule file "{0}"! ({1})s)Unable to locate policy rule file "{0}"!)trNs,Unable to load policy rule file "{0}"! ({1})t
propertiest
policyRulet
policyTypetmodetdisplayNametdescriptiontmetadatat
parameterss'azurearm_resource.policy_definition_gettazurearm_log_leveltinfoRtpolicy_typeR
Rtdisplay_namesdictdiffer.deep_difftpolicy_rules)Policy definition {0} is already present.Rs'Policy definition {0} would be updated.s'Policy definition {0} would be created.s4azurearm_resource.policy_definition_create_or_updates'Policy definition {0} has been created.s-Failed to create policy definition {0}! ({1})(RRRtsumtjsontloadst	ExceptionRRRt__env__tsalttutilstfilestfopentloadtremoveRtlowerRRRtdumpsRR(RR6R4R-R5R/R0R1tpolicy_rule_jsontpolicy_rule_filettemplatetsource_hashtsource_hash_nameR(RRRt	temp_ruletexctsfnt
source_sumtcomment_tprftpolicy_nametpolicytrule_changestmeta_changest
param_changest
policy_kwargs((sA/usr/lib/python2.7/site-packages/salt/states/azurearm_resource.pytpolicy_definition_presents[


%
$
****%%%







	
cC@s1i|d6td6dd6id6}t|t�s?d|d<|Std|dd	|�}d
|kr�t|d<dj|�|d<|Stdr�d
j|�|d<d|d<i|d6id6|d<|Std||�}|rt|d<dj|�|d<i|d6id6|d<|Sdj|�|d<|S(sI
    .. versionadded:: 2019.2.0

    Ensure a policy definition does not exist in the current subscription.

    :param name:
        Name of the policy definition.

    :param connection_auth:
        A dict with subscription and authentication parameters to be used in connecting to the
        Azure Resource Manager API.
    RRRR	R
sHConnection information must be specified via connection_auth dictionary!s'azurearm_resource.policy_definition_getR2R3Rs(Policy definition {0} is already absent.Rs'Policy definition {0} would be deleted.R
Rs*azurearm_resource.policy_definition_deletes'Policy definition {0} has been deleted.s'Failed to delete policy definition {0}!N(RRRRRRRR(RRRRPR#((sA/usr/lib/python2.7/site-packages/salt/states/azurearm_resource.pytpolicy_definition_absent#s<






cK@s�i|d6td6dd6id6}	t|t�s?d|	d<|	Std||dd	|�}
d
|
kr|r�|j�|
jdd�j�kr�i|
jd�d6|d
6|	dd<n|j�|
dj�kr�i|
dd6|d
6|	dd<n|
djd�d}|j�|j�krFi|d6|d
6|	dd<n|pOdj�|
jdd�j�kr�i|
jd�d6|d
6|	dd<n|p�dj�|
jdd�j�kr�i|
jd�d6|d
6|	dd<ntd|
jdi�|p	i�}|r&||	dd<n|	dsQt|	d<dj	|�|	d<|	St
dr�dj	|�|	d<d|	d<|	SnIiid6i|d6|d6|d6|d6|d6|d6|d6d
6|	d<t
dr�dj	|�|	d<d|	d<|	St|t�rtj
tj|��}n|j�}
|
j|�tdd|d|d|d|d|d|d||
�}
d
|
kr�t|	d<dj	|�|	d<|	Sdj	||
jd
��|	d<|	S(s�
    .. versionadded:: 2019.2.0

    Ensure a security policy assignment exists.

    :param name:
        Name of the policy assignment.

    :param scope:
        The scope of the policy assignment.

    :param definition_name:
        The name of the policy definition to assign.

    :param display_name:
        The display name of the policy assignment.

    :param description:
        The policy assignment description.

    :param assignment_type:
        The type of policy assignment.

    :param parameters:
        Required dictionary if a parameter is used in the policy rule.

    :param connection_auth:
        A dict with subscription and authentication parameters to be used in connecting to the
        Azure Resource Manager API.

    Example usage:

    .. code-block:: yaml

        Ensure policy assignment exists:
            azurearm_resource.policy_assignment_present:
                - name: testassign
                - scope: /subscriptions/bc75htn-a0fhsi-349b-56gh-4fghti-f84852
                - definition_name: testpolicy
                - display_name: Test Assignment
                - description: Test assignment for testing assignments.
                - connection_auth: {{ profile }}

    RRRR	R
sHConnection information must be specified via connection_auth dictionary!s'azurearm_resource.policy_assignment_getR2R3RttypeR
Rtscopetpolicy_definition_idt/i����tdefinition_nameR5R/sdictdiffer.deep_diffR1s)Policy assignment {0} is already present.Rs'Policy assignment {0} would be updated.s'Policy assignment {0} would be created.s*azurearm_resource.policy_assignment_creates'Policy assignment {0} has been created.s-Failed to create policy assignment {0}! ({1})N(RRRRRBRtsplitRRRRRR8R9RCRR(RRXR[R5R/tassignment_typeR1RRRRPtpa_nameRSRT((sA/usr/lib/python2.7/site-packages/salt/states/azurearm_resource.pytpolicy_assignment_presentZs�.

	***%







	
cC@s7i|d6td6dd6id6}t|t�s?d|d<|Std||dd	|�}d
|kr�t|d<dj|�|d<|Stdr�d
j|�|d<d|d<i|d6id6|d<|Std|||�}|r t|d<dj|�|d<i|d6id6|d<|Sdj|�|d<|S(sz
    .. versionadded:: 2019.2.0

    Ensure a policy assignment does not exist in the provided scope.

    :param name:
        Name of the policy assignment.

    :param scope:
        The scope of the policy assignment.

    connection_auth
        A dict with subscription and authentication parameters to be used in connecting to the
        Azure Resource Manager API.
    RRRR	R
sHConnection information must be specified via connection_auth dictionary!s'azurearm_resource.policy_assignment_getR2R3Rs(Policy assignment {0} is already absent.Rs'Policy assignment {0} would be deleted.R
Rs*azurearm_resource.policy_assignment_deletes'Policy assignment {0} has been deleted.s'Failed to delete policy assignment {0}!N(RRRRRRRR(RRXRRRPR#((sA/usr/lib/python2.7/site-packages/salt/states/azurearm_resource.pytpolicy_assignment_absent�sD

	



(t__doc__t
__future__RR8tloggingtsalt.utils.filesR<Rt	getLoggert__name__tlogRRR"R$RRURVR_R`(((sA/usr/lib/python2.7/site-packages/salt/states/azurearm_resource.pyt<module>Rs$	mA�7	�

Zerion Mini Shell 1.0