Skip to content

create_schema async

create_schema(
    registry_name: __string,
    schema_name: __string,
    *,
    config_overrides: Optional[AsyncschemasClientConfig] = None,
    content: Optional[__stringMin1Max100000] = None,
    description: Optional[__stringMin0Max256] = None,
    tags: Optional[Tags] = None,
    type: Optional[Type] = None,
) -> CreateSchemaResponse

Creates a schema definition.

Inactive schemas will be deleted after two years.

Parameters:

Raises:

Source code in docs_src/capo_schemas/_services/async_schemas.py
async def create_schema(
    self,
    registry_name: "capo_schemas.types.__string.__string",
    schema_name: "capo_schemas.types.__string.__string",
    *,
    config_overrides: Optional[AsyncschemasClientConfig] = None,
    content: Optional[
        "capo_schemas.types.__string_min1_max100000.__stringMin1Max100000"
    ] = None,
    description: Optional[
        "capo_schemas.types.__string_min0_max256.__stringMin0Max256"
    ] = None,
    tags: Optional["capo_schemas.types.tags.Tags"] = None,
    type: Optional["capo_schemas.types.type.Type"] = None,
) -> "capo_schemas.types.create_schema_response.CreateSchemaResponse":
    """<p>Creates a schema definition.</p> <note><p>Inactive schemas will be deleted after two years.</p></note>

    Args:
        content: <p>The source of the schema definition.</p>
        description: <p>A description of the schema.</p>
        registry_name: <p>The name of the registry.</p>
        schema_name: <p>The name of the schema.</p>
        tags: <p>Tags associated with the schema.</p>
        type: <p>The type of schema.</p>

    Raises:
        capo_schemas.errors.bad_request_exception.BadRequestException
        capo_schemas.errors.forbidden_exception.ForbiddenException
        capo_schemas.errors.internal_server_error_exception.InternalServerErrorException
        capo_schemas.errors.service_unavailable_exception.ServiceUnavailableException
        capo_schemas.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_schemas.types.create_schema_request.CreateSchemaRequest]",
    ) -> AsyncOperationResponse[
        "capo_schemas.types.create_schema_response.CreateSchemaResponse"
    ]:
        import capo_schemas._operations.schemas.create_schema

        (
            output,
            http_response,
        ) = await capo_schemas._operations.schemas.create_schema.async_create_schema(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSchema")
    )
    input_: capo_schemas.types.create_schema_request.CreateSchemaRequest = {
        "registry_name": registry_name,
        "schema_name": schema_name,
    }
    if content is not None:
        input_["content"] = content
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags
    if type is not None:
        input_["type"] = type

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