HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/awscli/customizations/configure/__pycache__/addmodel.cpython-36.pyc
3

�T_�@sVddlZddlZddlmZddlmZdd�Zdd�Zddd	�ZGd
d�de�Z	dS)
�N)�ServiceModel)�BasicCommandcCs.i}x$|j�D]}|j|�}|||j<qW|S)N)�get_available_servicesZget_service_model�endpoint_prefix)�sessionZprefixes_to_services�service_name�
service_model�r	�/usr/lib/python3.6/addmodel.py�%_get_endpoint_prefix_to_name_mappingss

rcCs(||j�kr|St|�}|j||�SdS)N)rr�get)rrZ
name_mappingsr	r	r
�_get_service_namesr
cCs\t|�}|dkr |j}t||�}|j}|jd�j}dtt|jdd���}t	j
j||||�S)a_Gets the path of where a service-2.json file should go in ~/.aws/models

    :type session: botocore.session.Session
    :param session: A session object

    :type service_definition: dict
    :param service_definition: The json loaded service definition

    :type service_name: str
    :param service_name: The service name to use. If this not provided,
        this will be determined from a combination of available services
        and the service definition.

    :returns: The path to where are model should be placed based on
        the service defintion and the current services in botocore.
    NZdata_loaderzservice-%d.json�versionz2.0)rrr
�api_versionZ
get_componentZCUSTOMER_DATA_PATH�int�floatr�os�path�join)r�service_definitionrrrrZ	data_pathZservice_model_namer	r	r
�get_model_location0s
rc@s2eZdZdZdZdddd�ddd	�gZd
d�ZdS)
�AddModelCommandz	add-modelz�Adds a service JSON model to the appropriate location in ~/.aws/models. Once the model gets added, CLI commands and Boto3 clients will be immediately available for the service JSON model provided.z
service-modelTz'The contents of the service JSON model.)�nameZrequired�	help_textzservice-namezmOverrides the default name used by the service JSON model to generate CLI service commands and Boto3 clients.)rrc
Csjtj|j�}t|j||j�}tjj|�}tjj	|�s>tj
|�t|d��}|j|jj
d��WdQRXdS)N�wbzutf-8r)�json�loadsrrZ_sessionrrr�dirname�exists�makedirs�open�write�encode)�selfZparsed_argsZparsed_globalsrZmodel_locationZmodel_directory�fr	r	r
�	_run_mainfs
zAddModelCommand._run_mainN)�__name__�
__module__�__qualname__�NAMEZDESCRIPTIONZ	ARG_TABLEr%r	r	r	r
rVs
r)N)
rrZbotocore.modelrZawscli.customizations.commandsrrr
rrr	r	r	r
�<module>
s

&