Skip to content

update_environment async

update_environment(
    name: ResourceName,
    deployment_type: DeploymentUpdateType,
    *,
    config_overrides: Optional[AsyncProtonClientConfig] = None,
    description: Optional[Description] = None,
    spec: Optional[SpecContents] = None,
    template_major_version: Optional[TemplateVersionPart] = None,
    template_minor_version: Optional[TemplateVersionPart] = None,
    proton_service_role_arn: Optional[Arn] = None,
    environment_account_connection_id: Optional[EnvironmentAccountConnectionId] = None,
    provisioning_repository: Optional[RepositoryBranchInput] = None,
    component_role_arn: Optional[RoleArn] = None,
    codebuild_role_arn: Optional[RoleArn] = None,
) -> UpdateEnvironmentOutput

Update an environment.

If the environment is associated with an environment account connection, don't update or include the protonServiceRoleArn and provisioningRepository parameter to update or connect to an environment account connection.

You can only update to a new environment account connection if that connection was created in the same environment account that the current environment account connection was created in. The account connection must also be associated with the current environment.

If the environment isn't associated with an environment account connection, don't update or include the environmentAccountConnectionId parameter. You can't update or connect the environment to an environment account connection if it isn't already associated with an environment connection.

You can update either the environmentAccountConnectionId or protonServiceRoleArn parameter and value. You can’t update both.

If the environment was configured for Amazon Web Services-managed provisioning, omit the provisioningRepository parameter.

If the environment was configured for self-managed provisioning, specify the provisioningRepository parameter and omit the protonServiceRoleArn and environmentAccountConnectionId parameters.

For more information, see Environments and Provisioning methods in the Proton User Guide.

There are four modes for updating an environment. The deploymentType field defines the mode.

NONE

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

CURRENT_VERSION

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

MINOR_VERSION

In this mode, the environment 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 environment is deployed and updated with the published, recommended (latest) major and minor version of the current template, by default. You can also specify a different major version that's higher than the major version in use and a minor version.

