diff --git a/.eslintignore b/.eslintignore index c4a0963e9..a5e47c7e7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,6 +3,7 @@ test/fixtures build/ docs/ +owl-bot-staging/ protos/ samples/generated/ system-test/**/fixtures diff --git a/.github/.header-checker-lint.yaml b/.github/.header-checker-lint.yaml new file mode 100644 index 000000000..e74512f1c --- /dev/null +++ b/.github/.header-checker-lint.yaml @@ -0,0 +1,12 @@ +allowedCopyrightHolders: + - 'Google LLC' +allowedLicenses: + - 'Apache-2.0' + - 'MIT' + - 'BSD-3' +sourceFileExtensions: + - 'ts' + - 'js' + - 'java' +ignoreFiles: + - 'owl-bot-staging/**' diff --git a/.gitignore b/.gitignore index 6e0935927..d4f03a0df 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ /docs/ /out/ /build/ -samples/build/ system-test/secrets.js system-test/*key.json *.lock diff --git a/owlbot.py b/owlbot.py index 10dfd88ea..f3e6252cc 100644 --- a/owlbot.py +++ b/owlbot.py @@ -27,5 +27,7 @@ node.owlbot_main(templates_excludes=[ 'src/index.ts', '.github/PULL_REQUEST_TEMPLATE.md', - '.github/release-please.yml' + '.github/release-please.yml', + '.github/header-checker-lint.yaml', + '.eslintignore' ]) diff --git a/protos/google/pubsub/v1/pubsub.proto b/protos/google/pubsub/v1/pubsub.proto index 8546dacf9..b70bda11a 100644 --- a/protos/google/pubsub/v1/pubsub.proto +++ b/protos/google/pubsub/v1/pubsub.proto @@ -1168,6 +1168,10 @@ message CloudStorageConfig { // data (for example, an ordering_key, if present) are added as entries in // the attributes map. bool write_metadata = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When true, the output Cloud Storage file will be serialized + // using the topic schema, if it exists. + bool use_topic_schema = 2 [(google.api.field_behavior) = OPTIONAL]; } // Possible states for a Cloud Storage subscription. @@ -1188,6 +1192,10 @@ message CloudStorageConfig { // Cannot write to the destination because enforce_in_transit is set to true // and the destination locations are not in the allowed regions. IN_TRANSIT_LOCATION_RESTRICTION = 4; + + // Cannot write to the Cloud Storage bucket due to an incompatibility + // between the topic schema and subscription settings. + SCHEMA_MISMATCH = 5; } // Required. User-provided name for the Cloud Storage bucket. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 17d730c34..19956f26c 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -3979,6 +3979,9 @@ export namespace google { /** AvroConfig writeMetadata */ writeMetadata?: (boolean|null); + + /** AvroConfig useTopicSchema */ + useTopicSchema?: (boolean|null); } /** Represents an AvroConfig. */ @@ -3993,6 +3996,9 @@ export namespace google { /** AvroConfig writeMetadata. */ public writeMetadata: boolean; + /** AvroConfig useTopicSchema. */ + public useTopicSchema: boolean; + /** * Creates a new AvroConfig instance using the specified properties. * @param [properties] Properties to set @@ -4077,7 +4083,8 @@ export namespace google { ACTIVE = 1, PERMISSION_DENIED = 2, NOT_FOUND = 3, - IN_TRANSIT_LOCATION_RESTRICTION = 4 + IN_TRANSIT_LOCATION_RESTRICTION = 4, + SCHEMA_MISMATCH = 5 } } diff --git a/protos/protos.js b/protos/protos.js index 65103b824..b439f7b68 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -8986,6 +8986,7 @@ case 2: case 3: case 4: + case 5: break; } if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) @@ -9065,6 +9066,10 @@ case 4: message.state = 4; break; + case "SCHEMA_MISMATCH": + case 5: + message.state = 5; + break; } if (object.serviceAccountEmail != null) message.serviceAccountEmail = String(object.serviceAccountEmail); @@ -9338,6 +9343,7 @@ * @memberof google.pubsub.v1.CloudStorageConfig * @interface IAvroConfig * @property {boolean|null} [writeMetadata] AvroConfig writeMetadata + * @property {boolean|null} [useTopicSchema] AvroConfig useTopicSchema */ /** @@ -9363,6 +9369,14 @@ */ AvroConfig.prototype.writeMetadata = false; + /** + * AvroConfig useTopicSchema. + * @member {boolean} useTopicSchema + * @memberof google.pubsub.v1.CloudStorageConfig.AvroConfig + * @instance + */ + AvroConfig.prototype.useTopicSchema = false; + /** * Creates a new AvroConfig instance using the specified properties. * @function create @@ -9389,6 +9403,8 @@ writer = $Writer.create(); if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.writeMetadata); + if (message.useTopicSchema != null && Object.hasOwnProperty.call(message, "useTopicSchema")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.useTopicSchema); return writer; }; @@ -9427,6 +9443,10 @@ message.writeMetadata = reader.bool(); break; } + case 2: { + message.useTopicSchema = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -9465,6 +9485,9 @@ if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) if (typeof message.writeMetadata !== "boolean") return "writeMetadata: boolean expected"; + if (message.useTopicSchema != null && message.hasOwnProperty("useTopicSchema")) + if (typeof message.useTopicSchema !== "boolean") + return "useTopicSchema: boolean expected"; return null; }; @@ -9482,6 +9505,8 @@ var message = new $root.google.pubsub.v1.CloudStorageConfig.AvroConfig(); if (object.writeMetadata != null) message.writeMetadata = Boolean(object.writeMetadata); + if (object.useTopicSchema != null) + message.useTopicSchema = Boolean(object.useTopicSchema); return message; }; @@ -9498,10 +9523,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.writeMetadata = false; + object.useTopicSchema = false; + } if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) object.writeMetadata = message.writeMetadata; + if (message.useTopicSchema != null && message.hasOwnProperty("useTopicSchema")) + object.useTopicSchema = message.useTopicSchema; return object; }; @@ -9543,6 +9572,7 @@ * @property {number} PERMISSION_DENIED=2 PERMISSION_DENIED value * @property {number} NOT_FOUND=3 NOT_FOUND value * @property {number} IN_TRANSIT_LOCATION_RESTRICTION=4 IN_TRANSIT_LOCATION_RESTRICTION value + * @property {number} SCHEMA_MISMATCH=5 SCHEMA_MISMATCH value */ CloudStorageConfig.State = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -9551,6 +9581,7 @@ values[valuesById[2] = "PERMISSION_DENIED"] = 2; values[valuesById[3] = "NOT_FOUND"] = 3; values[valuesById[4] = "IN_TRANSIT_LOCATION_RESTRICTION"] = 4; + values[valuesById[5] = "SCHEMA_MISMATCH"] = 5; return values; })(); diff --git a/protos/protos.json b/protos/protos.json index e37e3bd25..6497622c4 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -1389,6 +1389,13 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "useTopicSchema": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -1398,7 +1405,8 @@ "ACTIVE": 1, "PERMISSION_DENIED": 2, "NOT_FOUND": 3, - "IN_TRANSIT_LOCATION_RESTRICTION": 4 + "IN_TRANSIT_LOCATION_RESTRICTION": 4, + "SCHEMA_MISMATCH": 5 } } } diff --git a/samples/.gitignore b/samples/.gitignore new file mode 100644 index 000000000..567609b12 --- /dev/null +++ b/samples/.gitignore @@ -0,0 +1 @@ +build/