Skip to content

create_provisioning_roles_for_organization async

create_provisioning_roles_for_organization(
    domain_id: DomainId,
    target_account_id: AccountId,
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    space_data_access_role_configuration: Optional[
        SpaceDataAccessRoleConfiguration
    ] = None,
    agent_core_evaluation_role_configuration: Optional[
        AgentCoreEvaluationRoleConfiguration
    ] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateProvisioningRolesForOrganizationOutput

Creates the IAM roles that an organization member account needs before a space can be set up in it: the provisioning role, the space data access role, and the dataset integration role. It also creates an AgentCore evaluation role when agentCoreEvaluationRoleConfiguration is set. The provisioning role is reused when it already exists in the target account. The other roles are created once per clientToken: retrying with the same token and input returns the same roles. The caller must be the organization's management account or a delegated administrator with an access grant on the organization domain. The target account must be an active member of the same organization as the domain, and must not be the management account. Fails with ServiceQuotaExceededException when the target member account already has the maximum number of roles of a type the call creates, or has reached an IAM quota.

Parameters:

  • domain_id (DomainId) –

    The ID of the organization domain.

  • target_account_id (AccountId) –

    The ID of the member account to create the roles in.

  • space_data_access_role_configuration (Optional[SpaceDataAccessRoleConfiguration], default: None ) –

    Settings for the space data access role, which is always created. Omit for the default: only CloudWatchOmniSpaceAccessPolicy is attached.

  • agent_core_evaluation_role_configuration (Optional[AgentCoreEvaluationRoleConfiguration], default: None ) –

    Settings for the AgentCore evaluation role. Omit this to create none.

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

    A unique token that makes retries create a single set of roles. Reusing a token with different input is an error. A concurrent request with the same token returns a ConflictException and can be retried.

Raises:

Examples:

Create the default provisioning role and other roles required to set up an Omni space and enable dataset forwarding in a member account The following example creates the provisioning role, the space data access role, the dataset integration role, and an AgentCore evaluation role in an organization member account. CloudWatchOmniSpaceAccessPolicy is always attached to the space data access role and is not configurable; the example also attaches the optional model inference, DevOps agent, and AWS integration policies to it. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> await client.create_provisioning_roles_for_organization(domain_id='d-1a2b3c4d5e', target_account_id='123456789012', space_data_access_role_configuration={'includePolicies': ['MODEL_INFERENCE', 'DEVOPS_AGENT', 'AWS_INTEGRATION']}, agent_core_evaluation_role_configuration={})
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
async def create_provisioning_roles_for_organization(
    self,
    domain_id: "capo_cloudwatchomni.types.domain_id.DomainId",
    target_account_id: "capo_cloudwatchomni.types.account_id.AccountId",
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    space_data_access_role_configuration: Optional[
        "capo_cloudwatchomni.types.space_data_access_role_configuration.SpaceDataAccessRoleConfiguration"
    ] = None,
    agent_core_evaluation_role_configuration: Optional[
        "capo_cloudwatchomni.types.agent_core_evaluation_role_configuration.AgentCoreEvaluationRoleConfiguration"
    ] = None,
    client_token: Optional[
        "capo_cloudwatchomni.types.client_token.ClientToken"
    ] = None,
) -> "capo_cloudwatchomni.types.create_provisioning_roles_for_organization_output.CreateProvisioningRolesForOrganizationOutput":
    """Creates the IAM roles that an organization member account needs before a space can be set up in it: the provisioning role, the space data access role, and the dataset integration role. It also creates an AgentCore evaluation role when `agentCoreEvaluationRoleConfiguration` is set. The provisioning role is reused when it already exists in the target account. The other roles are created once per `clientToken`: retrying with the same token and input returns the same roles. The caller must be the organization's management account or a delegated administrator with an access grant on the organization domain. The target account must be an active member of the same organization as the domain, and must not be the management account. Fails with ServiceQuotaExceededException when the target member account already has the maximum number of roles of a type the call creates, or has reached an IAM quota.

    Args:
        domain_id: The ID of the organization domain.
        target_account_id: The ID of the member account to create the roles in.
        space_data_access_role_configuration: Settings for the space data access role, which is always created. Omit for the default: only CloudWatchOmniSpaceAccessPolicy is attached.
        agent_core_evaluation_role_configuration: Settings for the AgentCore evaluation role. Omit this to create none.
        client_token: A unique token that makes retries create a single set of roles. Reusing a token with different input is an error. A concurrent request with the same token returns a ConflictException and can be retried.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.conflict_exception.ConflictException: The operation could not be completed because of a conflict with the current state of the resource.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        capo_cloudwatchomni.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: A service quota was exceeded.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create the default provisioning role and other roles required to set up an Omni space and enable dataset forwarding in a member account
        The following example creates the provisioning role, the space data access role, the dataset integration role, and an AgentCore evaluation role in an organization member account. CloudWatchOmniSpaceAccessPolicy is always attached to the space data access role and is not configurable; the example also attaches the optional model inference, DevOps agent, and AWS integration policies to it. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.create_provisioning_roles_for_organization(domain_id='d-1a2b3c4d5e', target_account_id='123456789012', space_data_access_role_configuration={'includePolicies': ['MODEL_INFERENCE', 'DEVOPS_AGENT', 'AWS_INTEGRATION']}, agent_core_evaluation_role_configuration={})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatchomni.types.create_provisioning_roles_for_organization_input.CreateProvisioningRolesForOrganizationInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatchomni.types.create_provisioning_roles_for_organization_output.CreateProvisioningRolesForOrganizationOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.create_provisioning_roles_for_organization

        (
            output,
            http_response,
        ) = await capo_cloudwatchomni._operations.cloud_watch_omni_frontend.create_provisioning_roles_for_organization.async_create_provisioning_roles_for_organization(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateProvisioningRolesForOrganization")
    )
    input_: capo_cloudwatchomni.types.create_provisioning_roles_for_organization_input.CreateProvisioningRolesForOrganizationInput = {
        "domain_id": domain_id,
        "target_account_id": target_account_id,
    }
    if space_data_access_role_configuration is not None:
        input_["space_data_access_role_configuration"] = (
            space_data_access_role_configuration
        )
    if agent_core_evaluation_role_configuration is not None:
        input_["agent_core_evaluation_role_configuration"] = (
            agent_core_evaluation_role_configuration
        )
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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