o ckF[@sXddlZddlmZddlmZddlmZddlmZddl m Z GdddeZ dS) N)json)AWSQueryConnection) RegionInfo)JSONResponseError) exceptionsc seZdZdZdZdZdZdZdZe Z ide j de j d e jd e jd e jd e jd e jde jde jde jde jde jde jde jde jde jde jide jde jde jde j de j!de j"de j#de j$d e j%d!e j&d"e j'd#e j(d$e j)d%e j*d&e j+d'e j,d(e j-e j.e j/e j0e j1e j2e j3e j4e j5e j6e j7d) Z8fd*d+Z9d,d-Z:dcd/d0Z;dcd1d2Z .dcd7d8Z? . . . .ded9d:Z@d;d<ZAd=d>ZBd?d@ZCdAdBZDdCdDZEdEdFZFdGdHZGdIdJZHdKdLZI . . . .dfdMdNZJdcdOdPZKdcdQdRZLdcdSdTZM . .dgdUdVZN . . . .dddWdXZO .dcdYdZZPd[d\ZQ . .dgd]d^ZR . . . . .ddd_d`ZSdadbZTZUS)hCodeDeployConnectiona AWS CodeDeploy **Overview** This is the AWS CodeDeploy API Reference. This guide provides descriptions of the AWS CodeDeploy APIs. For additional information, see the `AWS CodeDeploy User Guide`_. **Using the APIs** You can use the AWS CodeDeploy APIs to work with the following items: + Applications , which are unique identifiers that AWS CodeDeploy uses to ensure that the correct combinations of revisions, deployment configurations, and deployment groups are being referenced during deployments. You can work with applications by calling CreateApplication, DeleteApplication, GetApplication, ListApplications, BatchGetApplications, and UpdateApplication to create, delete, and get information about applications, and to change information about an application, respectively. + Deployment configurations , which are sets of deployment rules and deployment success and failure conditions that AWS CodeDeploy uses during deployments. You can work with deployment configurations by calling CreateDeploymentConfig, DeleteDeploymentConfig, GetDeploymentConfig, and ListDeploymentConfigs to create, delete, and get information about deployment configurations, respectively. + Deployment groups , which represent groups of Amazon EC2 instances to which application revisions can be deployed. You can work with deployment groups by calling CreateDeploymentGroup, DeleteDeploymentGroup, GetDeploymentGroup, ListDeploymentGroups, and UpdateDeploymentGroup to create, delete, and get information about single and multiple deployment groups, and to change information about a deployment group, respectively. + Deployment instances (also known simply as instances ), which represent Amazon EC2 instances to which application revisions are deployed. Deployment instances are identified by their Amazon EC2 tags or Auto Scaling group names. Deployment instances belong to deployment groups. You can work with deployment instances by calling GetDeploymentInstance and ListDeploymentInstances to get information about single and multiple deployment instances, respectively. + Deployments , which represent the process of deploying revisions to deployment groups. You can work with deployments by calling CreateDeployment, GetDeployment, ListDeployments, BatchGetDeployments, and StopDeployment to create and get information about deployments, and to stop a deployment, respectively. + Application revisions (also known simply as revisions ), which are archive files that are stored in Amazon S3 buckets or GitHub repositories. These revisions contain source content (such as source code, web pages, executable files, any deployment scripts, and similar) along with an Application Specification file (AppSpec file). (The AppSpec file is unique to AWS CodeDeploy; it defines a series of deployment actions that you want AWS CodeDeploy to execute.) An application revision is uniquely identified by its Amazon S3 object key and its ETag, version, or both. Application revisions are deployed to deployment groups. You can work with application revisions by calling GetApplicationRevision, ListApplicationRevisions, and RegisterApplicationRevision to get information about application revisions and to inform AWS CodeDeploy about an application revision, respectively. z 2014-10-06z us-east-1z"codedeploy.us-east-1.amazonaws.com codedeployCodeDeploy_20141006InvalidDeploymentIdException#InvalidDeploymentGroupNameException&DeploymentConfigAlreadyExistsExceptionInvalidRoleExceptionRoleRequiredException%DeploymentGroupAlreadyExistsException&DeploymentConfigLimitExceededExceptionInvalidNextTokenException$InvalidDeploymentConfigNameExceptionInvalidSortByExceptionInstanceDoesNotExistException'InvalidMinimumHealthyHostValueException!ApplicationLimitExceededException ApplicationNameRequiredExceptionInvalidEC2TagExceptionDeploymentDoesNotExistException DeploymentLimitExceededExceptionInvalidInstanceStatusExceptionRevisionRequiredException InvalidBucketNameFilterException%DeploymentGroupLimitExceededException$DeploymentGroupDoesNotExistException%DeploymentConfigNameRequiredException#DeploymentAlreadyCompletedExceptionRevisionDoesNotExistException$DeploymentGroupNameRequiredExceptionDeploymentIdRequiredException%DeploymentConfigDoesNotExistException!BucketNameFilterRequiredExceptionInvalidTimeRangeException ApplicationDoesNotExistExceptionInvalidRevisionExceptionInvalidSortOrderExceptionInvalidOperationException) InvalidAutoScalingGroupExceptionInvalidApplicationNameExceptionDescriptionTooLongException!ApplicationAlreadyExistsException#InvalidDeployedStateFilterExceptionDeploymentNotStartedExceptionDeploymentConfigInUseExceptionInstanceIdRequiredExceptionInvalidKeyPrefixFilterException InvalidDeploymentStatusExceptionc s^|dd}|st||j|j}d|vs|ddur|j|d<tt|jdi|||_dS)Nregionhost) poprDefaultRegionNameDefaultRegionEndpointendpointsuperr__init__r6)selfkwargsr6 __class__r88/usr/lib/python3/dist-packages/boto/codedeploy/layer1.pyr>s   zCodeDeployConnection.__init__cCsdgS)Nzhmac-v4r8)r?r8r8rC_required_auth_capabilitysz.CodeDeployConnection._required_auth_capabilityNcC(i}|dur ||d<|jdt|dS)z Gets information about one or more applications. :type application_names: list :param application_names: A list of application names, with multiple application names separated by spaces. NapplicationNamesBatchGetApplicationsactionbody make_requestrdumps)r?application_namesparamsr8r8rCbatch_get_applications  z+CodeDeployConnection.batch_get_applicationscCrE)z Gets information about one or more deployments. :type deployment_ids: list :param deployment_ids: A list of deployment IDs, with multiple deployment IDs separated by spaces. N deploymentIdsBatchGetDeploymentsrHrK)r?deployment_idsrOr8r8rCbatch_get_deploymentsrQz*CodeDeployConnection.batch_get_deploymentscCd|i}|jdt|dS)z Creates a new application. :type application_name: string :param application_name: The name of the application. This name must be unique within the AWS user account. applicationNameCreateApplicationrHrKr?application_namerOr8r8rCcreate_application z'CodeDeployConnection.create_applicationcCsld|i}|dur ||d<|dur||d<|dur||d<|dur$||d<|dur,||d<|jdt|d S) a Deploys an application revision to the specified deployment group. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. :type deployment_group_name: string :param deployment_group_name: The deployment group's name. :type revision: dict :param revision: The type of revision to deploy, along with information about the revision's location. :type deployment_config_name: string :param deployment_config_name: The name of an existing deployment configuration within the AWS user account. If not specified, the value configured in the deployment group will be used as the default. If the deployment group does not have a deployment configuration associated with it, then CodeDeployDefault.OneAtATime will be used by default. :type description: string :param description: A comment about the deployment. :type ignore_application_stop_failures: boolean :param ignore_application_stop_failures: If set to true, then if the deployment causes the ApplicationStop deployment lifecycle event to fail to a specific instance, the deployment will not be considered to have failed to that instance at that point and will continue on to the BeforeInstall deployment lifecycle event. If set to false or not specified, then if the deployment causes the ApplicationStop deployment lifecycle event to fail to a specific instance, the deployment will stop to that instance, and the deployment to that instance will be considered to have failed. rWNdeploymentGroupNamerevisiondeploymentConfigName descriptionignoreApplicationStopFailuresCreateDeploymentrHrK)r?rZdeployment_group_namer^deployment_config_namer` ignore_application_stop_failuresrOr8r8rCcreate_deployments*z&CodeDeployConnection.create_deploymentcC,d|i}|dur ||d<|jdt|dS)a Creates a new deployment configuration. :type deployment_config_name: string :param deployment_config_name: The name of the deployment configuration to create. :type minimum_healthy_hosts: dict :param minimum_healthy_hosts: The minimum number of healthy instances that should be available at any time during the deployment. There are two parameters expected in the input: type and value. The type parameter takes either of the following values: + HOST_COUNT: The value parameter represents the minimum number of healthy instances, as an absolute value. + FLEET_PERCENT: The value parameter represents the minimum number of healthy instances, as a percentage of the total number of instances in the deployment. If you specify FLEET_PERCENT, then at the start of the deployment AWS CodeDeploy converts the percentage to the equivalent number of instances and rounds fractional instances up. The value parameter takes an integer. For example, to set a minimum of 95% healthy instances, specify a type of FLEET_PERCENT and a value of 95. r_NminimumHealthyHostsCreateDeploymentConfigrHrK)r?rdminimum_healthy_hostsrOr8r8rCcreate_deployment_configs z-CodeDeployConnection.create_deployment_configcCs^||d}|dur ||d<|dur||d<|dur||d<|dur%||d<|jdt|dS) a Creates a new deployment group for application revisions to be deployed to. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. :type deployment_group_name: string :param deployment_group_name: The name of an existing deployment group for the specified application. :type deployment_config_name: string :param deployment_config_name: If specified, the deployment configuration name must be one of the predefined values, or it can be a custom deployment configuration: + CodeDeployDefault.AllAtOnce deploys an application revision to up to all of the Amazon EC2 instances at once. The overall deployment succeeds if the application revision deploys to at least one of the instances. The overall deployment fails after the application revision fails to deploy to all of the instances. For example, for 9 instances, deploy to up to all 9 instances at once. The overall deployment succeeds if any of the 9 instances is successfully deployed to, and it fails if all 9 instances fail to be deployed to. + CodeDeployDefault.HalfAtATime deploys to up to half of the instances at a time (with fractions rounded down). The overall deployment succeeds if the application revision deploys to at least half of the instances (with fractions rounded up); otherwise, the deployment fails. For example, for 9 instances, deploy to up to 4 instances at a time. The overall deployment succeeds if 5 or more instances are successfully deployed to; otherwise, the deployment fails. Note that the deployment may successfully deploy to some instances, even if the overall deployment fails. + CodeDeployDefault.OneAtATime deploys the application revision to only one of the instances at a time. The overall deployment succeeds if the application revision deploys to all of the instances. The overall deployment fails after the application revision first fails to deploy to any one instance. For example, for 9 instances, deploy to one instance at a time. The overall deployment succeeds if all 9 instances are successfully deployed to, and it fails if any of one of the 9 instances fail to be deployed to. Note that the deployment may successfully deploy to some instances, even if the overall deployment fails. This is the default deployment configuration if a configuration isn't specified for either the deployment or the deployment group. To create a custom deployment configuration, call the create deployment configuration operation. :type ec_2_tag_filters: list :param ec_2_tag_filters: The Amazon EC2 tags to filter on. :type auto_scaling_groups: list :param auto_scaling_groups: A list of associated Auto Scaling groups. :type service_role_arn: string :param service_role_arn: A service role ARN that allows AWS CodeDeploy to act on the user's behalf when interacting with AWS services. rWr]Nr_ ec2TagFiltersautoScalingGroupsserviceRoleArnCreateDeploymentGrouprHrK)r?rZrcrdec_2_tag_filtersauto_scaling_groupsservice_role_arnrOr8r8rCcreate_deployment_group+sFz,CodeDeployConnection.create_deployment_groupcCrV)z Deletes an application. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. rWDeleteApplicationrHrKrYr8r8rCdelete_applicationr\z'CodeDeployConnection.delete_applicationcCrV)ay Deletes a deployment configuration. A deployment configuration cannot be deleted if it is currently in use. Also, predefined configurations cannot be deleted. :type deployment_config_name: string :param deployment_config_name: The name of an existing deployment configuration within the AWS user account. r_DeleteDeploymentConfigrHrKr?rdrOr8r8rCdelete_deployment_configs z-CodeDeployConnection.delete_deployment_configcC||d}|jdt|dS)az Deletes a deployment group. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. :type deployment_group_name: string :param deployment_group_name: The name of an existing deployment group for the specified application. rlDeleteDeploymentGrouprHrKr?rZrcrOr8r8rCdelete_deployment_groups z,CodeDeployConnection.delete_deployment_groupcCrV)z Gets information about an application. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. rWGetApplicationrHrKrYr8r8rCget_applicationr\z$CodeDeployConnection.get_applicationcCrz)a{ Gets information about an application revision. :type application_name: string :param application_name: The name of the application that corresponds to the revision. :type revision: dict :param revision: Information about the application revision to get, including the revision's type and its location. rWr^GetApplicationRevisionrHrK)r?rZr^rOr8r8rCget_application_revision z-CodeDeployConnection.get_application_revisioncCrV)z Gets information about a deployment. :type deployment_id: string :param deployment_id: An existing deployment ID within the AWS user account. deploymentId GetDeploymentrHrKr? deployment_idrOr8r8rCget_deploymentr\z#CodeDeployConnection.get_deploymentcCrV)z Gets information about a deployment configuration. :type deployment_config_name: string :param deployment_config_name: The name of an existing deployment configuration within the AWS user account. r_GetDeploymentConfigrHrKrxr8r8rCget_deployment_configr\z*CodeDeployConnection.get_deployment_configcCrz)a Gets information about a deployment group. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. :type deployment_group_name: string :param deployment_group_name: The name of an existing deployment group for the specified application. rlGetDeploymentGrouprHrKr|r8r8rCget_deployment_grouprz)CodeDeployConnection.get_deployment_groupcCrz)a\ Gets information about an Amazon EC2 instance as part of a deployment. :type deployment_id: string :param deployment_id: The unique ID of a deployment. :type instance_id: string :param instance_id: The unique ID of an Amazon EC2 instance in the deployment's deployment group. )r instanceIdGetDeploymentInstancerHrK)r?r instance_idrOr8r8rCget_deployment_instancerz,CodeDeployConnection.get_deployment_instancec Cs|d|i}|dur ||d<|dur||d<|dur||d<|dur$||d<|dur,||d<|dur4||d<|jd t|d S) a Lists information about revisions for an application. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. :type sort_by: string :param sort_by: The column name to sort the list results by: + registerTime: Sort the list results by when the revisions were registered with AWS CodeDeploy. + firstUsedTime: Sort the list results by when the revisions were first used by in a deployment. + lastUsedTime: Sort the list results by when the revisions were last used in a deployment. If not specified or set to null, the results will be returned in an arbitrary order. :type sort_order: string :param sort_order: The order to sort the list results by: + ascending: Sort the list results in ascending order. + descending: Sort the list results in descending order. If not specified, the results will be sorted in ascending order. If set to null, the results will be sorted in an arbitrary order. :type s_3_bucket: string :param s_3_bucket: A specific Amazon S3 bucket name to limit the search for revisions. If set to null, then all of the user's buckets will be searched. :type s_3_key_prefix: string :param s_3_key_prefix: A specific key prefix for the set of Amazon S3 objects to limit the search for revisions. :type deployed: string :param deployed: Whether to list revisions based on whether the revision is the target revision of an deployment group: + include: List revisions that are target revisions of a deployment group. + exclude: Do not list revisions that are target revisions of a deployment group. + ignore: List all revisions, regardless of whether they are target revisions of a deployment group. :type next_token: string :param next_token: An identifier that was returned from the previous list application revisions call, which can be used to return the next set of applications in the list. rWNsortBy sortOrders3Bucket s3KeyPrefixdeployed nextTokenListApplicationRevisionsrHrK) r?rZsort_by sort_order s_3_buckets_3_key_prefixr next_tokenrOr8r8rClist_application_revisionss @z/CodeDeployConnection.list_application_revisionscCrE)a6 Lists the applications registered within the AWS user account. :type next_token: string :param next_token: An identifier that was returned from the previous list applications call, which can be used to return the next set of applications in the list. NrListApplicationsrHrKr?rrOr8r8rClist_applicationses  z&CodeDeployConnection.list_applicationscCrE)aZ Lists the deployment configurations within the AWS user account. :type next_token: string :param next_token: An identifier that was returned from the previous list deployment configurations call, which can be used to return the next set of deployment configurations in the list. NrListDeploymentConfigsrHrKrr8r8rClist_deployment_configsus  z,CodeDeployConnection.list_deployment_configscCrg)a Lists the deployment groups for an application registered within the AWS user account. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. :type next_token: string :param next_token: An identifier that was returned from the previous list deployment groups call, which can be used to return the next set of deployment groups in the list. rWNrListDeploymentGroupsrHrK)r?rZrrOr8r8rClist_deployment_groupss z+CodeDeployConnection.list_deployment_groupscCs<d|i}|dur ||d<|dur||d<|jdt|dS)a Lists the Amazon EC2 instances for a deployment within the AWS user account. :type deployment_id: string :param deployment_id: The unique ID of a deployment. :type next_token: string :param next_token: An identifier that was returned from the previous list deployment instances call, which can be used to return the next set of deployment instances in the list. :type instance_status_filter: list :param instance_status_filter: A subset of instances to list, by status: + Pending: Include in the resulting list those instances with pending deployments. + InProgress: Include in the resulting list those instances with in- progress deployments. + Succeeded: Include in the resulting list those instances with succeeded deployments. + Failed: Include in the resulting list those instances with failed deployments. + Skipped: Include in the resulting list those instances with skipped deployments. + Unknown: Include in the resulting list those instances with deployments in an unknown state. rNrinstanceStatusFilterListDeploymentInstancesrHrK)r?rrinstance_status_filterrOr8r8rClist_deployment_instancess!z.CodeDeployConnection.list_deployment_instancescCshi}|dur ||d<|dur||d<|dur||d<|dur"||d<|dur*||d<|jdt|dS) a Lists the deployments under a deployment group for an application registered within the AWS user account. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. :type deployment_group_name: string :param deployment_group_name: The name of an existing deployment group for the specified application. :type include_only_statuses: list :param include_only_statuses: A subset of deployments to list, by status: + Created: Include in the resulting list created deployments. + Queued: Include in the resulting list queued deployments. + In Progress: Include in the resulting list in-progress deployments. + Succeeded: Include in the resulting list succeeded deployments. + Failed: Include in the resulting list failed deployments. + Aborted: Include in the resulting list aborted deployments. :type create_time_range: dict :param create_time_range: A deployment creation start- and end-time range for returning a subset of the list of deployments. :type next_token: string :param next_token: An identifier that was returned from the previous list deployments call, which can be used to return the next set of deployments in the list. NrWr]includeOnlyStatusescreateTimeRangerListDeploymentsrHrK)r?rZrcinclude_only_statusescreate_time_rangerrOr8r8rClist_deploymentss%z%CodeDeployConnection.list_deploymentscCs.||d}|dur ||d<|jdt|dS)a Registers with AWS CodeDeploy a revision for the specified application. :type application_name: string :param application_name: The name of an existing AWS CodeDeploy application within the AWS user account. :type description: string :param description: A comment about the revision. :type revision: dict :param revision: Information about the application revision to register, including the revision's type and its location. rNr`RegisterApplicationRevisionrHrK)r?rZr^r`rOr8r8rCregister_application_revisionsz2CodeDeployConnection.register_application_revisioncCrV)z Attempts to stop an ongoing deployment. :type deployment_id: string :param deployment_id: The unique ID of a deployment. rStopDeploymentrHrKrr8r8rCstop_deploymentsz$CodeDeployConnection.stop_deploymentcCs8i}|dur ||d<|dur||d<|jdt|dS)ab Changes an existing application's name. :type application_name: string :param application_name: The current name of the application that you want to change. :type new_application_name: string :param new_application_name: The new name that you want to change the application to. NrWnewApplicationNameUpdateApplicationrHrK)r?rZnew_application_namerOr8r8rCupdate_applicationsz'CodeDeployConnection.update_applicationc Csn||d}|dur ||d<|dur||d<|dur||d<|dur%||d<|dur-||d<|jdt|d S) a Changes information about an existing deployment group. :type application_name: string :param application_name: The application name corresponding to the deployment group to update. :type current_deployment_group_name: string :param current_deployment_group_name: The current name of the existing deployment group. :type new_deployment_group_name: string :param new_deployment_group_name: The new name of the deployment group, if you want to change it. :type deployment_config_name: string :param deployment_config_name: The replacement deployment configuration name to use, if you want to change it. :type ec_2_tag_filters: list :param ec_2_tag_filters: The replacement set of Amazon EC2 tags to filter on, if you want to change them. :type auto_scaling_groups: list :param auto_scaling_groups: The replacement list of Auto Scaling groups to be included in the deployment group, if you want to change them. :type service_role_arn: string :param service_role_arn: A replacement service role's ARN, if you want to change it. )rWcurrentDeploymentGroupNameNnewDeploymentGroupNamer_rmrnroUpdateDeploymentGrouprHrK) r?rZcurrent_deployment_group_namenew_deployment_group_namerdrqrrrsrOr8r8rCupdate_deployment_group4s (z,CodeDeployConnection.update_deployment_groupc Csd|j|f|jjdtt|d}|jdddi||d}|j|ddd}|d }t j ||j d kr@|r>t |SdSt |}|d d}|j||j} | |j |j|d ) Nz%s.%szapplication/x-amz-json-1.1)z X-Amz-TargetHostz Content-TypezContent-LengthPOST/)methodpath auth_pathrOheadersdata )senderoverride_num_retrieszutf-8__type)rJ) TargetPrefixr6r<strlenbuild_base_http_request_mexereaddecodebotologdebugstatusrloadsget_faults ResponseErrorreason) r?rIrJr http_requestresponse response_body json_body fault_nameexception_classr8r8rCrLls0        z!CodeDeployConnection.make_request)N)NNNNN)NNNN)NNNNNN)NN)V__name__ __module__ __qualname____doc__ APIVersionr:r; ServiceNamerrrrr r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5rr>rDrPrUr[rfrkrtrvryr}rrrrrrrrrrrrrrrrrL __classcell__r8r8rArCrs=      !"# 0    9 ' T     P   ) 4    8r) r boto.compatrboto.connectionrboto.regioninforboto.exceptionrboto.codedeployrrr8r8r8rCs