Skip to content

create_service

create_service(
    name: ResourceName,
    template_name: ResourceName,
    template_major_version: TemplateVersionPart,
    spec: SpecContents,
    *,
    config_overrides: Optional[ProtonClientConfig] = None,
    description: Optional[Description] = None,
    template_minor_version: Optional[TemplateVersionPart] = None,
    repository_connection_arn: Optional[Arn] = None,
    repository_id: Optional[RepositoryId] = None,
    branch_name: Optional[GitBranchName] = None,
    tags: Optional[TagList] = None,
) -> CreateServiceOutput

Create an Proton service. An Proton service is an instantiation of a service template and often includes several service instances and pipeline. For more information, see Services in the Proton User Guide.

Parameters:

  • name (ResourceName) –

    The service name.

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

    A description of the Proton service.

  • template_name (ResourceName) –

    The name of the service template that's used to create the service.

  • template_major_version (TemplateVersionPart) –

    The major version of the service template that was used to create the service.

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

    The minor version of the service template that was used to create the service.

  • spec (SpecContents) –

    A link to a spec file that provides inputs as defined in the service template bundle schema file. The spec file is in YAML format. Don’t include pipeline inputs in the spec if your service template doesn’t include a service pipeline. For more information, see Create a service in the Proton User Guide.

  • repository_connection_arn (Optional[Arn], default: None ) –

    The Amazon Resource Name (ARN) of the repository connection. For more information, see Setting up an AWS CodeStar connection in the Proton User Guide. Don't include this parameter if your service template doesn't include a service pipeline.

  • repository_id (Optional[RepositoryId], default: None ) –

    The ID of the code repository. Don't include this parameter if your service template doesn't include a service pipeline.

  • branch_name (Optional[GitBranchName], default: None ) –

    The name of the code repository branch that holds the code that's deployed in Proton. Don't include this parameter if your service template doesn't include a service pipeline.

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

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

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

Raises:

Source code in docs_src/capo_proton/_services/proton.py
def create_service(
    self,
    name: "capo_proton.types.resource_name.ResourceName",
    template_name: "capo_proton.types.resource_name.ResourceName",
    template_major_version: "capo_proton.types.template_version_part.TemplateVersionPart",
    spec: "capo_proton.types.spec_contents.SpecContents",
    *,
    config_overrides: Optional[ProtonClientConfig] = None,
    description: Optional["capo_proton.types.description.Description"] = None,
    template_minor_version: Optional[
        "capo_proton.types.template_version_part.TemplateVersionPart"
    ] = None,
    repository_connection_arn: Optional["capo_proton.types.arn.Arn"] = None,
    repository_id: Optional["capo_proton.types.repository_id.RepositoryId"] = None,
    branch_name: Optional["capo_proton.types.git_branch_name.GitBranchName"] = None,
    tags: Optional["capo_proton.types.tag_list.TagList"] = None,
) -> "capo_proton.types.create_service_output.CreateServiceOutput":
    """<p>Create an Proton service. An Proton service is an instantiation of a service template and often includes several service instances and pipeline. For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-services.html">Services</a> in the <i>Proton User Guide</i>.</p>

    Args:
        name: <p>The service name.</p>
        description: <p>A description of the Proton service.</p>
        template_name: <p>The name of the service template that's used to create the service.</p>
        template_major_version: <p>The major version of the service template that was used to create the service.</p>
        template_minor_version: <p>The minor version of the service template that was used to create the service.</p>
        spec: <p>A link to a spec file that provides inputs as defined in the service template bundle schema file. The spec file is in YAML format. <i>Don’t</i> include pipeline inputs in the spec if your service template <i>doesn’t</i> include a service pipeline. For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-create-svc.html">Create a service</a> in the <i>Proton User Guide</i>.</p>
        repository_connection_arn: <p>The Amazon Resource Name (ARN) of the repository connection. For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/setting-up-for-service.html#setting-up-vcontrol">Setting up an AWS CodeStar connection</a> in the <i>Proton User Guide</i>. <i>Don't</i> include this parameter if your service template <i>doesn't</i> include a service pipeline.</p>
        repository_id: <p>The ID of the code repository. <i>Don't</i> include this parameter if your service template <i>doesn't</i> include a service pipeline.</p>
        branch_name: <p>The name of the code repository branch that holds the code that's deployed in Proton. <i>Don't</i> include this parameter if your service template <i>doesn't</i> include a service pipeline.</p>
        tags: <p>An optional list of metadata items that you can associate with the Proton service. 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>

    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_input.CreateServiceInput]",
    ) -> OperationResponse[
        "capo_proton.types.create_service_output.CreateServiceOutput"
    ]:
        import capo_proton._operations.aws_proton20200720.create_service

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

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

        return capo_proton.types.create_service_input.redact_sensitive(input_)

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

        return capo_proton.types.create_service_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateService",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_proton.types.create_service_input.CreateServiceInput = {
        "name": name,
        "template_name": template_name,
        "template_major_version": template_major_version,
        "spec": spec,
    }
    if description is not None:
        input_["description"] = description
    if template_minor_version is not None:
        input_["template_minor_version"] = template_minor_version
    if repository_connection_arn is not None:
        input_["repository_connection_arn"] = repository_connection_arn
    if repository_id is not None:
        input_["repository_id"] = repository_id
    if branch_name is not None:
        input_["branch_name"] = branch_name
    if tags is not None:
        input_["tags"] = tags

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