From afec9a1ad3f665a71f08e748623f0fdaa332d17b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:15:57 -0400 Subject: [PATCH] feat: add ingestion Cloud Storage fields and Platform Logging fields to Topic (#1974) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add ingestion Cloud Storage fields and Platform Logging fields to Topic PiperOrigin-RevId: 678307181 Source-Link: https://github.com/googleapis/googleapis/commit/69e9dff10df4fa1e338712d38dc26b46791a6e94 Source-Link: https://github.com/googleapis/googleapis-gen/commit/11a52e52723227d3b6120f88f1a580e3958e0cd5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTFhNTJlNTI3MjMyMjdkM2I2MTIwZjg4ZjFhNTgwZTM5NThlMGNkNSJ9 feat: return listing information for subscriptions created via Analytics Hub PiperOrigin-RevId: 676126585 Source-Link: https://github.com/googleapis/googleapis/commit/de3b4b32cdf9edbe6ed687a985af393769052972 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c3df55162ccc9929c97bfec9fa1d5bcd3b65af4a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzNkZjU1MTYyY2NjOTkyOWM5N2JmZWM5ZmExZDViY2QzYjY1YWY0YSJ9 * build: try switching to raw eslint to exclude owl-bot-staging * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: feywind <57276408+feywind@users.noreply.github.com> --- README.md | 16 +- package.json | 2 +- protos/google/pubsub/v1/pubsub.proto | 140 +++ protos/protos.d.ts | 661 +++++++++- protos/protos.js | 1706 +++++++++++++++++++++++++- protos/protos.json | 164 ++- src/v1/subscriber_client.ts | 3 + 7 files changed, 2631 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index cafebdefe..be5ef76a7 100644 --- a/README.md +++ b/README.md @@ -66,15 +66,15 @@ npm install @google-cloud/pubsub ```javascript // Imports the Google Cloud client library -const {PubSub} = require('@google-cloud/pubsub'); +const { PubSub } = require("@google-cloud/pubsub"); async function quickstart( - projectId = 'your-project-id', // Your Google Cloud Platform project ID - topicNameOrId = 'my-topic', // Name for the new topic to create - subscriptionName = 'my-sub' // Name for the new subscription to create +projectId = 'your-project-id', // Your Google Cloud Platform project ID +topicNameOrId = 'my-topic', // Name for the new topic to create +subscriptionName = 'my-sub' // Name for the new subscription to create ) { // Instantiates a client - const pubsub = new PubSub({projectId}); + const pubsub = new PubSub({ projectId }); // Creates a new topic const [topic] = await pubsub.createTopic(topicNameOrId); @@ -84,19 +84,19 @@ async function quickstart( const [subscription] = await topic.createSubscription(subscriptionName); // Receive callbacks for new messages on the subscription - subscription.on('message', message => { + subscription.on('message', (message) => { console.log('Received message:', message.data.toString()); process.exit(0); }); // Receive callbacks for errors on the subscription - subscription.on('error', error => { + subscription.on('error', (error) => { console.error('Received error:', error); process.exit(1); }); // Send a message to the topic - topic.publishMessage({data: Buffer.from('Test message!')}); + topic.publishMessage({ data: Buffer.from('Test message!') }); } ``` diff --git a/package.json b/package.json index 88da238cb..b3558bf47 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "prelint": "cd samples; npm link ../; npm install", "precompile": "gts clean", "typeless": "npx typeless-sample-bot --outputpath samples --targets samples --recursive", - "posttypeless": "cd samples && npm i && cd .. && npm run fix" + "posttypeless": "cd samples && npm i && cd .. && npx eslint --ignore-pattern owl-bot-staging --fix" }, "dependencies": { "@google-cloud/paginator": "^5.0.0", diff --git a/protos/google/pubsub/v1/pubsub.proto b/protos/google/pubsub/v1/pubsub.proto index cd765d1c3..54b44b822 100644 --- a/protos/google/pubsub/v1/pubsub.proto +++ b/protos/google/pubsub/v1/pubsub.proto @@ -237,11 +237,132 @@ message IngestionDataSourceSettings { string gcp_service_account = 5 [(google.api.field_behavior) = REQUIRED]; } + // Ingestion settings for Cloud Storage. + message CloudStorage { + // Possible states for ingestion from Cloud Storage. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // Ingestion is active. + ACTIVE = 1; + + // Permission denied encountered while calling the Cloud Storage API. This + // can happen if the Pub/Sub SA has not been granted the + // [appropriate + // permissions](https://cloud.google.com/storage/docs/access-control/iam-permissions): + // - storage.objects.list: to list the objects in a bucket. + // - storage.objects.get: to read the objects in a bucket. + // - storage.buckets.get: to verify the bucket exists. + CLOUD_STORAGE_PERMISSION_DENIED = 2; + + // Permission denied encountered while publishing to the topic. This can + // happen if the Pub/Sub SA has not been granted the [appropriate publish + // permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher) + PUBLISH_PERMISSION_DENIED = 3; + + // The provided Cloud Storage bucket doesn't exist. + BUCKET_NOT_FOUND = 4; + + // The Cloud Storage bucket has too many objects, ingestion will be + // paused. + TOO_MANY_OBJECTS = 5; + } + + // Configuration for reading Cloud Storage data in text format. Each line of + // text as specified by the delimiter will be set to the `data` field of a + // Pub/Sub message. + message TextFormat { + // Optional. When unset, '\n' is used. + optional string delimiter = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // Configuration for reading Cloud Storage data in Avro binary format. The + // bytes of each object will be set to the `data` field of a Pub/Sub + // message. + message AvroFormat {} + + // Configuration for reading Cloud Storage data written via [Cloud Storage + // subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage). The + // data and attributes fields of the originally exported Pub/Sub message + // will be restored when publishing. + message PubSubAvroFormat {} + + // Output only. An output-only field that indicates the state of the Cloud + // Storage ingestion source. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Cloud Storage bucket. The bucket name must be without any + // prefix like "gs://". See the [bucket naming requirements] + // (https://cloud.google.com/storage/docs/buckets#naming). + string bucket = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Defaults to text format. + oneof input_format { + // Optional. Data from Cloud Storage will be interpreted as text. + TextFormat text_format = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Data from Cloud Storage will be interpreted in Avro format. + AvroFormat avro_format = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. It will be assumed data from Cloud Storage was written via + // [Cloud Storage + // subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage). + PubSubAvroFormat pubsub_avro_format = 5 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Only objects with a larger or equal creation timestamp will be + // ingested. + google.protobuf.Timestamp minimum_object_create_time = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glob pattern used to match objects that will be ingested. If + // unset, all objects will be ingested. See the [supported + // patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob). + string match_glob = 9 [(google.api.field_behavior) = OPTIONAL]; + } + // Only one source type can have settings set. oneof source { // Optional. Amazon Kinesis Data Streams. AwsKinesis aws_kinesis = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Cloud Storage. + CloudStorage cloud_storage = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Platform Logs settings. If unset, no Platform Logs will be + // generated. + PlatformLogsSettings platform_logs_settings = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Settings for Platform Logs produced by Pub/Sub. +message PlatformLogsSettings { + // Severity levels of Platform Logs. + enum Severity { + // Default value. Logs level is unspecified. Logs will be disabled. + SEVERITY_UNSPECIFIED = 0; + + // Logs will be disabled. + DISABLED = 1; + + // Debug logs and higher-severity logs will be written. + DEBUG = 2; + + // Info logs and higher-severity logs will be written. + INFO = 3; + + // Warning logs and higher-severity logs will be written. + WARNING = 4; + + // Only error logs will be written. + ERROR = 5; } + + // Optional. The minimum severity level of Platform Logs that will be written. + Severity severity = 1 [(google.api.field_behavior) = OPTIONAL]; } // A topic resource. @@ -774,6 +895,20 @@ message Subscription { RESOURCE_ERROR = 2; } + // Information about an associated Analytics Hub subscription + // (https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions). + message AnalyticsHubSubscriptionInfo { + // Optional. The name of the associated Analytics Hub listing resource. + // Pattern: + // "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" + string listing = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the associated Analytics Hub subscription resource. + // Pattern: + // "projects/{project}/locations/{location}/subscriptions/{subscription}" + string subscription = 2 [(google.api.field_behavior) = OPTIONAL]; + } + // Required. The name of the subscription. It must have the format // `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must // start with a letter, and contain only letters (`[A-Za-z]`), numbers @@ -922,6 +1057,11 @@ message Subscription { // Output only. An output-only field indicating whether or not the // subscription can receive messages. State state = 19 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Information about the associated Analytics Hub subscription. + // Only set if the subscritpion is created by Analytics Hub. + AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // A policy that specifies how Pub/Sub retries message delivery. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 69f782b8d..eed0f3d03 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -459,6 +459,12 @@ export namespace google { /** IngestionDataSourceSettings awsKinesis */ awsKinesis?: (google.pubsub.v1.IngestionDataSourceSettings.IAwsKinesis|null); + + /** IngestionDataSourceSettings cloudStorage */ + cloudStorage?: (google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage|null); + + /** IngestionDataSourceSettings platformLogsSettings */ + platformLogsSettings?: (google.pubsub.v1.IPlatformLogsSettings|null); } /** Represents an IngestionDataSourceSettings. */ @@ -473,8 +479,14 @@ export namespace google { /** IngestionDataSourceSettings awsKinesis. */ public awsKinesis?: (google.pubsub.v1.IngestionDataSourceSettings.IAwsKinesis|null); + /** IngestionDataSourceSettings cloudStorage. */ + public cloudStorage?: (google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage|null); + + /** IngestionDataSourceSettings platformLogsSettings. */ + public platformLogsSettings?: (google.pubsub.v1.IPlatformLogsSettings|null); + /** IngestionDataSourceSettings source. */ - public source?: "awsKinesis"; + public source?: ("awsKinesis"|"cloudStorage"); /** * Creates a new IngestionDataSourceSettings instance using the specified properties. @@ -689,6 +701,544 @@ export namespace google { CONSUMER_NOT_FOUND = 5 } } + + /** Properties of a CloudStorage. */ + interface ICloudStorage { + + /** CloudStorage state */ + state?: (google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State|keyof typeof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State|null); + + /** CloudStorage bucket */ + bucket?: (string|null); + + /** CloudStorage textFormat */ + textFormat?: (google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat|null); + + /** CloudStorage avroFormat */ + avroFormat?: (google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat|null); + + /** CloudStorage pubsubAvroFormat */ + pubsubAvroFormat?: (google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat|null); + + /** CloudStorage minimumObjectCreateTime */ + minimumObjectCreateTime?: (google.protobuf.ITimestamp|null); + + /** CloudStorage matchGlob */ + matchGlob?: (string|null); + } + + /** Represents a CloudStorage. */ + class CloudStorage implements ICloudStorage { + + /** + * Constructs a new CloudStorage. + * @param [properties] Properties to set + */ + constructor(properties?: google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage); + + /** CloudStorage state. */ + public state: (google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State|keyof typeof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State); + + /** CloudStorage bucket. */ + public bucket: string; + + /** CloudStorage textFormat. */ + public textFormat?: (google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat|null); + + /** CloudStorage avroFormat. */ + public avroFormat?: (google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat|null); + + /** CloudStorage pubsubAvroFormat. */ + public pubsubAvroFormat?: (google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat|null); + + /** CloudStorage minimumObjectCreateTime. */ + public minimumObjectCreateTime?: (google.protobuf.ITimestamp|null); + + /** CloudStorage matchGlob. */ + public matchGlob: string; + + /** CloudStorage inputFormat. */ + public inputFormat?: ("textFormat"|"avroFormat"|"pubsubAvroFormat"); + + /** + * Creates a new CloudStorage instance using the specified properties. + * @param [properties] Properties to set + * @returns CloudStorage instance + */ + public static create(properties?: google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage; + + /** + * Encodes the specified CloudStorage message. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.verify|verify} messages. + * @param message CloudStorage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloudStorage message, length delimited. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.verify|verify} messages. + * @param message CloudStorage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloudStorage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloudStorage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage; + + /** + * Decodes a CloudStorage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloudStorage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage; + + /** + * Verifies a CloudStorage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloudStorage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloudStorage + */ + public static fromObject(object: { [k: string]: any }): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage; + + /** + * Creates a plain object from a CloudStorage message. Also converts values to other types if specified. + * @param message CloudStorage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloudStorage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloudStorage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CloudStorage { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACTIVE = 1, + CLOUD_STORAGE_PERMISSION_DENIED = 2, + PUBLISH_PERMISSION_DENIED = 3, + BUCKET_NOT_FOUND = 4, + TOO_MANY_OBJECTS = 5 + } + + /** Properties of a TextFormat. */ + interface ITextFormat { + + /** TextFormat delimiter */ + delimiter?: (string|null); + } + + /** Represents a TextFormat. */ + class TextFormat implements ITextFormat { + + /** + * Constructs a new TextFormat. + * @param [properties] Properties to set + */ + constructor(properties?: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat); + + /** TextFormat delimiter. */ + public delimiter?: (string|null); + + /** + * Creates a new TextFormat instance using the specified properties. + * @param [properties] Properties to set + * @returns TextFormat instance + */ + public static create(properties?: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat; + + /** + * Encodes the specified TextFormat message. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.verify|verify} messages. + * @param message TextFormat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextFormat message, length delimited. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.verify|verify} messages. + * @param message TextFormat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextFormat message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat; + + /** + * Decodes a TextFormat message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat; + + /** + * Verifies a TextFormat message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextFormat message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextFormat + */ + public static fromObject(object: { [k: string]: any }): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat; + + /** + * Creates a plain object from a TextFormat message. Also converts values to other types if specified. + * @param message TextFormat + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextFormat to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextFormat + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AvroFormat. */ + interface IAvroFormat { + } + + /** Represents an AvroFormat. */ + class AvroFormat implements IAvroFormat { + + /** + * Constructs a new AvroFormat. + * @param [properties] Properties to set + */ + constructor(properties?: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat); + + /** + * Creates a new AvroFormat instance using the specified properties. + * @param [properties] Properties to set + * @returns AvroFormat instance + */ + public static create(properties?: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat; + + /** + * Encodes the specified AvroFormat message. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.verify|verify} messages. + * @param message AvroFormat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AvroFormat message, length delimited. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.verify|verify} messages. + * @param message AvroFormat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AvroFormat message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AvroFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat; + + /** + * Decodes an AvroFormat message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AvroFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat; + + /** + * Verifies an AvroFormat message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AvroFormat message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AvroFormat + */ + public static fromObject(object: { [k: string]: any }): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat; + + /** + * Creates a plain object from an AvroFormat message. Also converts values to other types if specified. + * @param message AvroFormat + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AvroFormat to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AvroFormat + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PubSubAvroFormat. */ + interface IPubSubAvroFormat { + } + + /** Represents a PubSubAvroFormat. */ + class PubSubAvroFormat implements IPubSubAvroFormat { + + /** + * Constructs a new PubSubAvroFormat. + * @param [properties] Properties to set + */ + constructor(properties?: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat); + + /** + * Creates a new PubSubAvroFormat instance using the specified properties. + * @param [properties] Properties to set + * @returns PubSubAvroFormat instance + */ + public static create(properties?: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat; + + /** + * Encodes the specified PubSubAvroFormat message. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.verify|verify} messages. + * @param message PubSubAvroFormat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PubSubAvroFormat message, length delimited. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.verify|verify} messages. + * @param message PubSubAvroFormat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PubSubAvroFormat message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PubSubAvroFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat; + + /** + * Decodes a PubSubAvroFormat message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PubSubAvroFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat; + + /** + * Verifies a PubSubAvroFormat message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PubSubAvroFormat message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PubSubAvroFormat + */ + public static fromObject(object: { [k: string]: any }): google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat; + + /** + * Creates a plain object from a PubSubAvroFormat message. Also converts values to other types if specified. + * @param message PubSubAvroFormat + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PubSubAvroFormat to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PubSubAvroFormat + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + + /** Properties of a PlatformLogsSettings. */ + interface IPlatformLogsSettings { + + /** PlatformLogsSettings severity */ + severity?: (google.pubsub.v1.PlatformLogsSettings.Severity|keyof typeof google.pubsub.v1.PlatformLogsSettings.Severity|null); + } + + /** Represents a PlatformLogsSettings. */ + class PlatformLogsSettings implements IPlatformLogsSettings { + + /** + * Constructs a new PlatformLogsSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.pubsub.v1.IPlatformLogsSettings); + + /** PlatformLogsSettings severity. */ + public severity: (google.pubsub.v1.PlatformLogsSettings.Severity|keyof typeof google.pubsub.v1.PlatformLogsSettings.Severity); + + /** + * Creates a new PlatformLogsSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns PlatformLogsSettings instance + */ + public static create(properties?: google.pubsub.v1.IPlatformLogsSettings): google.pubsub.v1.PlatformLogsSettings; + + /** + * Encodes the specified PlatformLogsSettings message. Does not implicitly {@link google.pubsub.v1.PlatformLogsSettings.verify|verify} messages. + * @param message PlatformLogsSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.pubsub.v1.IPlatformLogsSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PlatformLogsSettings message, length delimited. Does not implicitly {@link google.pubsub.v1.PlatformLogsSettings.verify|verify} messages. + * @param message PlatformLogsSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.pubsub.v1.IPlatformLogsSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PlatformLogsSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PlatformLogsSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.pubsub.v1.PlatformLogsSettings; + + /** + * Decodes a PlatformLogsSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PlatformLogsSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.pubsub.v1.PlatformLogsSettings; + + /** + * Verifies a PlatformLogsSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PlatformLogsSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PlatformLogsSettings + */ + public static fromObject(object: { [k: string]: any }): google.pubsub.v1.PlatformLogsSettings; + + /** + * Creates a plain object from a PlatformLogsSettings message. Also converts values to other types if specified. + * @param message PlatformLogsSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.pubsub.v1.PlatformLogsSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PlatformLogsSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PlatformLogsSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PlatformLogsSettings { + + /** Severity enum. */ + enum Severity { + SEVERITY_UNSPECIFIED = 0, + DISABLED = 1, + DEBUG = 2, + INFO = 3, + WARNING = 4, + ERROR = 5 + } } /** Properties of a Topic. */ @@ -2704,6 +3254,9 @@ export namespace google { /** Subscription state */ state?: (google.pubsub.v1.Subscription.State|keyof typeof google.pubsub.v1.Subscription.State|null); + + /** Subscription analyticsHubSubscriptionInfo */ + analyticsHubSubscriptionInfo?: (google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo|null); } /** Represents a Subscription. */ @@ -2769,6 +3322,9 @@ export namespace google { /** Subscription state. */ public state: (google.pubsub.v1.Subscription.State|keyof typeof google.pubsub.v1.Subscription.State); + /** Subscription analyticsHubSubscriptionInfo. */ + public analyticsHubSubscriptionInfo?: (google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo|null); + /** * Creates a new Subscription instance using the specified properties. * @param [properties] Properties to set @@ -2855,6 +3411,109 @@ export namespace google { ACTIVE = 1, RESOURCE_ERROR = 2 } + + /** Properties of an AnalyticsHubSubscriptionInfo. */ + interface IAnalyticsHubSubscriptionInfo { + + /** AnalyticsHubSubscriptionInfo listing */ + listing?: (string|null); + + /** AnalyticsHubSubscriptionInfo subscription */ + subscription?: (string|null); + } + + /** Represents an AnalyticsHubSubscriptionInfo. */ + class AnalyticsHubSubscriptionInfo implements IAnalyticsHubSubscriptionInfo { + + /** + * Constructs a new AnalyticsHubSubscriptionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo); + + /** AnalyticsHubSubscriptionInfo listing. */ + public listing: string; + + /** AnalyticsHubSubscriptionInfo subscription. */ + public subscription: string; + + /** + * Creates a new AnalyticsHubSubscriptionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns AnalyticsHubSubscriptionInfo instance + */ + public static create(properties?: google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo): google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo; + + /** + * Encodes the specified AnalyticsHubSubscriptionInfo message. Does not implicitly {@link google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.verify|verify} messages. + * @param message AnalyticsHubSubscriptionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnalyticsHubSubscriptionInfo message, length delimited. Does not implicitly {@link google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.verify|verify} messages. + * @param message AnalyticsHubSubscriptionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnalyticsHubSubscriptionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnalyticsHubSubscriptionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo; + + /** + * Decodes an AnalyticsHubSubscriptionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnalyticsHubSubscriptionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo; + + /** + * Verifies an AnalyticsHubSubscriptionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AnalyticsHubSubscriptionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnalyticsHubSubscriptionInfo + */ + public static fromObject(object: { [k: string]: any }): google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo; + + /** + * Creates a plain object from an AnalyticsHubSubscriptionInfo message. Also converts values to other types if specified. + * @param message AnalyticsHubSubscriptionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnalyticsHubSubscriptionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnalyticsHubSubscriptionInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of a RetryPolicy. */ diff --git a/protos/protos.js b/protos/protos.js index 5b9a057d5..b54729ed3 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -936,6 +936,8 @@ * @memberof google.pubsub.v1 * @interface IIngestionDataSourceSettings * @property {google.pubsub.v1.IngestionDataSourceSettings.IAwsKinesis|null} [awsKinesis] IngestionDataSourceSettings awsKinesis + * @property {google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage|null} [cloudStorage] IngestionDataSourceSettings cloudStorage + * @property {google.pubsub.v1.IPlatformLogsSettings|null} [platformLogsSettings] IngestionDataSourceSettings platformLogsSettings */ /** @@ -961,17 +963,33 @@ */ IngestionDataSourceSettings.prototype.awsKinesis = null; + /** + * IngestionDataSourceSettings cloudStorage. + * @member {google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage|null|undefined} cloudStorage + * @memberof google.pubsub.v1.IngestionDataSourceSettings + * @instance + */ + IngestionDataSourceSettings.prototype.cloudStorage = null; + + /** + * IngestionDataSourceSettings platformLogsSettings. + * @member {google.pubsub.v1.IPlatformLogsSettings|null|undefined} platformLogsSettings + * @memberof google.pubsub.v1.IngestionDataSourceSettings + * @instance + */ + IngestionDataSourceSettings.prototype.platformLogsSettings = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * IngestionDataSourceSettings source. - * @member {"awsKinesis"|undefined} source + * @member {"awsKinesis"|"cloudStorage"|undefined} source * @memberof google.pubsub.v1.IngestionDataSourceSettings * @instance */ Object.defineProperty(IngestionDataSourceSettings.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["awsKinesis"]), + get: $util.oneOfGetter($oneOfFields = ["awsKinesis", "cloudStorage"]), set: $util.oneOfSetter($oneOfFields) }); @@ -1001,6 +1019,10 @@ writer = $Writer.create(); if (message.awsKinesis != null && Object.hasOwnProperty.call(message, "awsKinesis")) $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.encode(message.awsKinesis, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.cloudStorage != null && Object.hasOwnProperty.call(message, "cloudStorage")) + $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.encode(message.cloudStorage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.platformLogsSettings != null && Object.hasOwnProperty.call(message, "platformLogsSettings")) + $root.google.pubsub.v1.PlatformLogsSettings.encode(message.platformLogsSettings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; @@ -1039,6 +1061,14 @@ message.awsKinesis = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.decode(reader, reader.uint32()); break; } + case 2: { + message.cloudStorage = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.decode(reader, reader.uint32()); + break; + } + case 4: { + message.platformLogsSettings = $root.google.pubsub.v1.PlatformLogsSettings.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -1083,6 +1113,21 @@ return "awsKinesis." + error; } } + if (message.cloudStorage != null && message.hasOwnProperty("cloudStorage")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.verify(message.cloudStorage); + if (error) + return "cloudStorage." + error; + } + } + if (message.platformLogsSettings != null && message.hasOwnProperty("platformLogsSettings")) { + var error = $root.google.pubsub.v1.PlatformLogsSettings.verify(message.platformLogsSettings); + if (error) + return "platformLogsSettings." + error; + } return null; }; @@ -1103,6 +1148,16 @@ throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.awsKinesis: object expected"); message.awsKinesis = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.fromObject(object.awsKinesis); } + if (object.cloudStorage != null) { + if (typeof object.cloudStorage !== "object") + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.cloudStorage: object expected"); + message.cloudStorage = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.fromObject(object.cloudStorage); + } + if (object.platformLogsSettings != null) { + if (typeof object.platformLogsSettings !== "object") + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.platformLogsSettings: object expected"); + message.platformLogsSettings = $root.google.pubsub.v1.PlatformLogsSettings.fromObject(object.platformLogsSettings); + } return message; }; @@ -1119,11 +1174,20 @@ if (!options) options = {}; var object = {}; + if (options.defaults) + object.platformLogsSettings = null; if (message.awsKinesis != null && message.hasOwnProperty("awsKinesis")) { object.awsKinesis = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.toObject(message.awsKinesis, options); if (options.oneofs) object.source = "awsKinesis"; } + if (message.cloudStorage != null && message.hasOwnProperty("cloudStorage")) { + object.cloudStorage = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.toObject(message.cloudStorage, options); + if (options.oneofs) + object.source = "cloudStorage"; + } + if (message.platformLogsSettings != null && message.hasOwnProperty("platformLogsSettings")) + object.platformLogsSettings = $root.google.pubsub.v1.PlatformLogsSettings.toObject(message.platformLogsSettings, options); return object; }; @@ -1457,60 +1521,1347 @@ if (message.gcpServiceAccount != null && message.hasOwnProperty("gcpServiceAccount")) object.gcpServiceAccount = message.gcpServiceAccount; return object; - }; + }; + + /** + * Converts this AwsKinesis to JSON. + * @function toJSON + * @memberof google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis + * @instance + * @returns {Object.} JSON object + */ + AwsKinesis.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AwsKinesis + * @function getTypeUrl + * @memberof google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AwsKinesis.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis"; + }; + + /** + * State enum. + * @name google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} KINESIS_PERMISSION_DENIED=2 KINESIS_PERMISSION_DENIED value + * @property {number} PUBLISH_PERMISSION_DENIED=3 PUBLISH_PERMISSION_DENIED value + * @property {number} STREAM_NOT_FOUND=4 STREAM_NOT_FOUND value + * @property {number} CONSUMER_NOT_FOUND=5 CONSUMER_NOT_FOUND value + */ + AwsKinesis.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "KINESIS_PERMISSION_DENIED"] = 2; + values[valuesById[3] = "PUBLISH_PERMISSION_DENIED"] = 3; + values[valuesById[4] = "STREAM_NOT_FOUND"] = 4; + values[valuesById[5] = "CONSUMER_NOT_FOUND"] = 5; + return values; + })(); + + return AwsKinesis; + })(); + + IngestionDataSourceSettings.CloudStorage = (function() { + + /** + * Properties of a CloudStorage. + * @memberof google.pubsub.v1.IngestionDataSourceSettings + * @interface ICloudStorage + * @property {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State|null} [state] CloudStorage state + * @property {string|null} [bucket] CloudStorage bucket + * @property {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat|null} [textFormat] CloudStorage textFormat + * @property {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat|null} [avroFormat] CloudStorage avroFormat + * @property {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat|null} [pubsubAvroFormat] CloudStorage pubsubAvroFormat + * @property {google.protobuf.ITimestamp|null} [minimumObjectCreateTime] CloudStorage minimumObjectCreateTime + * @property {string|null} [matchGlob] CloudStorage matchGlob + */ + + /** + * Constructs a new CloudStorage. + * @memberof google.pubsub.v1.IngestionDataSourceSettings + * @classdesc Represents a CloudStorage. + * @implements ICloudStorage + * @constructor + * @param {google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage=} [properties] Properties to set + */ + function CloudStorage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CloudStorage state. + * @member {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State} state + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @instance + */ + CloudStorage.prototype.state = 0; + + /** + * CloudStorage bucket. + * @member {string} bucket + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @instance + */ + CloudStorage.prototype.bucket = ""; + + /** + * CloudStorage textFormat. + * @member {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat|null|undefined} textFormat + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @instance + */ + CloudStorage.prototype.textFormat = null; + + /** + * CloudStorage avroFormat. + * @member {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat|null|undefined} avroFormat + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @instance + */ + CloudStorage.prototype.avroFormat = null; + + /** + * CloudStorage pubsubAvroFormat. + * @member {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat|null|undefined} pubsubAvroFormat + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @instance + */ + CloudStorage.prototype.pubsubAvroFormat = null; + + /** + * CloudStorage minimumObjectCreateTime. + * @member {google.protobuf.ITimestamp|null|undefined} minimumObjectCreateTime + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @instance + */ + CloudStorage.prototype.minimumObjectCreateTime = null; + + /** + * CloudStorage matchGlob. + * @member {string} matchGlob + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @instance + */ + CloudStorage.prototype.matchGlob = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CloudStorage inputFormat. + * @member {"textFormat"|"avroFormat"|"pubsubAvroFormat"|undefined} inputFormat + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @instance + */ + Object.defineProperty(CloudStorage.prototype, "inputFormat", { + get: $util.oneOfGetter($oneOfFields = ["textFormat", "avroFormat", "pubsubAvroFormat"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CloudStorage instance using the specified properties. + * @function create + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage=} [properties] Properties to set + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage} CloudStorage instance + */ + CloudStorage.create = function create(properties) { + return new CloudStorage(properties); + }; + + /** + * Encodes the specified CloudStorage message. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.verify|verify} messages. + * @function encode + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage} message CloudStorage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudStorage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.bucket); + if (message.textFormat != null && Object.hasOwnProperty.call(message, "textFormat")) + $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.encode(message.textFormat, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.avroFormat != null && Object.hasOwnProperty.call(message, "avroFormat")) + $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.encode(message.avroFormat, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pubsubAvroFormat != null && Object.hasOwnProperty.call(message, "pubsubAvroFormat")) + $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.encode(message.pubsubAvroFormat, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.minimumObjectCreateTime != null && Object.hasOwnProperty.call(message, "minimumObjectCreateTime")) + $root.google.protobuf.Timestamp.encode(message.minimumObjectCreateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.matchGlob != null && Object.hasOwnProperty.call(message, "matchGlob")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.matchGlob); + return writer; + }; + + /** + * Encodes the specified CloudStorage message, length delimited. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.ICloudStorage} message CloudStorage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudStorage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CloudStorage message from the specified reader or buffer. + * @function decode + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage} CloudStorage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudStorage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.bucket = reader.string(); + break; + } + case 3: { + message.textFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.decode(reader, reader.uint32()); + break; + } + case 4: { + message.avroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.decode(reader, reader.uint32()); + break; + } + case 5: { + message.pubsubAvroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.decode(reader, reader.uint32()); + break; + } + case 6: { + message.minimumObjectCreateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 9: { + message.matchGlob = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CloudStorage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage} CloudStorage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudStorage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloudStorage message. + * @function verify + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloudStorage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.bucket != null && message.hasOwnProperty("bucket")) + if (!$util.isString(message.bucket)) + return "bucket: string expected"; + if (message.textFormat != null && message.hasOwnProperty("textFormat")) { + properties.inputFormat = 1; + { + var error = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.verify(message.textFormat); + if (error) + return "textFormat." + error; + } + } + if (message.avroFormat != null && message.hasOwnProperty("avroFormat")) { + if (properties.inputFormat === 1) + return "inputFormat: multiple values"; + properties.inputFormat = 1; + { + var error = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.verify(message.avroFormat); + if (error) + return "avroFormat." + error; + } + } + if (message.pubsubAvroFormat != null && message.hasOwnProperty("pubsubAvroFormat")) { + if (properties.inputFormat === 1) + return "inputFormat: multiple values"; + properties.inputFormat = 1; + { + var error = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.verify(message.pubsubAvroFormat); + if (error) + return "pubsubAvroFormat." + error; + } + } + if (message.minimumObjectCreateTime != null && message.hasOwnProperty("minimumObjectCreateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.minimumObjectCreateTime); + if (error) + return "minimumObjectCreateTime." + error; + } + if (message.matchGlob != null && message.hasOwnProperty("matchGlob")) + if (!$util.isString(message.matchGlob)) + return "matchGlob: string expected"; + return null; + }; + + /** + * Creates a CloudStorage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @static + * @param {Object.} object Plain object + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage} CloudStorage + */ + CloudStorage.fromObject = function fromObject(object) { + if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) + return object; + var message = new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage(); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACTIVE": + case 1: + message.state = 1; + break; + case "CLOUD_STORAGE_PERMISSION_DENIED": + case 2: + message.state = 2; + break; + case "PUBLISH_PERMISSION_DENIED": + case 3: + message.state = 3; + break; + case "BUCKET_NOT_FOUND": + case 4: + message.state = 4; + break; + case "TOO_MANY_OBJECTS": + case 5: + message.state = 5; + break; + } + if (object.bucket != null) + message.bucket = String(object.bucket); + if (object.textFormat != null) { + if (typeof object.textFormat !== "object") + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.textFormat: object expected"); + message.textFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.fromObject(object.textFormat); + } + if (object.avroFormat != null) { + if (typeof object.avroFormat !== "object") + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.avroFormat: object expected"); + message.avroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.fromObject(object.avroFormat); + } + if (object.pubsubAvroFormat != null) { + if (typeof object.pubsubAvroFormat !== "object") + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.pubsubAvroFormat: object expected"); + message.pubsubAvroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.fromObject(object.pubsubAvroFormat); + } + if (object.minimumObjectCreateTime != null) { + if (typeof object.minimumObjectCreateTime !== "object") + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.minimumObjectCreateTime: object expected"); + message.minimumObjectCreateTime = $root.google.protobuf.Timestamp.fromObject(object.minimumObjectCreateTime); + } + if (object.matchGlob != null) + message.matchGlob = String(object.matchGlob); + return message; + }; + + /** + * Creates a plain object from a CloudStorage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage} message CloudStorage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloudStorage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.bucket = ""; + object.minimumObjectCreateTime = null; + object.matchGlob = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State[message.state] : message.state; + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = message.bucket; + if (message.textFormat != null && message.hasOwnProperty("textFormat")) { + object.textFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.toObject(message.textFormat, options); + if (options.oneofs) + object.inputFormat = "textFormat"; + } + if (message.avroFormat != null && message.hasOwnProperty("avroFormat")) { + object.avroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.toObject(message.avroFormat, options); + if (options.oneofs) + object.inputFormat = "avroFormat"; + } + if (message.pubsubAvroFormat != null && message.hasOwnProperty("pubsubAvroFormat")) { + object.pubsubAvroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.toObject(message.pubsubAvroFormat, options); + if (options.oneofs) + object.inputFormat = "pubsubAvroFormat"; + } + if (message.minimumObjectCreateTime != null && message.hasOwnProperty("minimumObjectCreateTime")) + object.minimumObjectCreateTime = $root.google.protobuf.Timestamp.toObject(message.minimumObjectCreateTime, options); + if (message.matchGlob != null && message.hasOwnProperty("matchGlob")) + object.matchGlob = message.matchGlob; + return object; + }; + + /** + * Converts this CloudStorage to JSON. + * @function toJSON + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @instance + * @returns {Object.} JSON object + */ + CloudStorage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CloudStorage + * @function getTypeUrl + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloudStorage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage"; + }; + + /** + * State enum. + * @name google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} CLOUD_STORAGE_PERMISSION_DENIED=2 CLOUD_STORAGE_PERMISSION_DENIED value + * @property {number} PUBLISH_PERMISSION_DENIED=3 PUBLISH_PERMISSION_DENIED value + * @property {number} BUCKET_NOT_FOUND=4 BUCKET_NOT_FOUND value + * @property {number} TOO_MANY_OBJECTS=5 TOO_MANY_OBJECTS value + */ + CloudStorage.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "CLOUD_STORAGE_PERMISSION_DENIED"] = 2; + values[valuesById[3] = "PUBLISH_PERMISSION_DENIED"] = 3; + values[valuesById[4] = "BUCKET_NOT_FOUND"] = 4; + values[valuesById[5] = "TOO_MANY_OBJECTS"] = 5; + return values; + })(); + + CloudStorage.TextFormat = (function() { + + /** + * Properties of a TextFormat. + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @interface ITextFormat + * @property {string|null} [delimiter] TextFormat delimiter + */ + + /** + * Constructs a new TextFormat. + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @classdesc Represents a TextFormat. + * @implements ITextFormat + * @constructor + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat=} [properties] Properties to set + */ + function TextFormat(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextFormat delimiter. + * @member {string|null|undefined} delimiter + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @instance + */ + TextFormat.prototype.delimiter = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(TextFormat.prototype, "_delimiter", { + get: $util.oneOfGetter($oneOfFields = ["delimiter"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TextFormat instance using the specified properties. + * @function create + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat=} [properties] Properties to set + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat} TextFormat instance + */ + TextFormat.create = function create(properties) { + return new TextFormat(properties); + }; + + /** + * Encodes the specified TextFormat message. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.verify|verify} messages. + * @function encode + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat} message TextFormat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextFormat.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delimiter != null && Object.hasOwnProperty.call(message, "delimiter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delimiter); + return writer; + }; + + /** + * Encodes the specified TextFormat message, length delimited. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.verify|verify} messages. + * @function encodeDelimited + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.ITextFormat} message TextFormat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextFormat.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextFormat message from the specified reader or buffer. + * @function decode + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat} TextFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextFormat.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.delimiter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextFormat message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat} TextFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextFormat.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextFormat message. + * @function verify + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextFormat.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.delimiter != null && message.hasOwnProperty("delimiter")) { + properties._delimiter = 1; + if (!$util.isString(message.delimiter)) + return "delimiter: string expected"; + } + return null; + }; + + /** + * Creates a TextFormat message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @static + * @param {Object.} object Plain object + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat} TextFormat + */ + TextFormat.fromObject = function fromObject(object) { + if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + return object; + var message = new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat(); + if (object.delimiter != null) + message.delimiter = String(object.delimiter); + return message; + }; + + /** + * Creates a plain object from a TextFormat message. Also converts values to other types if specified. + * @function toObject + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat} message TextFormat + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextFormat.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.delimiter != null && message.hasOwnProperty("delimiter")) { + object.delimiter = message.delimiter; + if (options.oneofs) + object._delimiter = "delimiter"; + } + return object; + }; + + /** + * Converts this TextFormat to JSON. + * @function toJSON + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @instance + * @returns {Object.} JSON object + */ + TextFormat.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TextFormat + * @function getTypeUrl + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextFormat.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat"; + }; + + return TextFormat; + })(); + + CloudStorage.AvroFormat = (function() { + + /** + * Properties of an AvroFormat. + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @interface IAvroFormat + */ + + /** + * Constructs a new AvroFormat. + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @classdesc Represents an AvroFormat. + * @implements IAvroFormat + * @constructor + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat=} [properties] Properties to set + */ + function AvroFormat(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AvroFormat instance using the specified properties. + * @function create + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat=} [properties] Properties to set + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat} AvroFormat instance + */ + AvroFormat.create = function create(properties) { + return new AvroFormat(properties); + }; + + /** + * Encodes the specified AvroFormat message. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.verify|verify} messages. + * @function encode + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat} message AvroFormat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvroFormat.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AvroFormat message, length delimited. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.verify|verify} messages. + * @function encodeDelimited + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IAvroFormat} message AvroFormat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvroFormat.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AvroFormat message from the specified reader or buffer. + * @function decode + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat} AvroFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvroFormat.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AvroFormat message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat} AvroFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvroFormat.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AvroFormat message. + * @function verify + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AvroFormat.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AvroFormat message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @static + * @param {Object.} object Plain object + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat} AvroFormat + */ + AvroFormat.fromObject = function fromObject(object) { + if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + return object; + return new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat(); + }; + + /** + * Creates a plain object from an AvroFormat message. Also converts values to other types if specified. + * @function toObject + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat} message AvroFormat + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AvroFormat.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AvroFormat to JSON. + * @function toJSON + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @instance + * @returns {Object.} JSON object + */ + AvroFormat.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AvroFormat + * @function getTypeUrl + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AvroFormat.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat"; + }; + + return AvroFormat; + })(); + + CloudStorage.PubSubAvroFormat = (function() { + + /** + * Properties of a PubSubAvroFormat. + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @interface IPubSubAvroFormat + */ + + /** + * Constructs a new PubSubAvroFormat. + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + * @classdesc Represents a PubSubAvroFormat. + * @implements IPubSubAvroFormat + * @constructor + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat=} [properties] Properties to set + */ + function PubSubAvroFormat(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new PubSubAvroFormat instance using the specified properties. + * @function create + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat=} [properties] Properties to set + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat} PubSubAvroFormat instance + */ + PubSubAvroFormat.create = function create(properties) { + return new PubSubAvroFormat(properties); + }; + + /** + * Encodes the specified PubSubAvroFormat message. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.verify|verify} messages. + * @function encode + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat} message PubSubAvroFormat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PubSubAvroFormat.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified PubSubAvroFormat message, length delimited. Does not implicitly {@link google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.verify|verify} messages. + * @function encodeDelimited + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.IPubSubAvroFormat} message PubSubAvroFormat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PubSubAvroFormat.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PubSubAvroFormat message from the specified reader or buffer. + * @function decode + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat} PubSubAvroFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PubSubAvroFormat.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PubSubAvroFormat message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat} PubSubAvroFormat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PubSubAvroFormat.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PubSubAvroFormat message. + * @function verify + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PubSubAvroFormat.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a PubSubAvroFormat message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @static + * @param {Object.} object Plain object + * @returns {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat} PubSubAvroFormat + */ + PubSubAvroFormat.fromObject = function fromObject(object) { + if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + return object; + return new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat(); + }; + + /** + * Creates a plain object from a PubSubAvroFormat message. Also converts values to other types if specified. + * @function toObject + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @static + * @param {google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat} message PubSubAvroFormat + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PubSubAvroFormat.toObject = function toObject() { + return {}; + }; + + /** + * Converts this PubSubAvroFormat to JSON. + * @function toJSON + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @instance + * @returns {Object.} JSON object + */ + PubSubAvroFormat.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PubSubAvroFormat + * @function getTypeUrl + * @memberof google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PubSubAvroFormat.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat"; + }; + + return PubSubAvroFormat; + })(); + + return CloudStorage; + })(); + + return IngestionDataSourceSettings; + })(); + + v1.PlatformLogsSettings = (function() { + + /** + * Properties of a PlatformLogsSettings. + * @memberof google.pubsub.v1 + * @interface IPlatformLogsSettings + * @property {google.pubsub.v1.PlatformLogsSettings.Severity|null} [severity] PlatformLogsSettings severity + */ + + /** + * Constructs a new PlatformLogsSettings. + * @memberof google.pubsub.v1 + * @classdesc Represents a PlatformLogsSettings. + * @implements IPlatformLogsSettings + * @constructor + * @param {google.pubsub.v1.IPlatformLogsSettings=} [properties] Properties to set + */ + function PlatformLogsSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PlatformLogsSettings severity. + * @member {google.pubsub.v1.PlatformLogsSettings.Severity} severity + * @memberof google.pubsub.v1.PlatformLogsSettings + * @instance + */ + PlatformLogsSettings.prototype.severity = 0; + + /** + * Creates a new PlatformLogsSettings instance using the specified properties. + * @function create + * @memberof google.pubsub.v1.PlatformLogsSettings + * @static + * @param {google.pubsub.v1.IPlatformLogsSettings=} [properties] Properties to set + * @returns {google.pubsub.v1.PlatformLogsSettings} PlatformLogsSettings instance + */ + PlatformLogsSettings.create = function create(properties) { + return new PlatformLogsSettings(properties); + }; + + /** + * Encodes the specified PlatformLogsSettings message. Does not implicitly {@link google.pubsub.v1.PlatformLogsSettings.verify|verify} messages. + * @function encode + * @memberof google.pubsub.v1.PlatformLogsSettings + * @static + * @param {google.pubsub.v1.IPlatformLogsSettings} message PlatformLogsSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PlatformLogsSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.severity); + return writer; + }; + + /** + * Encodes the specified PlatformLogsSettings message, length delimited. Does not implicitly {@link google.pubsub.v1.PlatformLogsSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.pubsub.v1.PlatformLogsSettings + * @static + * @param {google.pubsub.v1.IPlatformLogsSettings} message PlatformLogsSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PlatformLogsSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PlatformLogsSettings message from the specified reader or buffer. + * @function decode + * @memberof google.pubsub.v1.PlatformLogsSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.pubsub.v1.PlatformLogsSettings} PlatformLogsSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PlatformLogsSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.pubsub.v1.PlatformLogsSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.severity = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PlatformLogsSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.pubsub.v1.PlatformLogsSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.pubsub.v1.PlatformLogsSettings} PlatformLogsSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PlatformLogsSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PlatformLogsSettings message. + * @function verify + * @memberof google.pubsub.v1.PlatformLogsSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PlatformLogsSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.severity != null && message.hasOwnProperty("severity")) + switch (message.severity) { + default: + return "severity: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates a PlatformLogsSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.pubsub.v1.PlatformLogsSettings + * @static + * @param {Object.} object Plain object + * @returns {google.pubsub.v1.PlatformLogsSettings} PlatformLogsSettings + */ + PlatformLogsSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.pubsub.v1.PlatformLogsSettings) + return object; + var message = new $root.google.pubsub.v1.PlatformLogsSettings(); + switch (object.severity) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; + case "SEVERITY_UNSPECIFIED": + case 0: + message.severity = 0; + break; + case "DISABLED": + case 1: + message.severity = 1; + break; + case "DEBUG": + case 2: + message.severity = 2; + break; + case "INFO": + case 3: + message.severity = 3; + break; + case "WARNING": + case 4: + message.severity = 4; + break; + case "ERROR": + case 5: + message.severity = 5; + break; + } + return message; + }; - /** - * Converts this AwsKinesis to JSON. - * @function toJSON - * @memberof google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis - * @instance - * @returns {Object.} JSON object - */ - AwsKinesis.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a PlatformLogsSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.pubsub.v1.PlatformLogsSettings + * @static + * @param {google.pubsub.v1.PlatformLogsSettings} message PlatformLogsSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PlatformLogsSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.severity = options.enums === String ? "SEVERITY_UNSPECIFIED" : 0; + if (message.severity != null && message.hasOwnProperty("severity")) + object.severity = options.enums === String ? $root.google.pubsub.v1.PlatformLogsSettings.Severity[message.severity] === undefined ? message.severity : $root.google.pubsub.v1.PlatformLogsSettings.Severity[message.severity] : message.severity; + return object; + }; - /** - * Gets the default type url for AwsKinesis - * @function getTypeUrl - * @memberof google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AwsKinesis.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis"; - }; + /** + * Converts this PlatformLogsSettings to JSON. + * @function toJSON + * @memberof google.pubsub.v1.PlatformLogsSettings + * @instance + * @returns {Object.} JSON object + */ + PlatformLogsSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * State enum. - * @name google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} ACTIVE=1 ACTIVE value - * @property {number} KINESIS_PERMISSION_DENIED=2 KINESIS_PERMISSION_DENIED value - * @property {number} PUBLISH_PERMISSION_DENIED=3 PUBLISH_PERMISSION_DENIED value - * @property {number} STREAM_NOT_FOUND=4 STREAM_NOT_FOUND value - * @property {number} CONSUMER_NOT_FOUND=5 CONSUMER_NOT_FOUND value - */ - AwsKinesis.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ACTIVE"] = 1; - values[valuesById[2] = "KINESIS_PERMISSION_DENIED"] = 2; - values[valuesById[3] = "PUBLISH_PERMISSION_DENIED"] = 3; - values[valuesById[4] = "STREAM_NOT_FOUND"] = 4; - values[valuesById[5] = "CONSUMER_NOT_FOUND"] = 5; - return values; - })(); + /** + * Gets the default type url for PlatformLogsSettings + * @function getTypeUrl + * @memberof google.pubsub.v1.PlatformLogsSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PlatformLogsSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.pubsub.v1.PlatformLogsSettings"; + }; - return AwsKinesis; + /** + * Severity enum. + * @name google.pubsub.v1.PlatformLogsSettings.Severity + * @enum {number} + * @property {number} SEVERITY_UNSPECIFIED=0 SEVERITY_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} DEBUG=2 DEBUG value + * @property {number} INFO=3 INFO value + * @property {number} WARNING=4 WARNING value + * @property {number} ERROR=5 ERROR value + */ + PlatformLogsSettings.Severity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEVERITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[2] = "DEBUG"] = 2; + values[valuesById[3] = "INFO"] = 3; + values[valuesById[4] = "WARNING"] = 4; + values[valuesById[5] = "ERROR"] = 5; + return values; })(); - return IngestionDataSourceSettings; + return PlatformLogsSettings; })(); v1.Topic = (function() { @@ -5902,6 +7253,7 @@ * @property {boolean|null} [enableExactlyOnceDelivery] Subscription enableExactlyOnceDelivery * @property {google.protobuf.IDuration|null} [topicMessageRetentionDuration] Subscription topicMessageRetentionDuration * @property {google.pubsub.v1.Subscription.State|null} [state] Subscription state + * @property {google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo|null} [analyticsHubSubscriptionInfo] Subscription analyticsHubSubscriptionInfo */ /** @@ -6064,6 +7416,14 @@ */ Subscription.prototype.state = 0; + /** + * Subscription analyticsHubSubscriptionInfo. + * @member {google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo|null|undefined} analyticsHubSubscriptionInfo + * @memberof google.pubsub.v1.Subscription + * @instance + */ + Subscription.prototype.analyticsHubSubscriptionInfo = null; + /** * Creates a new Subscription instance using the specified properties. * @function create @@ -6125,6 +7485,8 @@ writer.uint32(/* id 19, wireType 0 =*/152).int32(message.state); if (message.cloudStorageConfig != null && Object.hasOwnProperty.call(message, "cloudStorageConfig")) $root.google.pubsub.v1.CloudStorageConfig.encode(message.cloudStorageConfig, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.analyticsHubSubscriptionInfo != null && Object.hasOwnProperty.call(message, "analyticsHubSubscriptionInfo")) + $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.encode(message.analyticsHubSubscriptionInfo, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); return writer; }; @@ -6250,6 +7612,10 @@ message.state = reader.int32(); break; } + case 23: { + message.analyticsHubSubscriptionInfo = $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -6366,6 +7732,11 @@ case 2: break; } + if (message.analyticsHubSubscriptionInfo != null && message.hasOwnProperty("analyticsHubSubscriptionInfo")) { + var error = $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.verify(message.analyticsHubSubscriptionInfo); + if (error) + return "analyticsHubSubscriptionInfo." + error; + } return null; }; @@ -6464,6 +7835,11 @@ message.state = 2; break; } + if (object.analyticsHubSubscriptionInfo != null) { + if (typeof object.analyticsHubSubscriptionInfo !== "object") + throw TypeError(".google.pubsub.v1.Subscription.analyticsHubSubscriptionInfo: object expected"); + message.analyticsHubSubscriptionInfo = $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.fromObject(object.analyticsHubSubscriptionInfo); + } return message; }; @@ -6500,6 +7876,7 @@ object.bigqueryConfig = null; object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; object.cloudStorageConfig = null; + object.analyticsHubSubscriptionInfo = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -6541,6 +7918,8 @@ object.state = options.enums === String ? $root.google.pubsub.v1.Subscription.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.Subscription.State[message.state] : message.state; if (message.cloudStorageConfig != null && message.hasOwnProperty("cloudStorageConfig")) object.cloudStorageConfig = $root.google.pubsub.v1.CloudStorageConfig.toObject(message.cloudStorageConfig, options); + if (message.analyticsHubSubscriptionInfo != null && message.hasOwnProperty("analyticsHubSubscriptionInfo")) + object.analyticsHubSubscriptionInfo = $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.toObject(message.analyticsHubSubscriptionInfo, options); return object; }; @@ -6586,6 +7965,233 @@ return values; })(); + Subscription.AnalyticsHubSubscriptionInfo = (function() { + + /** + * Properties of an AnalyticsHubSubscriptionInfo. + * @memberof google.pubsub.v1.Subscription + * @interface IAnalyticsHubSubscriptionInfo + * @property {string|null} [listing] AnalyticsHubSubscriptionInfo listing + * @property {string|null} [subscription] AnalyticsHubSubscriptionInfo subscription + */ + + /** + * Constructs a new AnalyticsHubSubscriptionInfo. + * @memberof google.pubsub.v1.Subscription + * @classdesc Represents an AnalyticsHubSubscriptionInfo. + * @implements IAnalyticsHubSubscriptionInfo + * @constructor + * @param {google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo=} [properties] Properties to set + */ + function AnalyticsHubSubscriptionInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnalyticsHubSubscriptionInfo listing. + * @member {string} listing + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @instance + */ + AnalyticsHubSubscriptionInfo.prototype.listing = ""; + + /** + * AnalyticsHubSubscriptionInfo subscription. + * @member {string} subscription + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @instance + */ + AnalyticsHubSubscriptionInfo.prototype.subscription = ""; + + /** + * Creates a new AnalyticsHubSubscriptionInfo instance using the specified properties. + * @function create + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @static + * @param {google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo=} [properties] Properties to set + * @returns {google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo} AnalyticsHubSubscriptionInfo instance + */ + AnalyticsHubSubscriptionInfo.create = function create(properties) { + return new AnalyticsHubSubscriptionInfo(properties); + }; + + /** + * Encodes the specified AnalyticsHubSubscriptionInfo message. Does not implicitly {@link google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.verify|verify} messages. + * @function encode + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @static + * @param {google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo} message AnalyticsHubSubscriptionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyticsHubSubscriptionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.listing != null && Object.hasOwnProperty.call(message, "listing")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.listing); + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subscription); + return writer; + }; + + /** + * Encodes the specified AnalyticsHubSubscriptionInfo message, length delimited. Does not implicitly {@link google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @static + * @param {google.pubsub.v1.Subscription.IAnalyticsHubSubscriptionInfo} message AnalyticsHubSubscriptionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyticsHubSubscriptionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnalyticsHubSubscriptionInfo message from the specified reader or buffer. + * @function decode + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo} AnalyticsHubSubscriptionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyticsHubSubscriptionInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.listing = reader.string(); + break; + } + case 2: { + message.subscription = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnalyticsHubSubscriptionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo} AnalyticsHubSubscriptionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyticsHubSubscriptionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnalyticsHubSubscriptionInfo message. + * @function verify + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnalyticsHubSubscriptionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.listing != null && message.hasOwnProperty("listing")) + if (!$util.isString(message.listing)) + return "listing: string expected"; + if (message.subscription != null && message.hasOwnProperty("subscription")) + if (!$util.isString(message.subscription)) + return "subscription: string expected"; + return null; + }; + + /** + * Creates an AnalyticsHubSubscriptionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @static + * @param {Object.} object Plain object + * @returns {google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo} AnalyticsHubSubscriptionInfo + */ + AnalyticsHubSubscriptionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) + return object; + var message = new $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo(); + if (object.listing != null) + message.listing = String(object.listing); + if (object.subscription != null) + message.subscription = String(object.subscription); + return message; + }; + + /** + * Creates a plain object from an AnalyticsHubSubscriptionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @static + * @param {google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo} message AnalyticsHubSubscriptionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnalyticsHubSubscriptionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.listing = ""; + object.subscription = ""; + } + if (message.listing != null && message.hasOwnProperty("listing")) + object.listing = message.listing; + if (message.subscription != null && message.hasOwnProperty("subscription")) + object.subscription = message.subscription; + return object; + }; + + /** + * Converts this AnalyticsHubSubscriptionInfo to JSON. + * @function toJSON + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @instance + * @returns {Object.} JSON object + */ + AnalyticsHubSubscriptionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnalyticsHubSubscriptionInfo + * @function getTypeUrl + * @memberof google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnalyticsHubSubscriptionInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo"; + }; + + return AnalyticsHubSubscriptionInfo; + })(); + return Subscription; })(); diff --git a/protos/protos.json b/protos/protos.json index ad639ed00..8921f219f 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -247,7 +247,8 @@ "oneofs": { "source": { "oneof": [ - "awsKinesis" + "awsKinesis", + "cloudStorage" ] } }, @@ -258,6 +259,20 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "cloudStorage": { + "type": "CloudStorage", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "platformLogsSettings": { + "type": "PlatformLogsSettings", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } }, "nested": { @@ -311,6 +326,128 @@ } } } + }, + "CloudStorage": { + "oneofs": { + "inputFormat": { + "oneof": [ + "textFormat", + "avroFormat", + "pubsubAvroFormat" + ] + } + }, + "fields": { + "state": { + "type": "State", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "bucket": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "textFormat": { + "type": "TextFormat", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "avroFormat": { + "type": "AvroFormat", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pubsubAvroFormat": { + "type": "PubSubAvroFormat", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "minimumObjectCreateTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "matchGlob": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "CLOUD_STORAGE_PERMISSION_DENIED": 2, + "PUBLISH_PERMISSION_DENIED": 3, + "BUCKET_NOT_FOUND": 4, + "TOO_MANY_OBJECTS": 5 + } + }, + "TextFormat": { + "oneofs": { + "_delimiter": { + "oneof": [ + "delimiter" + ] + } + }, + "fields": { + "delimiter": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + } + }, + "AvroFormat": { + "fields": {} + }, + "PubSubAvroFormat": { + "fields": {} + } + } + } + } + }, + "PlatformLogsSettings": { + "fields": { + "severity": { + "type": "Severity", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Severity": { + "values": { + "SEVERITY_UNSPECIFIED": 0, + "DISABLED": 1, + "DEBUG": 2, + "INFO": 3, + "WARNING": 4, + "ERROR": 5 + } } } }, @@ -1088,6 +1225,13 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "analyticsHubSubscriptionInfo": { + "type": "AnalyticsHubSubscriptionInfo", + "id": 23, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -1097,6 +1241,24 @@ "ACTIVE": 1, "RESOURCE_ERROR": 2 } + }, + "AnalyticsHubSubscriptionInfo": { + "fields": { + "listing": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "subscription": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } } } }, diff --git a/src/v1/subscriber_client.ts b/src/v1/subscriber_client.ts index 0930d8f34..9daf16f61 100644 --- a/src/v1/subscriber_client.ts +++ b/src/v1/subscriber_client.ts @@ -583,6 +583,9 @@ export class SubscriberClient { * @param {google.pubsub.v1.Subscription.State} request.state * Output only. An output-only field indicating whether or not the * subscription can receive messages. + * @param {google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo} request.analyticsHubSubscriptionInfo + * Output only. Information about the associated Analytics Hub subscription. + * Only set if the subscritpion is created by Analytics Hub. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array.