File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_rds.cpython-310.pyc
o
�N�g�� �
@ sb d Z ddlZddlZddlZddlm mZ ddlZddl m
Z
e�e�Z
z$ddlZddlZddlmZ e�d��ej� e�d��ej� dZW n eyU dZY nw i d d
ef�ddef�d
def�ddef�ddef�ddef�ddef�ddef�ddef�ddef�ddef�dd ef�d!d"ef�d#d$ef�d%d&ef�d'd(ef�d)d*ef�i d+d,ef�d-d.ef�d/d0ef�d1d2ef�d3d4ef�d5d6ef�d7d8ef�d9d:ef�d;d<ef�d=d>ef�d?d@ef�dAdBef�dCdDef�dEdFef�dGdHef�dIdJef�dKdLef��dMefdNefdOefdPefdQefdRefdSefdTefdU��ZdVdW� ZdXdY� Zd�dZd[�Z d�d\d]�Z d�d^d_�Z d�d`da�Z d�dbdc�Z! d�ddde�Z" d�dfdg�Z# d�dhdi�Z$ d�djdk�Z% l d�dmdn�Z&d�dodp�Z' q d�drds�Z( t d�dudv�Z)d�dwdx�Z* yd�dzd{�Z+d�d|d}�Z,d�d~d�Z-d�d�d��Z. d�d�d��Z/ d�d�d��Z0 d�d�d��Z1d�d�� Z2dS )�a�
Connection module for Amazon RDS
.. versionadded:: 2015.8.0
:configuration: This module accepts explicit rds 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
rds.keyid: GKTADJGHEIQSXMKKRBJ08H
rds.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
A region may also be specified in the configuration:
.. code-block:: yaml
rds.region: us-east-1
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
� N)�SaltInvocationError)�ClientError�boto�boto3TF�allocated_storage�AllocatedStorage�allow_major_version_upgradeZAllowMajorVersionUpgrade�apply_immediatelyZApplyImmediately�auto_minor_version_upgrade�AutoMinorVersionUpgrade�availability_zone�AvailabilityZone�backup_retention_period�BackupRetentionPeriod�ca_certificate_identifier�CACertificateIdentifier�character_set_name�CharacterSetName�copy_tags_to_snapshot�CopyTagsToSnapshot�db_cluster_identifier�DBClusterIdentifier�db_instance_class�DBInstanceClass�db_name�DBName�db_parameter_group_name�DBParameterGroupName�db_port_numberZDBPortNumber�db_security_groupsZDBSecurityGroups�db_subnet_group_name�DBSubnetGroupName�domainZDomain�domain_iam_role_nameZDomainIAMRoleName�engine�Engine�engine_version�
EngineVersion�iops�Iops�
kms_key_id�KmsKeyId�
license_model�LicenseModel�master_user_passwordZMasterUserPassword�master_usernameZMasterUsername�monitoring_interval�MonitoringInterval�monitoring_role_arn�MonitoringRoleArn�multi_azZMultiAZ�name�DBInstanceIdentifier�new_db_instance_identifierZNewDBInstanceIdentifier�option_group_name�OptionGroupName�port�Port�preferred_backup_window�PreferredBackupWindow�preferred_maintenance_window�PreferredMaintenanceWindow�
PromotionTier�PubliclyAccessible�StorageEncrypted�StorageType�Tags�TdeCredentialArnZTdeCredentialPasswordZVpcSecurityGroupIds)�promotion_tier�publicly_accessible�storage_encrypted�storage_type�tags�tde_credential_arn�tde_credential_password�vpc_security_group_idsc C s t jjjdd�S )zg
Only load if boto libraries exist and if boto libraries are greater than
a given version.
z1.3.1)Z boto3_ver)�salt�utilsZversionsZcheck_boto_reqs� rP rP �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_rds.py�__virtual__{ s rR c C s t rtd td� d S d S )Nzboto3.assign_funcs�rds)�HAS_BOTO� __utils__�__name__)�optsrP rP rQ �__init__� s �rX c
C �` t ||||d�}z
|j| d�}dt|�iW S ty/ } zdtd |�iW Y d}~S d}~ww )z�
Check to see if an RDS exists.
CLI Example:
.. code-block:: bash
salt myminion boto_rds.exists myrds region=us-east-1
��region�key�keyid�profile�r6 �exists�error�boto3.get_errorN)� _get_conn�describe_db_instances�boolr rU � r5 rJ r[ r\ r] r^ �connrS �erP rP rQ r` � s
��r` c
C rY )z�
Check to see if an RDS option group exists.
CLI Example:
.. code-block:: bash
salt myminion boto_rds.option_group_exists myoptiongr region=us-east-1
rZ �r9 r` ra rb N)rc Zdescribe_option_groupsre r rU rf rP rP rQ �option_group_exists� s ��rj c
C s� t ||||d�}z|j| d�}t|�dd�W S tyA } zi } |jd d dkr-d| d <