Skip to content

create_service_template_version

create_service_template_version(
    template_name: ResourceName,
    source: TemplateVersionSourceInput,
    compatible_environment_templates: CompatibleEnvironmentTemplateInputList,
    *,
    config_overrides: Optional[ProtonClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    description: Optional[Description] = None,
    major_version: Optional[TemplateVersionPart] = None,
    tags: Optional[TagList] = None,
    supported_component_sources: Optional[
        ServiceTemplateSupportedComponentSourceInputList
    ] = None,
) -> CreateServiceTemplateVersionOutput

Create a new major or minor version of a service template. A major version of a service template is a version that isn't backward compatible. A minor version of a service template is a version that's backward compatible within its major version.

Parameters:

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

    When included, if two identical requests are made with the same client token, Proton returns the service template version that the first request created.

  • template_name (ResourceName) –

    The name of the service template.

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

    A description of the new version of a service template.

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

    To create a new minor version of the service template, include a major Version.

    To create a new major and minor version of the service template, exclude major Version.

  • source (TemplateVersionSourceInput) –

    An object that includes the template bundle S3 bucket path and name for the new version of a service template.

  • compatible_environment_templates (CompatibleEnvironmentTemplateInputList) –

    An array of environment template objects that are compatible with the new service template version. A service instance based on this service template version can run in environments based on compatible templates.

  • tags (Optional[TagList], default: None ) –

    An optional list of metadata items that you can associate with the Proton service template version. A tag is a key-value pair.

    For more information, see Proton resources and tagging in the Proton User Guide.

  • supported_component_sources (Optional[ServiceTemplateSupportedComponentSourceInputList], default: None ) –

    An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.

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

Raises:

Source code in docs_src/capo_proton/_services/proton.py
def create_service_template_version(
    self,
    template_name: "capo_proton.types.resource_name.ResourceName",
    source: "capo_proton.types.template_version_source_input.TemplateVersionSourceInput",
    compatible_environment_templates: "capo_proton.types.compatible_environment_template_input_list.CompatibleEnvironmentTemplateInputList",
    *,
    config_overrides: Optional[ProtonClientConfig] = None,
    client_token: Optional["capo_proton.types.client_token.ClientToken"] = None,
    description: Optional["capo_proton.types.description.Description"] = None,
    major_version: Optional[
        "capo_proton.types.template_version_part.TemplateVersionPart"
    ] = None,
    tags: Optional["capo_proton.types.tag_list.TagList"] = None,
    supported_component_sources: Optional[
        "capo_proton.types.service_template_supported_component_source_input_list.ServiceTemplateSupportedComponentSourceInputList"
    ] = None,
) -> "capo_proton.types.create_service_template_version_output.CreateServiceTemplateVersionOutput":
    """<p>Create a new major or minor version of a service template. A major version of a service template is a version that <i>isn't</i> backward compatible. A minor version of a service template is a version that's backward compatible within its major version.</p>

    Args:
        client_token: <p>When included, if two identical requests are made with the same client token, Proton returns the service template version that the first request created.</p>
        template_name: <p>The name of the service template.</p>
        description: <p>A description of the new version of a service template.</p>
        major_version: <p>To create a new minor version of the service template, include a <code>major Version</code>.</p> <p>To create a new major and minor version of the service template, <i>exclude</i> <code>major Version</code>.</p>
        source: <p>An object that includes the template bundle S3 bucket path and name for the new version of a service template.</p>
        compatible_environment_templates: <p>An array of environment template objects that are compatible with the new service template version. A service instance based on this service template version can run in environments based on compatible templates.</p>
        tags: <p>An optional list of metadata items that you can associate with the Proton service template version. A tag is a key-value pair.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/resources.html">Proton resources and tagging</a> in the <i>Proton User Guide</i>.</p>
        supported_component_sources: <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</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>

    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.create_service_template_version_input.CreateServiceTemplateVersionInput]",
    ) -> OperationResponse[
        "capo_proton.types.create_service_template_version_output.CreateServiceTemplateVersionOutput"
    ]:
        import capo_proton._operations.aws_proton20200720.create_service_template_version

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

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

        return capo_proton.types.create_service_template_version_input.redact_sensitive(
            input_
        )

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

        return capo_proton.types.create_service_template_version_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateServiceTemplateVersion",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_proton.types.create_service_template_version_input.CreateServiceTemplateVersionInput = {
        "template_name": template_name,
        "source": source,
        "compatible_environment_templates": compatible_environment_templates,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description
    if major_version is not None:
        input_["major_version"] = major_version
    if tags is not None:
        input_["tags"] = tags
    if supported_component_sources is not None:
        input_["supported_component_sources"] = supported_component_sources

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