Skip to content

update_environment

update_environment(
    environment_arn: EnvironmentArn,
    *,
    config_overrides: Optional[AssuranceClientConfig] = None,
    description: Optional[EnvironmentDescription] = None,
    identity_store: Optional[IdentityStoreUpdate] = None,
    operator_role: Optional[IamRoleArn] = None,
    kms_key_arn: Optional[OptionalKmsKeyArn] = None,
    regions: Optional[RegionList] = None,
    environment_scope: Optional[EnvironmentScope] = None,
    organizational_unit_ids: Optional[OrganizationalUnitIdsUpdate] = None,
) -> UpdateEnvironmentOutput

Updates a governance environment.

Parameters:

  • environment_arn (EnvironmentArn) –

    The ARN of this governance environment.

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

    A description of the environment.

  • identity_store (Optional[IdentityStoreUpdate], default: None ) –

    The update to the identity store configuration. You can provide a new configuration or disable the identity store.

  • operator_role (Optional[IamRoleArn], default: None ) –

    The IAM role that AWS Assurance assumes to issue temporary credentials to operators who use your application. The role's trust policy must allow the AWS Assurance service principal to call sts:AssumeRole.

  • kms_key_arn (Optional[OptionalKmsKeyArn], default: None ) –

    The ARN of the AWS KMS key that encrypts evidence. To change the key, specify a new ARN. To remove the key, specify an empty string.

  • regions (Optional[RegionList], default: None ) –

    The AWS Regions to evaluate across. Replaces existing list. Send empty list to revert to all generally available Regions in the partition.

  • environment_scope (Optional[EnvironmentScope], default: None ) –

    The set of AWS accounts this environment evaluates.

    ORGANIZATION: convert the environment into an organization environment. Only valid when the environment is owned by the organization's management account and AWS Organizations trusted access for AWS Assurance is enabled; you must be in that organization. Idempotent when the scope is already ORGANIZATION.

    SINGLE_ACCOUNT: revert the environment to evaluating only its own account. This operation is idempotent when the scope is already SINGLE_ACCOUNT. After this change, the environment no longer evaluates organization member accounts.

    null or omitted: leaves the environment's scope unchanged.

  • organizational_unit_ids (Optional[OrganizationalUnitIdsUpdate], default: None ) –

    The replacement organizational unit scope for the environment. Provide a replacement list of organizational units, or set cleared to evaluate the entire organization. Only valid on an organization environment, or together with a scope change to ORGANIZATION. Null or omitted leaves organizational unit scoping unchanged.

Raises:

Examples:

Update a governance environment Updates the description of the payments team's governance environment.

>>> client.update_environment(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', description="Governance environment for the payments team's PCI-DSS assessment (Q1 scope).")
Source code in docs_src/capo_assurance/_services/assurance.py
def update_environment(
    self,
    environment_arn: "capo_assurance.types.environment_arn.EnvironmentArn",
    *,
    config_overrides: Optional[AssuranceClientConfig] = None,
    description: Optional[
        "capo_assurance.types.environment_description.EnvironmentDescription"
    ] = None,
    identity_store: Optional[
        "capo_assurance.types.identity_store_update.IdentityStoreUpdate"
    ] = None,
    operator_role: Optional["capo_assurance.types.iam_role_arn.IamRoleArn"] = None,
    kms_key_arn: Optional[
        "capo_assurance.types.optional_kms_key_arn.OptionalKmsKeyArn"
    ] = None,
    regions: Optional["capo_assurance.types.region_list.RegionList"] = None,
    environment_scope: Optional[
        "capo_assurance.types.environment_scope.EnvironmentScope"
    ] = None,
    organizational_unit_ids: Optional[
        "capo_assurance.types.organizational_unit_ids_update.OrganizationalUnitIdsUpdate"
    ] = None,
) -> "capo_assurance.types.update_environment_output.UpdateEnvironmentOutput":
    """<p>Updates a governance environment.</p>

    Args:
        environment_arn: <p>The ARN of this governance environment.</p>
        description: <p>A description of the environment.</p>
        identity_store: <p>The update to the identity store configuration. You can provide a new configuration or disable the identity store.</p>
        operator_role: <p>The IAM role that AWS Assurance assumes to issue temporary credentials to operators who use your application. The role's trust policy must allow the AWS Assurance service principal to call <code>sts:AssumeRole</code>.</p>
        kms_key_arn: <p>The ARN of the AWS KMS key that encrypts evidence. To change the key, specify a new ARN. To remove the key, specify an empty string.</p>
        regions: <p>The AWS Regions to evaluate across. Replaces existing list. Send empty list to revert to all generally available Regions in the partition.</p>
        environment_scope: <p>The set of AWS accounts this environment evaluates.</p> <p>ORGANIZATION: convert the environment into an organization environment. Only valid when the environment is owned by the organization's management account and AWS Organizations trusted access for AWS Assurance is enabled; you must be in that organization. Idempotent when the scope is already ORGANIZATION.</p> <p>SINGLE_ACCOUNT: revert the environment to evaluating only its own account. This operation is idempotent when the scope is already SINGLE_ACCOUNT. After this change, the environment no longer evaluates organization member accounts.</p> <p>null or omitted: leaves the environment's scope unchanged.</p>
        organizational_unit_ids: <p>The replacement organizational unit scope for the environment. Provide a replacement list of organizational units, or set cleared to evaluate the entire organization. Only valid on an organization environment, or together with a scope change to ORGANIZATION. Null or omitted leaves organizational unit scoping unchanged.</p>

    Raises:
        capo_assurance.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. This error occurs when the request is unauthenticated, or is authenticated but lacks permission to invoke the operation.</p>
        capo_assurance.errors.conflict_exception.ConflictException: <p>A conflict occurred (for example, resource already exists).</p>
        capo_assurance.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred.</p>
        capo_assurance.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_assurance.errors.throttling_exception.ThrottlingException: <p>The request was throttled.</p>
        capo_assurance.errors.validation_exception.ValidationException: <p>The request failed validation.</p>
        capo_assurance.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Update a governance environment
        Updates the description of the payments team's governance environment.

        >>> client.update_environment(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', description="Governance environment for the payments team's PCI-DSS assessment (Q1 scope).")
    """

    def _handler(
        req: "OperationRequest[capo_assurance.types.update_environment_input.UpdateEnvironmentInput]",
    ) -> OperationResponse[
        "capo_assurance.types.update_environment_output.UpdateEnvironmentOutput"
    ]:
        import capo_assurance._operations.assurance.update_environment

        output, http_response = (
            capo_assurance._operations.assurance.update_environment.update_environment(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateEnvironment")
    )
    input_: capo_assurance.types.update_environment_input.UpdateEnvironmentInput = {
        "environment_arn": environment_arn
    }
    if description is not None:
        input_["description"] = description
    if identity_store is not None:
        input_["identity_store"] = identity_store
    if operator_role is not None:
        input_["operator_role"] = operator_role
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if regions is not None:
        input_["regions"] = regions
    if environment_scope is not None:
        input_["environment_scope"] = environment_scope
    if organizational_unit_ids is not None:
        input_["organizational_unit_ids"] = organizational_unit_ids

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