Skip to content

create_api async

create_api(
    name: ApiName,
    event_config: EventConfig,
    *,
    config_overrides: Optional[AsyncAppSyncClientConfig] = None,
    owner_contact: Optional[String] = None,
    tags: Optional[TagMap] = None,
) -> CreateApiResponse

Creates an Api object. Use this operation to create an AppSync API with your preferred configuration, such as an Event API that provides real-time message publishing and message subscriptions over WebSockets.

Parameters:

  • name (ApiName) –

    The name for the Api.

  • owner_contact (Optional[String], default: None ) –

    The owner contact information for the Api.

  • event_config (EventConfig) –

    The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.

Raises:

Source code in docs_src/capo_appsync/_services/async_app_sync.py
async def create_api(
    self,
    name: "capo_appsync.types.api_name.ApiName",
    event_config: "capo_appsync.types.event_config.EventConfig",
    *,
    config_overrides: Optional[AsyncAppSyncClientConfig] = None,
    owner_contact: Optional["capo_appsync.types.string.String"] = None,
    tags: Optional["capo_appsync.types.tag_map.TagMap"] = None,
) -> "capo_appsync.types.create_api_response.CreateApiResponse":
    """<p>Creates an <code>Api</code> object. Use this operation to create an AppSync API with your preferred configuration, such as an Event API that provides real-time message publishing and message subscriptions over WebSockets.</p>

    Args:
        name: <p>The name for the <code>Api</code>.</p>
        owner_contact: <p>The owner contact information for the <code>Api</code>.</p>
        event_config: <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>

    Raises:
        capo_appsync.errors.bad_request_exception.BadRequestException: <p>The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and then try again.</p>
        capo_appsync.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Another modification is in progress at this time and it must complete before you can make your change.</p>
        capo_appsync.errors.internal_failure_exception.InternalFailureException: <p>An internal AppSync error occurred. Try your request again.</p>
        capo_appsync.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The operation exceeded the service quota for this resource.</p>
        capo_appsync.errors.unauthorized_exception.UnauthorizedException: <p>You aren't authorized to perform this operation.</p>
        capo_appsync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_appsync.types.create_api_request.CreateApiRequest]",
    ) -> AsyncOperationResponse[
        "capo_appsync.types.create_api_response.CreateApiResponse"
    ]:
        import capo_appsync._operations.aws_deepdish_control_plane_service.create_api

        (
            output,
            http_response,
        ) = await capo_appsync._operations.aws_deepdish_control_plane_service.create_api.async_create_api(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateApi")
    )
    input_: capo_appsync.types.create_api_request.CreateApiRequest = {
        "name": name,
        "event_config": event_config,
    }
    if owner_contact is not None:
        input_["owner_contact"] = owner_contact
    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