Continues or rolls back an Amazon ECS service deployment that is paused at a lifecycle hook.
When a service deployment reaches a lifecycle stage that has a PAUSE hook configured, the deployment pauses and waits for an explicit action. Use this API to either continue the deployment to the next stage or roll back to the previous service revision.
To find the hookId of the paused hook, call DescribeServiceDeployments and inspect the lifecycleHookDetails field.
For more information, see Continuing Amazon ECS service deployments in the Amazon Elastic Container Service Developer Guide.
Parameters:
-
service_deployment_arn
(String)
–
The ARN of the service deployment to continue or roll back.
-
hook_id
(String)
–
The ID of the paused lifecycle hook to act on. You can find the hookId by calling DescribeServiceDeployments and inspecting the lifecycleHookDetails field of the service deployment.
-
action
(Optional[DeploymentLifecycleHookAction], default:
None
)
–
The action to take on the paused lifecycle hook. Valid values are:
If no value is specified, the default action is CONTINUE.
Raises:
-
AccessDeniedException
–
You don't have authorization to perform the requested action.
-
ClientException
–
These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.
-
InvalidParameterException
–
The specified parameter isn't valid. Review the available parameters for the API request.
For more information about service event errors, see Amazon ECS service event messages.
-
ServerException
–
These errors are usually caused by a server issue.
-
ServiceDeploymentNotFoundException
–
The service deploy ARN that you specified in the ContinueServiceDeployment doesn't exist. You can use ListServiceDeployments to retrieve the service deployment ARNs.
-
UnsupportedFeatureException
–
The specified task isn't supported in this Region.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To continue a paused service deployment
This example continues a service deployment that is paused at a lifecycle hook, using the CONTINUE action to proceed to the next deployment stage.
>>> client.continue_service_deployment(service_deployment_arn='arn:aws:ecs:us-east-1:123456789012:service-deployment/MyCluster/MyService/r9i43YFjvgF_xlg7m2eJ1r', hook_id='ecs-pause-Xk7rT2mP9sLwQn4vB8fYd3hJ6gA1cE5iO0uR_ZpWq', action='CONTINUE')
To roll back a paused service deployment
This example rolls back a service deployment that is paused at a lifecycle hook, using the ROLLBACK action to revert to the previous service revision.
>>> client.continue_service_deployment(service_deployment_arn='arn:aws:ecs:us-east-1:123456789012:service-deployment/MyCluster/MyService/r9i43YFjvgF_xlg7m2eJ1r', hook_id='ecs-pause-Xk7rT2mP9sLwQn4vB8fYd3hJ6gA1cE5iO0uR_ZpWq', action='ROLLBACK')
Source code in docs_src/capo_ecs/_services/ecs.py
| def continue_service_deployment(
self,
service_deployment_arn: "capo_ecs.types.string.String",
hook_id: "capo_ecs.types.string.String",
*,
config_overrides: Optional[ECSClientConfig] = None,
action: Optional[
"capo_ecs.types.deployment_lifecycle_hook_action.DeploymentLifecycleHookAction"
] = None,
) -> "capo_ecs.types.continue_service_deployment_response.ContinueServiceDeploymentResponse":
"""<p>Continues or rolls back an Amazon ECS service deployment that is paused at a lifecycle hook.</p> <p>When a service deployment reaches a lifecycle stage that has a <code>PAUSE</code> hook configured, the deployment pauses and waits for an explicit action. Use this API to either continue the deployment to the next stage or roll back to the previous service revision.</p> <p>To find the <code>hookId</code> of the paused hook, call <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeServiceDeployments.html">DescribeServiceDeployments</a> and inspect the <code>lifecycleHookDetails</code> field.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/continue-service-deployment.html">Continuing Amazon ECS service deployments</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.</p>
Args:
service_deployment_arn: <p>The ARN of the service deployment to continue or roll back.</p>
hook_id: <p>The ID of the paused lifecycle hook to act on. You can find the <code>hookId</code> by calling <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeServiceDeployments.html">DescribeServiceDeployments</a> and inspecting the <code>lifecycleHookDetails</code> field of the service deployment.</p>
action: <p>The action to take on the paused lifecycle hook. Valid values are:</p> <ul> <li> <p> <code>CONTINUE</code> - Proceeds the deployment to the next lifecycle stage.</p> </li> <li> <p> <code>ROLLBACK</code> - Rolls back the deployment to the previous service revision.</p> </li> </ul> <p>If no value is specified, the default action is <code>CONTINUE</code>.</p>
Raises:
capo_ecs.errors.access_denied_exception.AccessDeniedException: <p>You don't have authorization to perform the requested action.</p>
capo_ecs.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.</p>
capo_ecs.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter isn't valid. Review the available parameters for the API request.</p> <p>For more information about service event errors, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html">Amazon ECS service event messages</a>. </p>
capo_ecs.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
capo_ecs.errors.service_deployment_not_found_exception.ServiceDeploymentNotFoundException: <p>The service deploy ARN that you specified in the <code>ContinueServiceDeployment</code> doesn't exist. You can use <code>ListServiceDeployments</code> to retrieve the service deployment ARNs.</p>
capo_ecs.errors.unsupported_feature_exception.UnsupportedFeatureException: <p>The specified task isn't supported in this Region.</p>
capo_ecs.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To continue a paused service deployment
This example continues a service deployment that is paused at a lifecycle hook, using the CONTINUE action to proceed to the next deployment stage.
>>> client.continue_service_deployment(service_deployment_arn='arn:aws:ecs:us-east-1:123456789012:service-deployment/MyCluster/MyService/r9i43YFjvgF_xlg7m2eJ1r', hook_id='ecs-pause-Xk7rT2mP9sLwQn4vB8fYd3hJ6gA1cE5iO0uR_ZpWq', action='CONTINUE')
To roll back a paused service deployment
This example rolls back a service deployment that is paused at a lifecycle hook, using the ROLLBACK action to revert to the previous service revision.
>>> client.continue_service_deployment(service_deployment_arn='arn:aws:ecs:us-east-1:123456789012:service-deployment/MyCluster/MyService/r9i43YFjvgF_xlg7m2eJ1r', hook_id='ecs-pause-Xk7rT2mP9sLwQn4vB8fYd3hJ6gA1cE5iO0uR_ZpWq', action='ROLLBACK')
"""
def _handler(
req: "OperationRequest[capo_ecs.types.continue_service_deployment_request.ContinueServiceDeploymentRequest]",
) -> OperationResponse[
"capo_ecs.types.continue_service_deployment_response.ContinueServiceDeploymentResponse"
]:
import capo_ecs._operations.amazon_ec2_container_service_v20141113.continue_service_deployment
output, http_response = (
capo_ecs._operations.amazon_ec2_container_service_v20141113.continue_service_deployment.continue_service_deployment(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ContinueServiceDeployment")
)
input_: capo_ecs.types.continue_service_deployment_request.ContinueServiceDeploymentRequest = {
"service_deployment_arn": service_deployment_arn,
"hook_id": hook_id,
}
if action is not None:
input_["action"] = action
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|