Skip to content

update_service

update_service(
    name: ResourceName,
    *,
    config_overrides: Optional[ProtonClientConfig] = None,
    description: Optional[Description] = None,
    spec: Optional[SpecContents] = None,
) -> UpdateServiceOutput

Edit a service description or use a spec to add and delete service instances.

Existing service instances and the service pipeline can't be edited using this API. They can only be deleted.

Use the description parameter to modify the description.

Edit the spec parameter to add or delete instances.

You can't delete a service instance (remove it from the spec) if it has an attached component.

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

Parameters:

  • name (ResourceName) –

    The name of the service to edit.

  • description (Optional[Description], default: None ) –

    The edited service description.

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

    Lists the service instances to add and the existing service instances to remain. Omit the existing service instances to delete from the list. Don't include edits to the existing service instances or pipeline. For more information, see Edit a service in the Proton User Guide.

Raises:

Source code in docs_src/capo_proton/_services/proton.py
def update_service(
    self,
    name: "capo_proton.types.resource_name.ResourceName",
    *,
    config_overrides: Optional[ProtonClientConfig] = None,
    description: Optional["capo_proton.types.description.Description"] = None,
    spec: Optional["capo_proton.types.spec_contents.SpecContents"] = None,
) -> "capo_proton.types.update_service_output.UpdateServiceOutput":
    """<p>Edit a service description or use a spec to add and delete service instances.</p> <note> <p>Existing service instances and the service pipeline <i>can't</i> be edited using this API. They can only be deleted.</p> </note> <p>Use the <code>description</code> parameter to modify the description.</p> <p>Edit the <code>spec</code> parameter to add or delete instances.</p> <note> <p>You can't delete a service instance (remove it from the spec) if it has an attached component.</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 to edit.</p>
        description: <p>The edited service description.</p>
        spec: <p>Lists the service instances to add and the existing service instances to remain. Omit the existing service instances to delete from the list. <i>Don't</i> include edits to the existing service instances or pipeline. For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-svc-update.html">Edit a service</a> in the <i>Proton User Guide</i>.</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.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>A quota was exceeded. For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-limits.html">Proton Quotas</a> in the <i>Proton User Guide</i>.</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.
    """

    def _handler(
        req: "OperationRequest[capo_proton.types.update_service_input.UpdateServiceInput]",
    ) -> OperationResponse[
        "capo_proton.types.update_service_output.UpdateServiceOutput"
    ]:
        import capo_proton._operations.aws_proton20200720.update_service

        output, http_response = (
            capo_proton._operations.aws_proton20200720.update_service.update_service(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_proton.types.update_service_input.redact_sensitive(input_)

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

        return capo_proton.types.update_service_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateService",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_proton.types.update_service_input.UpdateServiceInput = {
        "name": name
    }
    if description is not None:
        input_["description"] = description
    if spec is not None:
        input_["spec"] = spec

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output