o
    i*                  	   @   s>   d dl mZmZmZmZmZmZ G dd deeeeeeZdS )    )GetableAPIResourceCreateableAPIResourceDeletableAPIResourceUpdatableAPIResourceUpdatableAPISubResourceListableAPISubResourcec                       s|   e Zd ZdZdZdZe fddZe fddZe fdd	Z	e fd
dZ
e fddZe fddZ  ZS )AwsIntegrationz/
    A wrapper around AWS Integration API.
    integrationawsc                       t t| jdd| ji|S )z
        List all Datadog-AWS integrations available in your Datadog organization.

        >>> api.AwsIntegration.list()
        idN )superr   get_resource_idclsparams	__class__r   O/home/ubuntu/.local/lib/python3.10/site-packages/datadog/api/aws_integration.pylist   s   zAwsIntegration.listc                    r   )a
  
        Add a new AWS integration config.

        :param account_id: Your AWS Account ID without dashes.         Consult the Datadog AWS integration to learn more about         your AWS account ID.
        :type account_id: string

        :param access_key_id: If your AWS account is a GovCloud         or China account, enter the corresponding Access Key ID.
        :type access_key_id: string

        :param role_name: Your Datadog role delegation name.         For more information about you AWS account Role name,         see the Datadog AWS integration configuration info.
        :type role_name: string

        :param filter_tags: The array of EC2 tags (in the form key:value)         defines a filter that Datadog uses when collecting metrics from EC2.         Wildcards, such as ? (for single characters) and * (for multiple characters)         can also be used. Only hosts that match one of the defined tags will be imported         into Datadog. The rest will be ignored. Host matching a given tag can also be         excluded by adding ! before the tag. e.x.         env:production,instance-type:c1.*,!region:us-east-1 For more information         on EC2 tagging, see the AWS tagging documentation.
        :type filter_tags: list of strings

        :param host_tags: Array of tags (in the form key:value) to add to all hosts and         metrics reporting through this integration.
        :type host_tags: list of strings

        :param account_specific_namespace_rules: An object (in the form         {"namespace1":true/false, "namespace2":true/false}) that enables         or disables metric collection for specific AWS namespaces for this         AWS account only. A list of namespaces can be found at the         /v1/integration/aws/available_namespace_rules endpoint.
        :type account_specific_namespace_rules: dictionary

        :param excluded_regions: An array of AWS regions to exclude         from metrics collection.
        :type excluded_regions: list of strings

        :returns: Dictionary representing the API's JSON response

        >>> account_id = "<AWS_ACCOUNT_ID>"
        >>> access_key_id = "<AWS_ACCESS_KEY_ID>"
        >>> role_name = "DatadogAwsRole"
        >>> filter_tags = ["<KEY>:<VALUE>"]
        >>> host_tags = ["<KEY>:<VALUE>"]
        >>> account_specific_namespace_rules = {"namespace1":true/false, "namespace2":true/false}
        >>> excluded_regions = ["us-east-1", "us-west-1"]

        >>> api.AwsIntegration.create(account_id=account_id, role_name=role_name,         filter_tags=filter_tags,host_tags=host_tags,        account_specific_namespace_rules=account_specific_namespace_rules         excluded_regions=excluded_regions)
        r   Nr   )r   r   creater   r   r   r   r   r   &   s   ;zAwsIntegration.createc                    s   i }| dr2| dr2|d|d< |d|d< | dr&|d|d< | dr2|d|d< | drb| drb|d|d< |d|d< | drV|d|d< | drb|d|d< tt| jd| j|d	|S )a  
        Update an AWS integration config.

        :param account_id: Your existing AWS Account ID without dashes.         Consult the Datadog AWS integration to learn more about         your AWS account ID.
        :type account_id: string

        :param new_account_id: Your new AWS Account ID without dashes.         Consult the Datadog AWS integration to learn more about         your AWS account ID. This is the account to be updated.
        :type new_account_id: string

        :param role_name: Your existing Datadog role delegation name.         For more information about you AWS account Role name,         see the Datadog AWS integration configuration info.
        :type role_name: string

        :param new_role_name: Your new Datadog role delegation name.         For more information about you AWS account Role name,         see the Datadog AWS integration configuration info.         This is the role_name to be updated.
        :type new_role_name: string

        :param access_key_id: If your AWS account is a GovCloud         or China account, enter the existing Access Key ID.
        :type access_key_id: string

        :param new_access_key_id: If your AWS account is a GovCloud         or China account, enter the new Access Key ID to be set.
        :type new_access_key_id: string

        :param secret_access_key: If your AWS account is a GovCloud         or China account, enter the existing Secret Access Key.
        :type secret_access_key: string

        :param new_secret_access_key: If your AWS account is a GovCloud         or China account, enter the new key to be set.
        :type new_secret_access_key: string

        :param filter_tags: The array of EC2 tags (in the form key:value)         defines a filter that Datadog uses when collecting metrics from EC2.         Wildcards, such as ? (for single characters) and * (for multiple characters)         can also be used. Only hosts that match one of the defined tags will be imported         into Datadog. The rest will be ignored. Host matching a given tag can also be         excluded by adding ! before the tag. e.x.         env:production,instance-type:c1.*,!region:us-east-1 For more information         on EC2 tagging, see the AWS tagging documentation.
        :type filter_tags: list of strings

        :param host_tags: Array of tags (in the form key:value) to add to all hosts and         metrics reporting through this integration.
        :type host_tags: list of strings

        :param account_specific_namespace_rules: An object (in the form         {"namespace1":true/false, "namespace2":true/false}) that enables         or disables metric collection for specific AWS namespaces for this         AWS account only. A list of namespaces can be found at the         /v1/integration/aws/available_namespace_rules endpoint.
        :type account_specific_namespace_rules: dictionary

        :param excluded_regions: An array of AWS regions to exclude         from metrics collection.
        :type excluded_regions: list of strings

        :returns: Dictionary representing the API's JSON response

        The following will depend on whether role delegation or access keys are being used.
        If using role delegation, use the fields for role_name and account_id.
        For access keys, use fields for access_key_id and secret_access_key.

        Both the existing fields and new fields are required no matter what. i.e. If the config is         account_id/role_name based, then `account_id`, `role_name`, `new_account_id`, and         `new_role_name` are all required.

        For access_key based accounts, `access_key_id`, `secret_access_key`, `new_access_key_id`,         and `new_secret_access_key` are all required.

        >>> account_id = "<EXISTING_AWS_ACCOUNT_ID>"
        >>> role_name = "<EXISTING_AWS_ROLE_NAME>"
        >>> access_key_id = "<EXISTING_AWS_ACCESS_KEY_ID>"
        >>> secret_access_key = "<EXISTING_AWS_SECRET_ACCESS_KEY>"
        >>> new_account_id = "<NEW_AWS_ACCOUNT_ID>"
        >>> new_role_name = "<NEW_AWS_ROLE_NAME>"
        >>> new_access_key_id = "<NEW_AWS_ACCESS_KEY_ID>"
        >>> new_secret_access_key = "<NEW_AWS_SECRET_ACCESS_KEY_ID>"
        >>> filter_tags = ["<KEY>:<VALUE>"]
        >>> host_tags = ["<KEY>:<VALUE>"]
        >>> account_specific_namespace_rules = {"namespace1":true/false, "namespace2":true/false}
        >>> excluded_regions = ["us-east-1", "us-west-1"]

        >>> api.AwsIntegration.update(account_id=account_id, role_name=role_name,         new_account_id=new_account_id, new_role_name=new_role_name,         filter_tags=filter_tags,host_tags=host_tags,        account_specific_namespace_rules=account_specific_namespace_rules,         excluded_regions=excluded_regions)
        
