import * as pulumi from "@pulumi/pulumi"; /** * A schema is a format that messages must follow, * creating a contract between publisher and subscriber that Pub/Sub will enforce. * * To get more information about Schema, see: * * * [API documentation](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.schemas) * * How-to Guides * * [Creating and managing schemas](https://cloud.google.com/pubsub/docs/schemas) * * ## Example Usage * * ### Pubsub Schema Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const example = new gcp.pubsub.Schema("example", { * name: "example-schema", * type: "AVRO", * definition: `{ * "type" : "record", * "name" : "Avro", * "fields" : [ * { * "name" : "StringField", * "type" : "string" * }, * { * "name" : "IntField", * "type" : "int" * } * ] * } * `, * }); * ``` * ### Pubsub Schema Protobuf * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const example = new gcp.pubsub.Schema("example", { * name: "example", * type: "PROTOCOL_BUFFER", * definition: `syntax = "proto3"; * message Results { * string message_request = 1; * string message_response = 2; * string timestamp_request = 3; * string timestamp_response = 4; * }`, * }); * const exampleTopic = new gcp.pubsub.Topic("example", { * name: "example-topic", * schemaSettings: { * schema: "projects/my-project-name/schemas/example", * encoding: "JSON", * }, * }, { * dependsOn: [example], * }); * ``` * * ## Import * * Schema can be imported using any of these accepted formats: * * * `projects/{{project}}/schemas/{{name}}` * * `{{project}}/{{name}}` * * `{{name}}` * * When using the `pulumi import` command, Schema can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:pubsub/schema:Schema default projects/{{project}}/schemas/{{name}} * $ pulumi import gcp:pubsub/schema:Schema default {{project}}/{{name}} * $ pulumi import gcp:pubsub/schema:Schema default {{name}} * ``` */ export declare class Schema extends pulumi.CustomResource { /** * Get an existing Schema resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: SchemaState, opts?: pulumi.CustomResourceOptions): Schema; /** * Returns true if the given object is an instance of Schema. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Schema; /** * The definition of the schema. * This should contain a string representing the full definition of the schema * that is a valid schema definition of the type specified in type. Changes * to the definition commit new [schema revisions](https://cloud.google.com/pubsub/docs/commit-schema-revision). * A schema can only have up to 20 revisions, so updates that fail with an * error indicating that the limit has been reached require manually * [deleting old revisions](https://cloud.google.com/pubsub/docs/delete-schema-revision). */ readonly definition: pulumi.Output; /** * The ID to use for the schema, which will become the final component of the schema's resource name. */ readonly name: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * The type of the schema definition * Default value is `TYPE_UNSPECIFIED`. * Possible values are: `TYPE_UNSPECIFIED`, `PROTOCOL_BUFFER`, `AVRO`. */ readonly type: pulumi.Output; /** * Create a Schema resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: SchemaArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Schema resources. */ export interface SchemaState { /** * The definition of the schema. * This should contain a string representing the full definition of the schema * that is a valid schema definition of the type specified in type. Changes * to the definition commit new [schema revisions](https://cloud.google.com/pubsub/docs/commit-schema-revision). * A schema can only have up to 20 revisions, so updates that fail with an * error indicating that the limit has been reached require manually * [deleting old revisions](https://cloud.google.com/pubsub/docs/delete-schema-revision). */ definition?: pulumi.Input; /** * The ID to use for the schema, which will become the final component of the schema's resource name. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The type of the schema definition * Default value is `TYPE_UNSPECIFIED`. * Possible values are: `TYPE_UNSPECIFIED`, `PROTOCOL_BUFFER`, `AVRO`. */ type?: pulumi.Input; } /** * The set of arguments for constructing a Schema resource. */ export interface SchemaArgs { /** * The definition of the schema. * This should contain a string representing the full definition of the schema * that is a valid schema definition of the type specified in type. Changes * to the definition commit new [schema revisions](https://cloud.google.com/pubsub/docs/commit-schema-revision). * A schema can only have up to 20 revisions, so updates that fail with an * error indicating that the limit has been reached require manually * [deleting old revisions](https://cloud.google.com/pubsub/docs/delete-schema-revision). */ definition?: pulumi.Input; /** * The ID to use for the schema, which will become the final component of the schema's resource name. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The type of the schema definition * Default value is `TYPE_UNSPECIFIED`. * Possible values are: `TYPE_UNSPECIFIED`, `PROTOCOL_BUFFER`, `AVRO`. */ type?: pulumi.Input; }