o ckF[Dy@sXddlZddlmZddlmZddlmZddlmZddl m Z GdddeZ dS) N)json)AWSQueryConnection) RegionInfo)JSONResponseError) exceptionscs:eZdZdZdZdZdZeZe j e j dZ fddZ dd Zd5d d Zd dZ d6ddZddZd5ddZd5ddZddZd5ddZd5ddZd6ddZ d7dd Z d7d!d"Z d8d#d$Z d9d%d&Zd'd(Z d7d)d*Z d6d+d,Zd5d-d.Z d:d/d0Z! d9d1d2Z"d3d4Z#Z$S);EC2ContainerServiceConnectionaz Amazon EC2 Container Service (Amazon ECS) is a highly scalable, fast, container management service that makes it easy to run, stop, and manage Docker containers on a cluster of Amazon EC2 instances. Amazon ECS lets you launch and stop container-enabled applications with simple API calls, allows you to get the state of your cluster from a centralized service, and gives you access to many familiar Amazon EC2 features like security groups, Amazon EBS volumes, and IAM roles. You can use Amazon ECS to schedule the placement of containers across your cluster based on your resource needs, isolation policies, and availability requirements. Amazon EC2 Container Service eliminates the need for you to operate your own cluster management and configuration management systems or worry about scaling your management infrastructure. z 2014-11-13z us-east-1zecs.us-east-1.amazonaws.com)ServerExceptionClientExceptionc s^|dd}|st||j|j}d|vs|ddur|j|d<tt|jdi|||_dS)Nregionhost) poprDefaultRegionNameDefaultRegionEndpointendpointsuperr__init__r )selfkwargsr  __class__r A/usr/lib/python3/dist-packages/boto/ec2containerservice/layer1.pyr<s   z&EC2ContainerServiceConnection.__init__cCsdgS)Nzhmac-v4r )rr r r_required_auth_capabilityHsz7EC2ContainerServiceConnection._required_auth_capabilityNcC&i}|dur ||d<|jddd|dS)a Creates a new Amazon ECS cluster. By default, your account will receive a `default` cluster when you launch your first container instance. However, you can create your own cluster with a unique name with the `CreateCluster` action. During the preview, each account is limited to two clusters. :type cluster_name: string :param cluster_name: The name of your cluster. If you do not specify a name for your cluster, you will create a cluster named `default`. N clusterName CreateClusterPOST/actionverbpathparams _make_request)r cluster_namer"r r rcreate_clusterKsz,EC2ContainerServiceConnection.create_clustercCd|i}|jddd|dS)a Deletes the specified cluster. You must deregister all container instances from this cluster before you may delete it. You can list the container instances in a cluster with ListContainerInstances and deregister them with DeregisterContainerInstance. :type cluster: string :param cluster: The cluster you want to delete. cluster DeleteClusterrrrr#)rr(r"r r rdelete_clustera  z,EC2ContainerServiceConnection.delete_clustercCsBd|i}|dur ||d<|durt||d<|jddd|dS) aG Deregisters an Amazon ECS container instance from the specified cluster. This instance will no longer be available to run tasks. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instance you want to deregister. If you do not specify a cluster, the default cluster is assumed. :type container_instance: string :param container_instance: The container instance UUID or full Amazon Resource Name (ARN) of the container instance you want to deregister. The ARN contains the `arn:aws:ecs` namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the `container-instance` namespace, and then the container instance UUID. For example, arn:aws:ecs: region : aws_account_id :container-instance/ container_instance_UUID . :type force: boolean :param force: Force the deregistration of the container instance. You can use the `force` parameter if you have several tasks running on a container instance and you don't want to run `StopTask` for each task before deregistering the container instance. containerInstanceNr(forceDeregisterContainerInstancerrr)strlowerr$)rcontainer_instancer(r-r"r r rderegister_container_instancessz;EC2ContainerServiceConnection.deregister_container_instancecCr')a Deregisters the specified task definition. You will no longer be able to run tasks from this definition after deregistration. :type task_definition: string :param task_definition: The `family` and `revision` ( `family:revision`) or full Amazon Resource Name (ARN) of the task definition that you want to deregister. taskDefinitionDeregisterTaskDefinitionrrrr#rtask_definitionr"r r rderegister_task_definitionr+z8EC2ContainerServiceConnection.deregister_task_definitioncCs,i}|dur |||d|jddd|dS)a& Describes one or more of your clusters. :type clusters: list :param clusters: A space-separated list of cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed. Nzclusters.memberDescribeClustersrrrbuild_list_paramsr$)rclustersr"r r rdescribe_clusterss z/EC2ContainerServiceConnection.describe_clusterscC4i}|||d|dur||d<|jddd|dS)a Describes Amazon EC2 Container Service container instances. Returns metadata about registered and remaining resources on each container instance requested. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances you want to describe. If you do not specify a cluster, the default cluster is assumed. :type container_instances: list :param container_instances: A space-separated list of container instance UUIDs or full Amazon Resource Name (ARN) entries. containerInstances.memberNr(DescribeContainerInstancesrrrr9)rcontainer_instancesr(r"r r rdescribe_container_instancessz:EC2ContainerServiceConnection.describe_container_instancescCr')a Describes a task definition. :type task_definition: string :param task_definition: The `family` and `revision` ( `family:revision`) or full Amazon Resource Name (ARN) of the task definition that you want to describe. r3DescribeTaskDefinitionrrrr#r5r r rdescribe_task_definitions  z6EC2ContainerServiceConnection.describe_task_definitioncCr=)a Describes a specified task or tasks. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task you want to describe. If you do not specify a cluster, the default cluster is assumed. :type tasks: list :param tasks: A space-separated list of task UUIDs or full Amazon Resource Name (ARN) entries. z tasks.memberNr( DescribeTasksrrrr9)rtasksr(r"r r rdescribe_taskssz,EC2ContainerServiceConnection.describe_taskscCr)a( This action is only used by the Amazon EC2 Container Service agent, and it is not intended for use outside of the agent. Returns an endpoint for the Amazon EC2 Container Service agent to poll for updates. :type container_instance: string :param container_instance: The container instance UUID or full Amazon Resource Name (ARN) of the container instance. The ARN contains the `arn:aws:ecs` namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the `container-instance` namespace, and then the container instance UUID. For example, arn:aws:ecs: region : aws_account_id :container- instance/ container_instance_UUID . Nr,DiscoverPollEndpointrrrr#)rr1r"r r rdiscover_poll_endpointsz4EC2ContainerServiceConnection.discover_poll_endpointcCs6i}|dur ||d<|dur||d<|jddd|dS)a Returns a list of existing clusters. :type next_token: string :param next_token: The `nextToken` value returned from a previous paginated `ListClusters` request where `maxResults` was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the `nextToken` value. This value is `null` when there are no more results to return. :type max_results: integer :param max_results: The maximum number of cluster results returned by `ListClusters` in paginated output. When this parameter is used, `ListClusters` only returns `maxResults` results in a single page along with a `nextToken` response element. The remaining results of the initial request can be seen by sending another `ListClusters` request with the returned `nextToken` value. This value can be between 1 and 100. If this parameter is not used, then `ListClusters` returns up to 100 results and a `nextToken` value if applicable. N nextToken maxResults ListClustersrrrr#)r next_token max_resultsr"r r r list_clusters!sz+EC2ContainerServiceConnection.list_clusterscCFi}|dur ||d<|dur||d<|dur||d<|jddd|dS) a Returns a list of container instances in a specified cluster. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances you want to list. If you do not specify a cluster, the default cluster is assumed.. :type next_token: string :param next_token: The `nextToken` value returned from a previous paginated `ListContainerInstances` request where `maxResults` was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the `nextToken` value. This value is `null` when there are no more results to return. :type max_results: integer :param max_results: The maximum number of container instance results returned by `ListContainerInstances` in paginated output. When this parameter is used, `ListContainerInstances` only returns `maxResults` results in a single page along with a `nextToken` response element. The remaining results of the initial request can be seen by sending another `ListContainerInstances` request with the returned `nextToken` value. This value can be between 1 and 100. If this parameter is not used, then `ListContainerInstances` returns up to 100 results and a `nextToken` value if applicable. Nr(rIrJListContainerInstancesrrrr#)rr(rLrMr"r r rlist_container_instancesCsz6EC2ContainerServiceConnection.list_container_instancescCrO) ah Returns a list of task definitions that are registered to your account. You can filter the results by family name with the `familyPrefix` parameter. :type family_prefix: string :param family_prefix: The name of the family that you want to filter the `ListTaskDefinitions` results with. Specifying a `familyPrefix` will limit the listed task definitions to definitions that belong to that family. :type next_token: string :param next_token: The `nextToken` value returned from a previous paginated `ListTaskDefinitions` request where `maxResults` was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the `nextToken` value. This value is `null` when there are no more results to return. :type max_results: integer :param max_results: The maximum number of task definition results returned by `ListTaskDefinitions` in paginated output. When this parameter is used, `ListTaskDefinitions` only returns `maxResults` results in a single page along with a `nextToken` response element. The remaining results of the initial request can be seen by sending another `ListTaskDefinitions` request with the returned `nextToken` value. This value can be between 1 and 100. If this parameter is not used, then `ListTaskDefinitions` returns up to 100 results and a `nextToken` value if applicable. N familyPrefixrIrJListTaskDefinitionsrrrr#)r family_prefixrLrMr"r r rlist_task_definitionsms!z3EC2ContainerServiceConnection.list_task_definitionscCsfi}|dur ||d<|dur||d<|dur||d<|dur"||d<|dur*||d<|jddd |d S) ao Returns a list of tasks for a specified cluster. You can filter the results by family name or by a particular container instance with the `family` and `containerInstance` parameters. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the tasks you want to list. If you do not specify a cluster, the default cluster is assumed.. :type container_instance: string :param container_instance: The container instance UUID or full Amazon Resource Name (ARN) of the container instance that you want to filter the `ListTasks` results with. Specifying a `containerInstance` will limit the results to tasks that belong to that container instance. :type family: string :param family: The name of the family that you want to filter the `ListTasks` results with. Specifying a `family` will limit the results to tasks that belong to that family. :type next_token: string :param next_token: The `nextToken` value returned from a previous paginated `ListTasks` request where `maxResults` was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the `nextToken` value. This value is `null` when there are no more results to return. :type max_results: integer :param max_results: The maximum number of task results returned by `ListTasks` in paginated output. When this parameter is used, `ListTasks` only returns `maxResults` results in a single page along with a `nextToken` response element. The remaining results of the initial request can be seen by sending another `ListTasks` request with the returned `nextToken` value. This value can be between 1 and 100. If this parameter is not used, then `ListTasks` returns up to 100 results and a `nextToken` value if applicable. Nr(r,familyrIrJ ListTasksrrrr#)rr(r1rVrLrMr"r r r list_taskss +z(EC2ContainerServiceConnection.list_taskscCs^i}|dur ||d<|dur||d<|dur||d<|dur&|||dd|jddd |d S) a; This action is only used by the Amazon EC2 Container Service agent, and it is not intended for use outside of the agent. Registers an Amazon EC2 instance into the specified cluster. This instance will become available to place containers on. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that you want to register your container instance with. If you do not specify a cluster, the default cluster is assumed.. :type instance_identity_document: string :param instance_identity_document: :type instance_identity_document_signature: string :param instance_identity_document_signature: :type total_resources: list :param total_resources: Nr(instanceIdentityDocument!instanceIdentityDocumentSignatureztotalResources.member)nametype doubleValue longValue integerValuestringSetValueRegisterContainerInstancerrrbuild_complex_list_paramsr$)rr(instance_identity_document$instance_identity_document_signaturetotal_resourcesr"r r rregister_container_instances$z9EC2ContainerServiceConnection.register_container_instancecCs*d|i}|||dd|jddd|dS)aR Registers a new task definition from the supplied `family` and `containerDefinitions`. :type family: string :param family: You can specify a `family` for a task definition, which allows you to track multiple versions of the same task definition. You can think of the `family` as a name for your task definition. :type container_definitions: list :param container_definitions: A list of container definitions in JSON format that describe the different containers that make up your task. rVzcontainerDefinitions.member) r[imagecpumemorylinks portMappings essential entryPointcommand environmentRegisterTaskDefinitionrrrrb)rrVcontainer_definitionsr"r r rregister_task_definitionsz6EC2ContainerServiceConnection.register_task_definitioncCsJd|i}|dur ||d<|dur||d<|dur||d<|jddd|d S) a Start a task using random placement and the default Amazon ECS scheduler. If you want to use your own scheduler or place a task on a specific container instance, use `StartTask` instead. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your task on. If you do not specify a cluster, the default cluster is assumed.. :type task_definition: string :param task_definition: The `family` and `revision` ( `family:revision`) or full Amazon Resource Name (ARN) of the task definition that you want to run. :type overrides: dict :param overrides: :type count: integer :param count: The number of instances of the specified task that you would like to place on your cluster. r3Nr( overridescountRunTaskrrrr#)rr6r(rtrur"r r rrun_tasksz&EC2ContainerServiceConnection.run_taskcCsHd|i}|||d|dur||d<|dur||d<|jddd|d S) a Starts a new task from the specified task definition on the specified container instance or instances. If you want to use the default Amazon ECS scheduler to place your task, use `RunTask` instead. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that you want to start your task on. If you do not specify a cluster, the default cluster is assumed.. :type task_definition: string :param task_definition: The `family` and `revision` ( `family:revision`) or full Amazon Resource Name (ARN) of the task definition that you want to start. :type overrides: dict :param overrides: :type container_instances: list :param container_instances: The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. r3r>Nr(rt StartTaskrrrr9)rr6r@r(rtr"r r r start_taskAsz(EC2ContainerServiceConnection.start_taskcCs*d|i}|dur ||d<|jddd|dS)a Stops a running task. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task you want to stop. If you do not specify a cluster, the default cluster is assumed.. :type task: string :param task: The task UUIDs or full Amazon Resource Name (ARN) entry of the task you would like to stop. taskNr(StopTaskrrrr#)rrzr(r"r r r stop_taskisz'EC2ContainerServiceConnection.stop_taskc Csi}|dur ||d<|dur||d<|dur||d<|dur"||d<|dur*||d<|dur2||d<|dur>|||dd |jd d d |d S)a This action is only used by the Amazon EC2 Container Service agent, and it is not intended for use outside of the agent. Sent to acknowledge that a container changed states. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container. :type task: string :param task: The task UUID or full Amazon Resource Name (ARN) of the task that hosts the container. :type container_name: string :param container_name: The name of the container. :type status: string :param status: The status of the state change request. :type exit_code: integer :param exit_code: The exit code returned for the state change request. :type reason: string :param reason: The reason for the state change request. :type network_bindings: list :param network_bindings: The network bindings of the container. Nr(rz containerNamestatusexitCodereasonznetworkBindings.member)bindIP containerPorthostPortSubmitContainerStateChangerrrrb) rr(rzcontainer_namer~ exit_codernetwork_bindingsr"r r rsubmit_container_state_changes0#z;EC2ContainerServiceConnection.submit_container_state_changecCsVi}|dur ||d<|dur||d<|dur||d<|dur"||d<|jddd|d S) a This action is only used by the Amazon EC2 Container Service agent, and it is not intended for use outside of the agent. Sent to acknowledge that a task changed states. :type cluster: string :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task. :type task: string :param task: The task UUID or full Amazon Resource Name (ARN) of the task in the state change request. :type status: string :param status: The status of the state change request. :type reason: string :param reason: The reason for the state change request. Nr(rzr~rSubmitTaskStateChangerrrr#)rr(rzr~rr"r r rsubmit_task_state_changesz6EC2ContainerServiceConnection.submit_task_state_changec Csd|d<|j|dd|d}|d}tj||jdkr$t|St|}| di d d}|j ||j } | |j|j |d ) NJSON ContentTyperrrzutf-8ErrorCode)body) make_requestreaddecodebotologdebugr~rloadsget_faults ResponseErrorr) rrr r!r"responser json_body fault_nameexception_classr r rr$s     z+EC2ContainerServiceConnection._make_request)N)NN)NNN)NNNNN)NNNN)NNNNNNN)%__name__ __module__ __qualname____doc__ APIVersionrrrrrrr rrrr&r*r2r7r<rArCrFrHrNrQrUrXrgrsrwryr|rrr$ __classcell__r r rrrsl   (     " * - ; , & ( : &r) r boto.compatrboto.connectionrboto.regioninforboto.exceptionrboto.ec2containerservicerrr r r rs