account_id	role_namenew_account_idnew_role_nameaccess_key_idsecret_access_keynew_access_key_idnew_secret_access_key)r   r   Nr   )r   popr   r   updater   )r   bodyr   r   r   r   r"   c   s    c



zAwsIntegration.updatec                    s   t t| j| j|dS )z
        Delete a given Datadog-AWS integration.

        >>> account_id = "<AWS_ACCOUNT_ID>"
        >>> role_name = "<Datadog Integration Role Name>"

        >>> api.AwsIntegration.delete()
        )r   r#   )r   r   deleter   )r   r#   r   r   r   r$      s   
zAwsIntegration.deletec                    "   d| _ tt| jdd| ji|S )zw
        List all namespace rules available as options.

        >>> api.AwsIntegration.list_namespace_rules()
        available_namespace_rulesr   Nr   )_sub_resource_namer   r   	get_itemsr   r   r   r   r   list_namespace_rules   s   z#AwsIntegration.list_namespace_rulesc                    r%   )a  
        Generate a new AWS external id for a given AWS account id and role name pair.

        >>> account_id = "<AWS_ACCOUNT_ID>"
        >>> role_name = "<Datadog Integration Role Name>"

        >>> api.AwsIntegration.generate_new_external_id()
        generate_new_external_idr   Nr   )r'   r   r   update_itemsr   r   r   r   r   r*      s   
z'AwsIntegration.generate_new_external_id)__name__
__module____qualname____doc___resource_namer   classmethodr   r   r"   r$   r)   r*   __classcell__r   r   r   r   r      s     <s	r   N)datadog.api.resourcesr   r   r   r   r   r   r   r   r   r   r   <module>   s    