Parameters:

  • name (ResourceName) –

    The name of the environment to update.

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

    A description of the environment update.

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

    The formatted specification that defines the update.

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

    The major version of the environment to update.

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

    The minor version of the environment to update.

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

    The Amazon Resource Name (ARN) of the Proton service role that allows Proton to make API calls to other services your behalf.

  • deployment_type (DeploymentUpdateType) –

    There are four modes for updating an environment. The deploymentType field defines the mode.

    NONE

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

    CURRENT_VERSION

    In this mode, the environment 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 environment 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 environment is deployed and updated with the published, recommended (latest) major and minor version of the current template, by default. You can also specify a different major version that is higher than the major version in use and a minor version (optional).

  • environment_account_connection_id (Optional[EnvironmentAccountConnectionId], default: None ) –

    The ID of the environment account connection.

    You can only update to a new environment account connection if it was created in the same environment account that the current environment account connection was created in and is associated with the current environment.

  • provisioning_repository (Optional[RepositoryBranchInput], default: None ) –

    The linked repository that you use to host your rendered infrastructure templates for self-managed provisioning. A linked repository is a repository that has been registered with Proton. For more information, see CreateRepository.

  • component_role_arn (Optional[RoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM service role that Proton uses when provisioning directly defined components in this environment. It determines the scope of infrastructure that a component can provision.

    The environment must have a componentRoleArn to allow directly defined components to be associated with the environment.

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

  • codebuild_role_arn (Optional[RoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM service role that allows Proton to provision infrastructure using CodeBuild-based provisioning on your behalf.

Raises:

Source code in docs_src/capo_proton/_services/async_proton.py
async def update_environment(
    self,
    name: "capo_proton.types.resource_name.ResourceName",
    deployment_type: "capo_proton.types.deployment_update_type.DeploymentUpdateType",
    *,
    config_overrides: Optional[AsyncProtonClientConfig] = None,
    description: Optional["capo_proton.types.description.Description"] = 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,
    proton_service_role_arn: Optional["capo_proton.types.arn.Arn"] = None,
    environment_account_connection_id: Optional[
        "capo_proton.types.environment_account_connection_id.EnvironmentAccountConnectionId"
    ] = None,
    provisioning_repository: Optional[
        "capo_proton.types.repository_branch_input.RepositoryBranchInput"
    ] = None,
    component_role_arn: Optional["capo_proton.types.role_arn.RoleArn"] = None,
    codebuild_role_arn: Optional["capo_proton.types.role_arn.RoleArn"] = None,
) -> "capo_proton.types.update_environment_output.UpdateEnvironmentOutput":
    """<p>Update an environment.</p> <p>If the environment is associated with an environment account connection, <i>don't</i> update or include the <code>protonServiceRoleArn</code> and <code>provisioningRepository</code> parameter to update or connect to an environment account connection.</p> <p>You can only update to a new environment account connection if that connection was created in the same environment account that the current environment account connection was created in. The account connection must also be associated with the current environment.</p> <p>If the environment <i>isn't</i> associated with an environment account connection, <i>don't</i> update or include the <code>environmentAccountConnectionId</code> parameter. You <i>can't</i> update or connect the environment to an environment account connection if it <i>isn't</i> already associated with an environment connection.</p> <p>You can update either the <code>environmentAccountConnectionId</code> or <code>protonServiceRoleArn</code> parameter and value. You can’t update both.</p> <p>If the environment was configured for Amazon Web Services-managed provisioning, omit the <code>provisioningRepository</code> parameter.</p> <p>If the environment was configured for self-managed provisioning, specify the <code>provisioningRepository</code> parameter and omit the <code>protonServiceRoleArn</code> and <code>environmentAccountConnectionId</code> parameters.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-environments.html">Environments</a> and <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-works-prov-methods.html">Provisioning methods</a> in the <i>Proton User Guide</i>.</p> <p>There are four modes for updating an environment. The <code>deploymentType</code> field defines the mode.</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 environment is deployed and updated with the new spec that you provide. Only requested parameters are updated. <i>Don’t</i> include minor or major version parameters when you use this <code>deployment-type</code>.</p> </dd> <dt/> <dd> <p> <code>MINOR_VERSION</code> </p> <p>In this mode, the environment 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 environment is deployed and updated with the published, recommended (latest) major and minor version of the current template, by default. You can also specify a different major version that's higher than the major version in use and a minor version.</p> </dd> </dl>

    Args:
        name: <p>The name of the environment to update.</p>
        description: <p>A description of the environment update.</p>
        spec: <p>The formatted specification that defines the update.</p>
        template_major_version: <p>The major version of the environment to update.</p>
        template_minor_version: <p>The minor version of the environment to update.</p>
        proton_service_role_arn: <p>The Amazon Resource Name (ARN) of the Proton service role that allows Proton to make API calls to other services your behalf.</p>
        deployment_type: <p>There are four modes for updating an environment. The <code>deploymentType</code> field defines the mode.</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 environment 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 <code>deployment-type</code>.</p> </dd> <dt/> <dd> <p> <code>MINOR_VERSION</code> </p> <p>In this mode, the environment 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 environment is deployed and updated with the published, recommended (latest) major and minor version of the current template, by default. You can also specify a different major version that is higher than the major version in use and a minor version (optional).</p> </dd> </dl>
        environment_account_connection_id: <p>The ID of the environment account connection.</p> <p>You can only update to a new environment account connection if it was created in the same environment account that the current environment account connection was created in and is associated with the current environment.</p>
        provisioning_repository: <p>The linked repository that you use to host your rendered infrastructure templates for self-managed provisioning. A linked repository is a repository that has been registered with Proton. For more information, see <a>CreateRepository</a>.</p>
        component_role_arn: <p>The Amazon Resource Name (ARN) of the IAM service role that Proton uses when provisioning directly defined components in this environment. It determines the scope of infrastructure that a component can provision.</p> <p>The environment must have a <code>componentRoleArn</code> to allow directly defined components to be associated with the environment.</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>
        codebuild_role_arn: <p>The Amazon Resource Name (ARN) of the IAM service role that allows Proton to provision infrastructure using CodeBuild-based provisioning on your behalf.</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_environment_input.UpdateEnvironmentInput]",
    ) -> AsyncOperationResponse[
        "capo_proton.types.update_environment_output.UpdateEnvironmentOutput"
    ]:
        import capo_proton._operations.aws_proton20200720.update_environment

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

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

        return capo_proton.types.update_environment_input.redact_sensitive(input_)

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

        return capo_proton.types.update_environment_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateEnvironment",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_proton.types.update_environment_input.UpdateEnvironmentInput = {
        "name": name,
        "deployment_type": deployment_type,
    }
    if description is not None:
        input_["description"] = description
    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 proton_service_role_arn is not None:
        input_["proton_service_role_arn"] = proton_service_role_arn
    if environment_account_connection_id is not None:
        input_["environment_account_connection_id"] = (
            environment_account_connection_id
        )
    if provisioning_repository is not None:
        input_["provisioning_repository"] = provisioning_repository
    if component_role_arn is not None:
        input_["component_role_arn"] = component_role_arn
    if codebuild_role_arn is not None:
        input_["codebuild_role_arn"] = codebuild_role_arn

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