File: //lib/python3/dist-packages/awscli/customizations/cloudformation/__pycache__/deploy.cpython-310.pyc
o
.&�a�7 � @ s� d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl m
Z
d dlmZ d dl
mZ d dlmZ d d lmZ e�e�ZG d
d� de�ZdS )� N)�Config)�
exceptions)�Deployer)�
S3Uploader)�
yaml_parse)�BasicCommand)�get_stdout_text_writer)�write_exceptionc @ s4 e Zd ZdZdZdZdZdZe� dd�Z
dd d
d�dd
d dd�dddd�dddd�ddd�ddd�ed
ddddid�g d d!�d"d
dddd#d$gd%�d�g d&d!�d'd(d)dd*d+�d,dd-d�d.ddddid�d/d0�d1ddd1d2d d3d4�d5dd(d1d2d d6d4�ed
ddddid�g d7d!�gZd8d9� Z dAd:d;�Z
d<d=� Zd>d?� Zd@S )B�
DeployCommandz�Changeset created successfully. Run the following command to review changes:
aws cloudformation describe-change-set --change-set-name {changeset_id}
z2Successfully created/updated stack - {stack_name}
zparameter-overrides�tags�deploy�cloudformationz_deploy_description.rstz
template-fileTz;The path where your AWS CloudFormation template is located.)�name�required� help_textz
stack-name�storez�The name of the AWS CloudFormation stack you're deploying to. If you specify an existing stack, the command updates the stack. If you specify a new stack, the command creates it.)r �actionr r z s3-bucketFz�The name of the S3 bucket where this command uploads your CloudFormation template. This is required the deployments of templates sized greater than 51,200 byteszforce-upload�
store_truez�Indicates whether to override existing files in the S3 bucket. Specify this flag to upload artifacts even if they match existing artifacts in the S3 bucket.)r r r z s3-prefixz�A prefix name that the command adds to the artifacts' name when it uploads them to the S3 bucket. The prefix name is a path name (folder name) for the S3 bucket.)r r z
kms-key-idzfThe ID of an AWS KMS key that the command uses to encrypt artifacts that are at rest in the S3 bucket.�array�type�string)r �itemsaU A list of parameter structures that specify input parameters for your stack template. If you're updating a stack and you don't specify a parameter, the command uses the stack's existing value. For new stacks, you must specify parameters that don't have a default value. Syntax: ParameterKey1=ParameterValue1 ParameterKey2=ParameterValue2 ...)r r r �schema�defaultr �capabilities�CAPABILITY_IAM�CAPABILITY_NAMED_IAM)r �enuma� A list of capabilities that you must specify before AWS Cloudformation can create certain stacks. Some stack templates might include resources that can affect permissions in your AWS account, for example, by creating new AWS Identity and Access Management (IAM) users. For those stacks, you must explicitly acknowledge their capabilities by specifying this parameter. The only valid values are CAPABILITY_IAM and CAPABILITY_NAMED_IAM. If you have IAM resources, you can specify either capability. If you have IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If you don't specify this parameter, this action returns an InsufficientCapabilities error.zno-execute-changeset�store_false�execute_changeseta1 Indicates whether to execute the change set. Specify this flag if you want to view your stack changes before executing the change set. The command creates an AWS CloudFormation change set and then exits without executing the change set. After you view the change set, execute it to implement your changes.)r r �destr r zrole-arnz�The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation assumes when executing the change set.znotification-arnszxAmazon Simple Notification Service topic Amazon Resource Names (ARNs) that AWS CloudFormation associates with the stack.)r r r r zfail-on-empty-changeset�fail_on_empty_changesetz�Specify if the CLI should return a non-zero exit code if there are no changes to be made to the stack. The default behavior is to return a non-zero exit code.)r r r �
group_namer r r zno-fail-on-empty-changesetz[Causes the CLI to return an exit code of 0 if there are no changes to be made to the stack.z�A list of tags to associate with the stack that is created or updated. AWS CloudFormation also propagates these tags to resources in the stack if the resource supports it. Syntax: TagKey1=TagValue1 TagKey2=TagValue2 ...c
C sN | j jd|j|j|jd�}|j}tj�|�st j
|d��t|d��}|�� }W d � n1 s0w Y |j
}| �|j| j�}| �|j| j�} dd� | �� D �}
t|�}| �||�}tj�|j�}
|
dkrm|jsmt �� �|j}|r�| j jdtd d
�|j|jd�}t|||j|j|j�}nd }t|�}| �|||||j |j!|j"|j#||
|j$�S )Nr
)�region_name�endpoint_url�verify)�
template_path�rc S s g | ] \}}||d ��qS ))�Key�Value� )�.0�key�valuer* r* �M/usr/lib/python3/dist-packages/awscli/customizations/cloudformation/deploy.py�
<listcomp> s �z+DeployCommand._run_main.<locals>.<listcomp>i � �s3�s3v4)�signature_version)�configr# r% )%�_session�
create_client�regionr$ �
verify_ssl�
template_file�os�path�isfiler �InvalidTemplatePathError�open�read�
stack_name�parse_key_value_arg�parameter_overrides�PARAMETER_OVERRIDE_CMDr �TAGS_CMDr r �merge_parameters�getsize� s3_bucket�DeployBucketRequiredErrorr r � s3_prefix�
kms_key_id�force_uploadr r r r �role_arn�notification_arnsr! )�self�parsed_args�parsed_globals�cloudformation_clientr&