Skip to content

update_service_instance async

update_service_instance(
    name: ResourceName,
    service_name: ResourceName,
    deployment_type: DeploymentUpdateType,
    *,
    config_overrides: Optional[AsyncProtonClientConfig] = None,
    spec: Optional[SpecContents] = None,
    template_major_version: Optional[TemplateVersionPart] = None,
    template_minor_version: Optional[TemplateVersionPart] = None,
    client_token: Optional[ClientToken] = None,
) -> UpdateServiceInstanceOutput

Update a service instance.

There are a few modes for updating a service instance. The deploymentType field defines the mode.

You can't update a service instance while its deployment status, or the deployment status of a component attached to it, is IN_PROGRESS.

For more information about components, see Proton components in the Proton User Guide.

Parameters:

  • name (ResourceName) –

    The name of the service instance to update.

  • service_name (ResourceName) –

    The name of the service that the service instance belongs to.

  • deployment_type (DeploymentUpdateType) –

    The deployment type. It defines the mode for updating a service instance, as follows:

    NONE

    In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.

    CURRENT_VERSION

    In this mode, the service instance is deployed and updated with the new spec that you provide. Only requested parameters are updated. Don’t include major or minor version parameters when you use this deployment type.

    MINOR_VERSION

    In this mode, the service instance is deployed and updated with the published, recommended (latest) minor version of the current major version in use, by default. You can also specify a different minor version of the current major version in use.

    MAJOR_VERSION

    In this mode, the service instance is deployed and updated with the published, recommended (latest) major and minor version of the current template, by default. You can specify a different major version that's higher than the major version in use and a minor version.

  • spec (Optional[SpecContents], default: None ) –

    The formatted specification that defines the service instance update.

  • template_major_version (Optional[TemplateVersionPart], default: None ) –

    The major version of the service template to update.

  • template_minor_version (Optional[TemplateVersionPart], default: None ) –

    The minor version of the service template to update.

  • client_token (Optional[ClientToken], default: None ) –

    The client token of the service instance to update.

Raises:

Source code in docs_src/capo_proton/_services/async_proton.py
async def update_service_instance(
    self,
    name: "capo_proton.types.resource_name.ResourceName",
    service_name: "capo_proton.types.resource_name.ResourceName",
    deployment_type: "capo_proton.types.deployment_update_type.DeploymentUpdateType",
    *,
    config_overrides: Optional[AsyncProtonClientConfig] = None,
    spec: Optional["capo_proton.types.spec_contents.SpecContents"] = None,
    template_major_version: Optional[
        "capo_proton.types.template_version_part.TemplateVersionPart"
    ] = None,
    template_minor_version: Optional[
        "capo_proton.types.template_version_part.TemplateVersionPart"
    ] = None,
    client_token: Optional["capo_proton.types.client_token.ClientToken"] = None,
) -> "capo_proton.types.update_service_instance_output.UpdateServiceInstanceOutput":
    """<p>Update a service instance.</p> <p>There are a few modes for updating a service instance. The <code>deploymentType</code> field defines the mode.</p> <note> <p>You can't update a service instance while its deployment status, or the deployment status of a component attached to it, is <code>IN_PROGRESS</code>.</p> <p>For more information about components, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html">Proton components</a> in the <i>Proton User Guide</i>.</p> </note>

    Args:
        name: <p>The name of the service instance to update.</p>
        service_name: <p>The name of the service that the service instance belongs to.</p>
        deployment_type: <p>The deployment type. It defines the mode for updating a service instance, as follows:</p> <dl> <dt/> <dd> <p> <code>NONE</code> </p> <p>In this mode, a deployment <i>doesn't</i> occur. Only the requested metadata parameters are updated.</p> </dd> <dt/> <dd> <p> <code>CURRENT_VERSION</code> </p> <p>In this mode, the service instance is deployed and updated with the new spec that you provide. Only requested parameters are updated. <i>Don’t</i> include major or minor version parameters when you use this deployment type.</p> </dd> <dt/> <dd> <p> <code>MINOR_VERSION</code> </p> <p>In this mode, the service instance is deployed and updated with the published, recommended (latest) minor version of the current major version in use, by default. You can also specify a different minor version of the current major version in use.</p> </dd> <dt/> <dd> <p> <code>MAJOR_VERSION</code> </p> <p>In this mode, the service instance is deployed and updated with the published, recommended (latest) major and minor version of the current template, by default. You can specify a different major version that's higher than the major version in use and a minor version.</p> </dd> </dl>
        spec: <p>The formatted specification that defines the service instance update.</p>
        template_major_version: <p>The major version of the service template to update.</p>
        template_minor_version: <p>The minor version of the service template to update.</p>
        client_token: <p>The client token of the service instance to update.</p>

    Raises:
        capo_proton.errors.access_denied_exception.AccessDeniedException: <p>There <i>isn't</i> sufficient access for performing this action.</p>
        capo_proton.errors.conflict_exception.ConflictException: <p>The request <i>couldn't</i> be made due to a conflicting operation or resource.</p>
        capo_proton.errors.internal_server_exception.InternalServerException: <p>The request failed to register with the service.</p>
        capo_proton.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource <i>wasn't</i> found.</p>
        capo_proton.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_proton.errors.validation_exception.ValidationException: <p>The input is invalid or an out-of-range value was supplied for the input parameter.</p>
        capo_proton.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_proton.types.update_service_instance_input.UpdateServiceInstanceInput]",
    ) -> AsyncOperationResponse[
        "capo_proton.types.update_service_instance_output.UpdateServiceInstanceOutput"
    ]:
        import capo_proton._operations.aws_proton20200720.update_service_instance

        (
            output,
            http_response,
        ) = await capo_proton._operations.aws_proton20200720.update_service_instance.async_update_service_instance(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_proton.types.update_service_instance_input.UpdateServiceInstanceInput",
    ) -> dict[str, Any]:
        import capo_proton.types.update_service_instance_input

        return capo_proton.types.update_service_instance_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_proton.types.update_service_instance_output.UpdateServiceInstanceOutput",
    ) -> dict[str, Any]:
        import capo_proton.types.update_service_instance_output

        return capo_proton.types.update_service_instance_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateServiceInstance",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_proton.types.update_service_instance_input.UpdateServiceInstanceInput = {
        "name": name,
        "service_name": service_name,
        "deployment_type": deployment_type,
    }
    if spec is not None:
        input_["spec"] = spec
    if template_major_version is not None:
        input_["template_major_version"] = template_major_version
    if template_minor_version is not None:
        input_["template_minor_version"] = template_minor_version
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output