HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/awscli/customizations/configure/__pycache__/addmodel.cpython-310.pyc
o

.&�a�@sVddlZddlZddlmZddlmZdd�Zdd�Zddd	�ZGd
d�de�Z	dS)
�N)�ServiceModel)�BasicCommandcCs*i}|��D]}|�|�}|||j<q|S�N)�get_available_services�get_service_model�endpoint_prefix)�session�prefixes_to_services�service_name�
service_model�r�J/usr/lib/python3/dist-packages/awscli/customizations/configure/addmodel.py�%_get_endpoint_prefix_to_name_mappingss

rcCs$||��vr|St|�}|�||�Sr)rr�get)rr�
name_mappingsrrr
�_get_service_namesrcCs\t|�}|dur|j}t||�}|j}|�d�j}dtt|�dd���}t	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.
    N�data_loaderzservice-%d.json�versionz2.0)rrr�api_version�
get_component�CUSTOMER_DATA_PATH�int�floatr�os�path�join)r�service_definitionr
rrr�	data_path�service_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.)�name�required�	help_textzservice-namezmOverrides the default name used by the service JSON model to generate CLI service commands and Boto3 clients.)r!r#cCs�t�|j�}t|j||j�}tj�|�}tj�	|�st�
|�t|d��}|�|j�
d��Wd�dS1s9wYdS)N�wbzutf-8r)�json�loadsrr�_sessionr
rr�dirname�exists�makedirs�open�write�encode)�self�parsed_args�parsed_globalsr�model_location�model_directory�frrr
�	_run_mainfs
�

��zAddModelCommand._run_mainN)�__name__�
__module__�__qualname__�NAME�DESCRIPTION�	ARG_TABLEr4rrrr
r Vs����r r)
r%r�botocore.modelr�awscli.customizations.commandsrrrrr rrrr
�<module>s

&