Skip to content

update_component

update_component(
    name: ResourceName,
    deployment_type: ComponentDeploymentUpdateType,
    *,
    config_overrides: Optional[ProtonClientConfig] = None,
    description: Optional[Description] = None,
    service_name: Optional[ResourceNameOrEmpty] = None,
    service_instance_name: Optional[ResourceNameOrEmpty] = None,
    service_spec: Optional[SpecContents] = None,
    template_file: Optional[TemplateFileContents] = None,
    client_token: Optional[ClientToken] = None,
) -> UpdateComponentOutput

Update a component.

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

You can't update a component while its deployment status, or the deployment status of a service instance 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 component to update.

  • deployment_type (ComponentDeploymentUpdateType) –

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

    NONE

    In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated. You can only specify description in this mode.

    CURRENT_VERSION

    In this mode, the component is deployed and updated with the new serviceSpec, templateSource, and/or type that you provide. Only requested parameters are updated.

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

    An optional customer-provided description of the component.

  • service_name (Optional[ResourceNameOrEmpty], default: None ) –

    The name of the service that serviceInstanceName is associated with. Don't specify to keep the component's current service instance attachment. Specify an empty string to detach the component from the service instance it's attached to. Specify non-empty values for both serviceInstanceName and serviceName or for neither of them.

  • service_instance_name (Optional[ResourceNameOrEmpty], default: None ) –

    The name of the service instance that you want to attach this component to. Don't specify to keep the component's current service instance attachment. Specify an empty string to detach the component from the service instance it's attached to. Specify non-empty values for both serviceInstanceName and serviceName or for neither of them.

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

    The service spec that you want the component to use to access service inputs. Set this only when the component is attached to a service instance.

  • template_file (Optional[TemplateFileContents], default: None ) –

    A path to the Infrastructure as Code (IaC) file describing infrastructure that a custom component provisions.

    Components support a single IaC file, even if you use Terraform as your template language.

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

    The client token for the updated component.

Raises:

Source code in docs_src/capo_proton/_services/proton.py
def update_component(
    self,
    name: "capo_proton.types.resource_name.ResourceName",
    deployment_type: "capo_proton.types.component_deployment_update_type.ComponentDeploymentUpdateType",
    *,
    config_overrides: Optional[ProtonClientConfig] = None,
    description: Optional["capo_proton.types.description.Description"] = None,
    service_name: Optional[
        "capo_proton.types.resource_name_or_empty.ResourceNameOrEmpty"
    ] = None,
    service_instance_name: Optional[
        "capo_proton.types.resource_name_or_empty.ResourceNameOrEmpty"
    ] = None,
    service_spec: Optional["capo_proton.types.spec_contents.SpecContents"] = None,
    template_file: Optional[
        "capo_proton.types.template_file_contents.TemplateFileContents"
    ] = None,
    client_token: Optional["capo_proton.types.client_token.ClientToken"] = None,
) -> "capo_proton.types.update_component_output.UpdateComponentOutput":
    """<p>Update a component.</p> <p>There are a few modes for updating a component. The <code>deploymentType</code> field defines the mode.</p> <note> <p>You can't update a component while its deployment status, or the deployment status of a service instance attached to it, is <code>IN_PROGRESS</code>.</p> </note> <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>

    Args:
        name: <p>The name of the component to update.</p>
        deployment_type: <p>The deployment type. It defines the mode for updating a component, 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. You can only specify <code>description</code> in this mode.</p> </dd> <dt/> <dd> <p> <code>CURRENT_VERSION</code> </p> <p>In this mode, the component is deployed and updated with the new <code>serviceSpec</code>, <code>templateSource</code>, and/or <code>type</code> that you provide. Only requested parameters are updated.</p> </dd> </dl>
        description: <p>An optional customer-provided description of the component.</p>
        service_name: <p>The name of the service that <code>serviceInstanceName</code> is associated with. Don't specify to keep the component's current service instance attachment. Specify an empty string to detach the component from the service instance it's attached to. Specify non-empty values for both <code>serviceInstanceName</code> and <code>serviceName</code> or for neither of them.</p>
        service_instance_name: <p>The name of the service instance that you want to attach this component to. Don't specify to keep the component's current service instance attachment. Specify an empty string to detach the component from the service instance it's attached to. Specify non-empty values for both <code>serviceInstanceName</code> and <code>serviceName</code> or for neither of them.</p>
        service_spec: <p>The service spec that you want the component to use to access service inputs. Set this only when the component is attached to a service instance.</p>
        template_file: <p>A path to the Infrastructure as Code (IaC) file describing infrastructure that a custom component provisions.</p> <note> <p>Components support a single IaC file, even if you use Terraform as your template language.</p> </note>
        client_token: <p>The client token for the updated component.</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_component_input.UpdateComponentInput]",
    ) -> OperationResponse[
        "capo_proton.types.update_component_output.UpdateComponentOutput"
    ]:
        import capo_proton._operations.aws_proton20200720.update_component

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

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

        return capo_proton.types.update_component_input.redact_sensitive(input_)

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

        return capo_proton.types.update_component_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateComponent",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_proton.types.update_component_input.UpdateComponentInput = {
        "name": name,
        "deployment_type": deployment_type,
    }
    if description is not None:
        input_["description"] = description
    if service_name is not None:
        input_["service_name"] = service_name
    if service_instance_name is not None:
        input_["service_instance_name"] = service_instance_name
    if service_spec is not None:
        input_["service_spec"] = service_spec
    if template_file is not None:
        input_["template_file"] = template_file
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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