PubsubGrpc.Schema (PubsubGrpc v0.4.2)

View Source

Schema management for Google Cloud Pub/Sub.

Provides functions for managing Pub/Sub schemas, which define the structure and format of messages. Supports Protocol Buffer and Avro formats.

Summary

Functions

create_schema(project_id, schema_id, type, definition)

@spec create_schema(String.t(), String.t(), :protocol_buffer | :avro, String.t()) ::
  {:ok, Google.Pubsub.V1.Schema.t()} | {:error, PubsubGrpc.Error.t()}

delete_schema(project_id, schema_id)

@spec delete_schema(String.t(), String.t()) :: :ok | {:error, PubsubGrpc.Error.t()}

get_schema(project_id, schema_id, opts \\ [])

@spec get_schema(String.t(), String.t(), keyword()) ::
  {:ok, Google.Pubsub.V1.Schema.t()} | {:error, PubsubGrpc.Error.t()}

list_schema_revisions(project_id, schema_id, opts \\ [])

@spec list_schema_revisions(String.t(), String.t(), keyword()) ::
  {:ok, %{schemas: list(), next_page_token: String.t()}}
  | {:error, PubsubGrpc.Error.t()}

list_schemas(project_id, opts \\ [])

@spec list_schemas(
  String.t(),
  keyword()
) ::
  {:ok, %{schemas: list(), next_page_token: String.t()}}
  | {:error, PubsubGrpc.Error.t()}

validate_message(project_id, schema_name, message, encoding)

@spec validate_message(String.t(), String.t(), binary(), :json | :binary) ::
  {:ok, Google.Pubsub.V1.ValidateMessageResponse.t()}
  | {:error, PubsubGrpc.Error.t()}

Validates a message against an existing schema by name.

Parameters

  • schema_name - Schema ID or full resource name
  • message - Message bytes to validate
  • encoding - :json or :binary

validate_message_with_schema(project_id, type, definition, message, encoding)

@spec validate_message_with_schema(
  String.t(),
  :protocol_buffer | :avro,
  String.t(),
  binary(),
  :json | :binary
) ::
  {:ok, Google.Pubsub.V1.ValidateMessageResponse.t()}
  | {:error, PubsubGrpc.Error.t()}

Validates a message against an inline schema definition.

Parameters

  • type - :protocol_buffer or :avro
  • definition - Schema definition string
  • message - Message bytes to validate
  • encoding - :json or :binary

validate_schema(project_id, type, definition)

@spec validate_schema(String.t(), :protocol_buffer | :avro, String.t()) ::
  {:ok, Google.Pubsub.V1.ValidateSchemaResponse.t()}
  | {:error, PubsubGrpc.Error.t()}