Skip to content

put_organization_enrollment_configuration

put_organization_enrollment_configuration(
    target: OrganizationTarget,
    *,
    config_overrides: Optional[ComputeOptimizerAutomationClientConfig] = None,
    organization_rule_mode: Optional[OrganizationRuleMode] = None,
    client_token: Optional[ClientToken] = None,
) -> PutOrganizationEnrollmentConfigurationResponse

Creates or updates an organization enrollment configuration. The organization enrollment configuration sets the organization rule mode on the specified account, organizational unit (OU), or organization root and enables Automation for affected member accounts that have opted in to Compute Optimizer, including accounts that join later. Changes on an OU or the organization root can take up to 5 minutes. Organization enrollment configurations take precedence over settings made by AssociateAccounts and DisassociateAccounts. You must specify at least one configuration in the request.

Only the management account or a delegated administrator can perform this action.

Organization enrollment configurations can't be created for the management account.

Parameters:

  • target (OrganizationTarget) –

    The account, organizational unit (OU), or organization root on which to create or update the organization enrollment configuration. You can't specify the management account.

  • organization_rule_mode (Optional[OrganizationRuleMode], default: None ) –

    The organization rule mode to set on the target. An organization enrollment configuration with either AnyAllowed or NoneAllowed enables Automation for affected member accounts. AnyAllowed permits organization rules to apply to those accounts, while NoneAllowed doesn't.

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

    A unique identifier to ensure idempotency of the request.

Raises:

Source code in docs_src/capo_compute_optimizer_automation/_services/compute_optimizer_automation.py
def put_organization_enrollment_configuration(
    self,
    target: "capo_compute_optimizer_automation.types.organization_target.OrganizationTarget",
    *,
    config_overrides: Optional[ComputeOptimizerAutomationClientConfig] = None,
    organization_rule_mode: Optional[
        "capo_compute_optimizer_automation.types.organization_rule_mode.OrganizationRuleMode"
    ] = None,
    client_token: Optional[
        "capo_compute_optimizer_automation.types.client_token.ClientToken"
    ] = None,
) -> "capo_compute_optimizer_automation.types.put_organization_enrollment_configuration_response.PutOrganizationEnrollmentConfigurationResponse":
    """<p> Creates or updates an organization enrollment configuration. The organization enrollment configuration sets the organization rule mode on the specified account, organizational unit (OU), or organization root and enables Automation for affected member accounts that have opted in to Compute Optimizer, including accounts that join later. Changes on an OU or the organization root can take up to 5 minutes. Organization enrollment configurations take precedence over settings made by <code>AssociateAccounts</code> and <code>DisassociateAccounts</code>. You must specify at least one configuration in the request. </p> <note> <p>Only the management account or a delegated administrator can perform this action.</p> <p>Organization enrollment configurations can't be created for the management account.</p> </note>

    Args:
        target: <p> The account, organizational unit (OU), or organization root on which to create or update the organization enrollment configuration. You can't specify the management account. </p>
        organization_rule_mode: <p> The organization rule mode to set on the target. An organization enrollment configuration with either <code>AnyAllowed</code> or <code>NoneAllowed</code> enables Automation for affected member accounts. <code>AnyAllowed</code> permits organization rules to apply to those accounts, while <code>NoneAllowed</code> doesn't. </p>
        client_token: <p> A unique identifier to ensure idempotency of the request. </p>

    Raises:
        capo_compute_optimizer_automation.errors.access_denied_exception.AccessDeniedException: <p> You do not have sufficient permissions to perform this action. </p>
        capo_compute_optimizer_automation.errors.conflict_exception.ConflictException: <p> The request conflicts with a concurrent change to the same resource. Retry the request. </p>
        capo_compute_optimizer_automation.errors.forbidden_exception.ForbiddenException: <p> You are not authorized to perform this action. </p>
        capo_compute_optimizer_automation.errors.idempotency_token_in_use_exception.IdempotencyTokenInUseException: <p> The specified client token is already in use. </p>
        capo_compute_optimizer_automation.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>Exception thrown when the same client token is used with different parameters, indicating a mismatch in idempotent request parameters.</p>
        capo_compute_optimizer_automation.errors.internal_server_exception.InternalServerException: <p> An internal error occurred while processing the request. </p>
        capo_compute_optimizer_automation.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p> One or more parameter values are not valid. </p>
        capo_compute_optimizer_automation.errors.opt_in_required_exception.OptInRequiredException: <p> The account must be opted in to Compute Optimizer Automation before performing this action. </p>
        capo_compute_optimizer_automation.errors.service_unavailable_exception.ServiceUnavailableException: <p> The service is temporarily unavailable. </p>
        capo_compute_optimizer_automation.errors.throttling_exception.ThrottlingException: <p> The request was denied due to request throttling. </p>
        capo_compute_optimizer_automation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_compute_optimizer_automation.types.put_organization_enrollment_configuration_request.PutOrganizationEnrollmentConfigurationRequest]",
    ) -> OperationResponse[
        "capo_compute_optimizer_automation.types.put_organization_enrollment_configuration_response.PutOrganizationEnrollmentConfigurationResponse"
    ]:
        if req.options.protocol == "awsJson1_0":
            import capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.aws_json1_0.put_organization_enrollment_configuration

            output, http_response = (
                capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.aws_json1_0.put_organization_enrollment_configuration.put_organization_enrollment_configuration(
                    req.options, req.input
                )
            )
        elif req.options.protocol == "rpcv2Cbor":
            import capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.rpcv2_cbor.put_organization_enrollment_configuration

            output, http_response = (
                capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.rpcv2_cbor.put_organization_enrollment_configuration.put_organization_enrollment_configuration(
                    req.options, req.input
                )
            )
        else:
            raise ValueError(f"unknown protocol {req.options.protocol!r}")
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutOrganizationEnrollmentConfiguration")
    )
    input_: capo_compute_optimizer_automation.types.put_organization_enrollment_configuration_request.PutOrganizationEnrollmentConfigurationRequest = {
        "target": target
    }
    if organization_rule_mode is not None:
        input_["organization_rule_mode"] = organization_rule_mode
    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