File: //lib/python3/dist-packages/awscli/customizations/codedeploy/__pycache__/register.cpython-310.pyc
o
.&�a � @ sT d dl Z d dlmZ d dlmZ d dlmZmZmZm Z m
Z
mZ G dd� de�ZdS )� N)�BasicCommand)�DEFAULT_CONFIG_FILE)�validate_region�validate_instance_name�
validate_tags�validate_iam_user_arn�INSTANCE_NAME_ARG�IAM_USER_ARN_ARGc @ s� e Zd ZdZdZdddddd�d ddd�d
�d�d�Zed
dddedd�egZdd� Z dd� Z
dd� Zdd� Zdd� Z
dd� Zdd � Zd!S )"�Register�registera Creates an IAM user for the on-premises instance, if not provided, and saves the user's credentials to an on-premises instance configuration file; registers the on-premises instance with AWS CodeDeploy; and optionally adds tags to the on-premises instance.�array�objectzThe tag key.�stringT)�description�type�requiredzThe tag value.)�Key�Value)r �
properties)r �items�tagsz--tags <value>F�+zFOptional. The list of key/value pairs to tag the on-premises instance.)�name�synopsisr �nargs�schema� help_textc
C s |}| j |_t||� t|� t|� t|� | j jd|j|j|j d�| _
| j jd|jd�| _z0|jsG| �
|� | �|� | �|� | �|� | �|� |jrT| �|� tj�d�t�� W d S ty� } ztj�� tj�d�|�� W Y d }~d S d }~ww )N�
codedeploy)�region_name�endpoint_url�verify�iam)r z�Copy the on-premises configuration file named {0} to the on-premises instance, and run the following command on the on-premises instance to install and configure the AWS CodeDeploy Agent:
aws deploy install --config-file {0}
z�ERROR
{0}
Register the on-premises instance by following the instructions in "Configure Existing On-Premises Instances by Using AWS CodeDeploy" in the AWS CodeDeploy User Guide.
)�_session�sessionr r r r �
create_client�regionr �
verify_sslr r! �iam_user_arn�_create_iam_user�_create_access_key�_create_user_policy�_create_config�_register_instancer � _add_tags�sys�stdout�write�formatr � Exception�flush�stderr)�self�parsed_args�parsed_globals�params�e� r: �K/usr/lib/python3/dist-packages/awscli/customizations/codedeploy/register.py� _run_mainD sN
��
�
�
���zRegister._run_mainc C sL t j�d� |j|_| jjd|jd�}|d d |_t j�d�|j�� d S )NzCreating the IAM user... z/AWS/CodeDeploy/)�Path�UserName�User�ArnzDONE
IamUserArn: {0}
) r. r/ r0 �
instance_name� user_namer! �create_userr'