Skip to content

create_instance async

create_instance(
    *,
    config_overrides: Optional[AsyncSSOAdminClientConfig] = None,
    name: Optional[NameType] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagList] = None,
) -> CreateInstanceResponse

Creates an instance of IAM Identity Center for a standalone Amazon Web Services account that is not managed by Organizations or a member Amazon Web Services account in an organization. You can create only one instance per account and across all Amazon Web Services Regions.

The CreateInstance request is rejected if the following apply:

  • The instance is created within the organization management account.

  • An instance already exists in the same account.

Parameters:

  • name (Optional[NameType], default: None ) –

    The name of the instance of IAM Identity Center.

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

    Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value.

    If you don't provide this value, then Amazon Web Services generates a random one for you.

    If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an IdempotentParameterMismatch error.

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

    Specifies tags to be attached to the instance of IAM Identity Center.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    Occurs when a conflict with a previous successful write is detected. This generally occurs when the previous write did not have time to propagate to the host serving the current request. A retry (with appropriate backoff logic) is the recommended response to this exception.

  • InternalServerException –

    The request processing has failed because of an unknown error, exception, or failure with an internal server.

  • ServiceQuotaExceededException –

    Indicates that the principal has crossed the permitted number of resources that can be created.

  • ThrottlingException –

    Indicates that the principal has crossed the throttling limits of the API operations.

  • ValidationException –

    The request failed because it contains a syntax error.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sso_admin/_services/async_sso_admin.py
async def create_instance(
    self,
    *,
    config_overrides: Optional[AsyncSSOAdminClientConfig] = None,
    name: Optional["capo_sso_admin.types.name_type.NameType"] = None,
    client_token: Optional["capo_sso_admin.types.client_token.ClientToken"] = None,
    tags: Optional["capo_sso_admin.types.tag_list.TagList"] = None,
) -> "capo_sso_admin.types.create_instance_response.CreateInstanceResponse":
    """<p>Creates an instance of IAM Identity Center for a standalone Amazon Web Services account that is not managed by Organizations or a member Amazon Web Services account in an organization. You can create only one instance per account and across all Amazon Web Services Regions.</p> <p>The CreateInstance request is rejected if the following apply: </p> <ul> <li> <p>The instance is created within the organization management account.</p> </li> <li> <p>An instance already exists in the same account.</p> </li> </ul>

    Args:
        name: <p>The name of the instance of IAM Identity Center.</p>
        client_token: <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value</a>.</p> <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p> <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
        tags: <p>Specifies tags to be attached to the instance of IAM Identity Center.</p>

    Raises:
        capo_sso_admin.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_sso_admin.errors.conflict_exception.ConflictException: <p>Occurs when a conflict with a previous successful write is detected. This generally occurs when the previous write did not have time to propagate to the host serving the current request. A retry (with appropriate backoff logic) is the recommended response to this exception.</p>
        capo_sso_admin.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception, or failure with an internal server.</p>
        capo_sso_admin.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Indicates that the principal has crossed the permitted number of resources that can be created.</p>
        capo_sso_admin.errors.throttling_exception.ThrottlingException: <p>Indicates that the principal has crossed the throttling limits of the API operations.</p>
        capo_sso_admin.errors.validation_exception.ValidationException: <p>The request failed because it contains a syntax error.</p>
        capo_sso_admin.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sso_admin.types.create_instance_request.CreateInstanceRequest]",
    ) -> AsyncOperationResponse[
        "capo_sso_admin.types.create_instance_response.CreateInstanceResponse"
    ]:
        import capo_sso_admin._operations.swb_external_service.create_instance

        (
            output,
            http_response,
        ) = await capo_sso_admin._operations.swb_external_service.create_instance.async_create_instance(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateInstance")
    )
    input_: capo_sso_admin.types.create_instance_request.CreateInstanceRequest = {}
    if name is not None:
        input_["name"] = name
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

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