From 8ce8aacb3944f194e5462813d89501be49118c57 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 May 2021 21:58:10 +0000 Subject: [PATCH] fix: use require() to load JSON protos (#225) The library is regenerated with gapic-generator-typescript v1.3.1. Committer: @alexander-fenster PiperOrigin-RevId: 372468161 Source-Link: https://github.com/googleapis/googleapis/commit/75880c3e6a6aa2597400582848e81bbbfac51dea Source-Link: https://github.com/googleapis/googleapis-gen/commit/77b18044813d4c8c415ff9ea68e76e307eb8e904 --- .../devtools/cloudbuild/v1/cloudbuild.proto | 27 ++ .../protos/protos.d.ts | 116 ++++++- .../protos/protos.js | 311 +++++++++++++++++- .../protos/protos.json | 27 +- .../src/v1/cloud_build_client.ts | 26 +- 5 files changed, 481 insertions(+), 26 deletions(-) diff --git a/packages/google-devtools-cloudbuild/protos/google/devtools/cloudbuild/v1/cloudbuild.proto b/packages/google-devtools-cloudbuild/protos/google/devtools/cloudbuild/v1/cloudbuild.proto index 938e37e9198..50bedcd8b4d 100644 --- a/packages/google-devtools-cloudbuild/protos/google/devtools/cloudbuild/v1/cloudbuild.proto +++ b/packages/google-devtools-cloudbuild/protos/google/devtools/cloudbuild/v1/cloudbuild.proto @@ -370,6 +370,24 @@ message RepoSource { map substitutions = 9; } +// Location of the source manifest in Google Cloud Storage. +// This feature is in Preview. +message StorageSourceManifest { + // Google Cloud Storage bucket containing the source manifest (see [Bucket + // Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source manifest. + // + // This object must be a JSON file. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + // Location of the source in a supported storage service. message Source { // Location of source. @@ -380,6 +398,10 @@ message Source { // If provided, get the source from this location in a Cloud Source // Repository. RepoSource repo_source = 3; + + // If provided, get the source from this manifest in Google Cloud Storage. + // This feature is in Preview. + StorageSourceManifest storage_source_manifest = 8; } } @@ -803,6 +825,11 @@ message SourceProvenance { // revisions resolved. RepoSource resolved_repo_source = 6; + // A copy of the build's `source.storage_source_manifest`, if exists, with any + // revisions resolved. + // This feature is in Preview. + StorageSourceManifest resolved_storage_source_manifest = 9; + // Output only. Hash(es) of the build source, which can be used to verify that // the original source integrity was maintained in the build. Note that // `FileHashes` will only be populated if `BuildOptions` has requested a diff --git a/packages/google-devtools-cloudbuild/protos/protos.d.ts b/packages/google-devtools-cloudbuild/protos/protos.d.ts index fa63b0d030b..673e9f433e2 100644 --- a/packages/google-devtools-cloudbuild/protos/protos.d.ts +++ b/packages/google-devtools-cloudbuild/protos/protos.d.ts @@ -848,6 +848,108 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a StorageSourceManifest. */ + interface IStorageSourceManifest { + + /** StorageSourceManifest bucket */ + bucket?: (string|null); + + /** StorageSourceManifest object */ + object?: (string|null); + + /** StorageSourceManifest generation */ + generation?: (number|Long|string|null); + } + + /** Represents a StorageSourceManifest. */ + class StorageSourceManifest implements IStorageSourceManifest { + + /** + * Constructs a new StorageSourceManifest. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudbuild.v1.IStorageSourceManifest); + + /** StorageSourceManifest bucket. */ + public bucket: string; + + /** StorageSourceManifest object. */ + public object: string; + + /** StorageSourceManifest generation. */ + public generation: (number|Long|string); + + /** + * Creates a new StorageSourceManifest instance using the specified properties. + * @param [properties] Properties to set + * @returns StorageSourceManifest instance + */ + public static create(properties?: google.devtools.cloudbuild.v1.IStorageSourceManifest): google.devtools.cloudbuild.v1.StorageSourceManifest; + + /** + * Encodes the specified StorageSourceManifest message. Does not implicitly {@link google.devtools.cloudbuild.v1.StorageSourceManifest.verify|verify} messages. + * @param message StorageSourceManifest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudbuild.v1.IStorageSourceManifest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StorageSourceManifest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.StorageSourceManifest.verify|verify} messages. + * @param message StorageSourceManifest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudbuild.v1.IStorageSourceManifest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StorageSourceManifest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StorageSourceManifest + * @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.devtools.cloudbuild.v1.StorageSourceManifest; + + /** + * Decodes a StorageSourceManifest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StorageSourceManifest + * @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.devtools.cloudbuild.v1.StorageSourceManifest; + + /** + * Verifies a StorageSourceManifest 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 StorageSourceManifest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StorageSourceManifest + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudbuild.v1.StorageSourceManifest; + + /** + * Creates a plain object from a StorageSourceManifest message. Also converts values to other types if specified. + * @param message StorageSourceManifest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudbuild.v1.StorageSourceManifest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StorageSourceManifest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a Source. */ interface ISource { @@ -856,6 +958,9 @@ export namespace google { /** Source repoSource */ repoSource?: (google.devtools.cloudbuild.v1.IRepoSource|null); + + /** Source storageSourceManifest */ + storageSourceManifest?: (google.devtools.cloudbuild.v1.IStorageSourceManifest|null); } /** Represents a Source. */ @@ -873,8 +978,11 @@ export namespace google { /** Source repoSource. */ public repoSource?: (google.devtools.cloudbuild.v1.IRepoSource|null); + /** Source storageSourceManifest. */ + public storageSourceManifest?: (google.devtools.cloudbuild.v1.IStorageSourceManifest|null); + /** Source source. */ - public source?: ("storageSource"|"repoSource"); + public source?: ("storageSource"|"repoSource"|"storageSourceManifest"); /** * Creates a new Source instance using the specified properties. @@ -2175,6 +2283,9 @@ export namespace google { /** SourceProvenance resolvedRepoSource */ resolvedRepoSource?: (google.devtools.cloudbuild.v1.IRepoSource|null); + /** SourceProvenance resolvedStorageSourceManifest */ + resolvedStorageSourceManifest?: (google.devtools.cloudbuild.v1.IStorageSourceManifest|null); + /** SourceProvenance fileHashes */ fileHashes?: ({ [k: string]: google.devtools.cloudbuild.v1.IFileHashes }|null); } @@ -2194,6 +2305,9 @@ export namespace google { /** SourceProvenance resolvedRepoSource. */ public resolvedRepoSource?: (google.devtools.cloudbuild.v1.IRepoSource|null); + /** SourceProvenance resolvedStorageSourceManifest. */ + public resolvedStorageSourceManifest?: (google.devtools.cloudbuild.v1.IStorageSourceManifest|null); + /** SourceProvenance fileHashes. */ public fileHashes: { [k: string]: google.devtools.cloudbuild.v1.IFileHashes }; diff --git a/packages/google-devtools-cloudbuild/protos/protos.js b/packages/google-devtools-cloudbuild/protos/protos.js index 7413c5891f3..d5e3bed6969 100644 --- a/packages/google-devtools-cloudbuild/protos/protos.js +++ b/packages/google-devtools-cloudbuild/protos/protos.js @@ -1786,6 +1786,252 @@ return RepoSource; })(); + v1.StorageSourceManifest = (function() { + + /** + * Properties of a StorageSourceManifest. + * @memberof google.devtools.cloudbuild.v1 + * @interface IStorageSourceManifest + * @property {string|null} [bucket] StorageSourceManifest bucket + * @property {string|null} [object] StorageSourceManifest object + * @property {number|Long|null} [generation] StorageSourceManifest generation + */ + + /** + * Constructs a new StorageSourceManifest. + * @memberof google.devtools.cloudbuild.v1 + * @classdesc Represents a StorageSourceManifest. + * @implements IStorageSourceManifest + * @constructor + * @param {google.devtools.cloudbuild.v1.IStorageSourceManifest=} [properties] Properties to set + */ + function StorageSourceManifest(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]]; + } + + /** + * StorageSourceManifest bucket. + * @member {string} bucket + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @instance + */ + StorageSourceManifest.prototype.bucket = ""; + + /** + * StorageSourceManifest object. + * @member {string} object + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @instance + */ + StorageSourceManifest.prototype.object = ""; + + /** + * StorageSourceManifest generation. + * @member {number|Long} generation + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @instance + */ + StorageSourceManifest.prototype.generation = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new StorageSourceManifest instance using the specified properties. + * @function create + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @static + * @param {google.devtools.cloudbuild.v1.IStorageSourceManifest=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.StorageSourceManifest} StorageSourceManifest instance + */ + StorageSourceManifest.create = function create(properties) { + return new StorageSourceManifest(properties); + }; + + /** + * Encodes the specified StorageSourceManifest message. Does not implicitly {@link google.devtools.cloudbuild.v1.StorageSourceManifest.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @static + * @param {google.devtools.cloudbuild.v1.IStorageSourceManifest} message StorageSourceManifest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSourceManifest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.bucket); + if (message.object != null && Object.hasOwnProperty.call(message, "object")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.object); + if (message.generation != null && Object.hasOwnProperty.call(message, "generation")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.generation); + return writer; + }; + + /** + * Encodes the specified StorageSourceManifest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.StorageSourceManifest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @static + * @param {google.devtools.cloudbuild.v1.IStorageSourceManifest} message StorageSourceManifest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSourceManifest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StorageSourceManifest message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudbuild.v1.StorageSourceManifest} StorageSourceManifest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSourceManifest.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.devtools.cloudbuild.v1.StorageSourceManifest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bucket = reader.string(); + break; + case 2: + message.object = reader.string(); + break; + case 3: + message.generation = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StorageSourceManifest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudbuild.v1.StorageSourceManifest} StorageSourceManifest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSourceManifest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StorageSourceManifest message. + * @function verify + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StorageSourceManifest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bucket != null && message.hasOwnProperty("bucket")) + if (!$util.isString(message.bucket)) + return "bucket: string expected"; + if (message.object != null && message.hasOwnProperty("object")) + if (!$util.isString(message.object)) + return "object: string expected"; + if (message.generation != null && message.hasOwnProperty("generation")) + if (!$util.isInteger(message.generation) && !(message.generation && $util.isInteger(message.generation.low) && $util.isInteger(message.generation.high))) + return "generation: integer|Long expected"; + return null; + }; + + /** + * Creates a StorageSourceManifest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudbuild.v1.StorageSourceManifest} StorageSourceManifest + */ + StorageSourceManifest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.StorageSourceManifest) + return object; + var message = new $root.google.devtools.cloudbuild.v1.StorageSourceManifest(); + if (object.bucket != null) + message.bucket = String(object.bucket); + if (object.object != null) + message.object = String(object.object); + if (object.generation != null) + if ($util.Long) + (message.generation = $util.Long.fromValue(object.generation)).unsigned = false; + else if (typeof object.generation === "string") + message.generation = parseInt(object.generation, 10); + else if (typeof object.generation === "number") + message.generation = object.generation; + else if (typeof object.generation === "object") + message.generation = new $util.LongBits(object.generation.low >>> 0, object.generation.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a StorageSourceManifest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @static + * @param {google.devtools.cloudbuild.v1.StorageSourceManifest} message StorageSourceManifest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StorageSourceManifest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.bucket = ""; + object.object = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.generation = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.generation = options.longs === String ? "0" : 0; + } + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = message.bucket; + if (message.object != null && message.hasOwnProperty("object")) + object.object = message.object; + if (message.generation != null && message.hasOwnProperty("generation")) + if (typeof message.generation === "number") + object.generation = options.longs === String ? String(message.generation) : message.generation; + else + object.generation = options.longs === String ? $util.Long.prototype.toString.call(message.generation) : options.longs === Number ? new $util.LongBits(message.generation.low >>> 0, message.generation.high >>> 0).toNumber() : message.generation; + return object; + }; + + /** + * Converts this StorageSourceManifest to JSON. + * @function toJSON + * @memberof google.devtools.cloudbuild.v1.StorageSourceManifest + * @instance + * @returns {Object.} JSON object + */ + StorageSourceManifest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StorageSourceManifest; + })(); + v1.Source = (function() { /** @@ -1794,6 +2040,7 @@ * @interface ISource * @property {google.devtools.cloudbuild.v1.IStorageSource|null} [storageSource] Source storageSource * @property {google.devtools.cloudbuild.v1.IRepoSource|null} [repoSource] Source repoSource + * @property {google.devtools.cloudbuild.v1.IStorageSourceManifest|null} [storageSourceManifest] Source storageSourceManifest */ /** @@ -1827,17 +2074,25 @@ */ Source.prototype.repoSource = null; + /** + * Source storageSourceManifest. + * @member {google.devtools.cloudbuild.v1.IStorageSourceManifest|null|undefined} storageSourceManifest + * @memberof google.devtools.cloudbuild.v1.Source + * @instance + */ + Source.prototype.storageSourceManifest = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * Source source. - * @member {"storageSource"|"repoSource"|undefined} source + * @member {"storageSource"|"repoSource"|"storageSourceManifest"|undefined} source * @memberof google.devtools.cloudbuild.v1.Source * @instance */ Object.defineProperty(Source.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["storageSource", "repoSource"]), + get: $util.oneOfGetter($oneOfFields = ["storageSource", "repoSource", "storageSourceManifest"]), set: $util.oneOfSetter($oneOfFields) }); @@ -1869,6 +2124,8 @@ $root.google.devtools.cloudbuild.v1.StorageSource.encode(message.storageSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.repoSource != null && Object.hasOwnProperty.call(message, "repoSource")) $root.google.devtools.cloudbuild.v1.RepoSource.encode(message.repoSource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.storageSourceManifest != null && Object.hasOwnProperty.call(message, "storageSourceManifest")) + $root.google.devtools.cloudbuild.v1.StorageSourceManifest.encode(message.storageSourceManifest, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; @@ -1909,6 +2166,9 @@ case 3: message.repoSource = $root.google.devtools.cloudbuild.v1.RepoSource.decode(reader, reader.uint32()); break; + case 8: + message.storageSourceManifest = $root.google.devtools.cloudbuild.v1.StorageSourceManifest.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -1963,6 +2223,16 @@ return "repoSource." + error; } } + if (message.storageSourceManifest != null && message.hasOwnProperty("storageSourceManifest")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.devtools.cloudbuild.v1.StorageSourceManifest.verify(message.storageSourceManifest); + if (error) + return "storageSourceManifest." + error; + } + } return null; }; @@ -1988,6 +2258,11 @@ throw TypeError(".google.devtools.cloudbuild.v1.Source.repoSource: object expected"); message.repoSource = $root.google.devtools.cloudbuild.v1.RepoSource.fromObject(object.repoSource); } + if (object.storageSourceManifest != null) { + if (typeof object.storageSourceManifest !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.Source.storageSourceManifest: object expected"); + message.storageSourceManifest = $root.google.devtools.cloudbuild.v1.StorageSourceManifest.fromObject(object.storageSourceManifest); + } return message; }; @@ -2014,6 +2289,11 @@ if (options.oneofs) object.source = "repoSource"; } + if (message.storageSourceManifest != null && message.hasOwnProperty("storageSourceManifest")) { + object.storageSourceManifest = $root.google.devtools.cloudbuild.v1.StorageSourceManifest.toObject(message.storageSourceManifest, options); + if (options.oneofs) + object.source = "storageSourceManifest"; + } return object; }; @@ -5614,6 +5894,7 @@ * @interface ISourceProvenance * @property {google.devtools.cloudbuild.v1.IStorageSource|null} [resolvedStorageSource] SourceProvenance resolvedStorageSource * @property {google.devtools.cloudbuild.v1.IRepoSource|null} [resolvedRepoSource] SourceProvenance resolvedRepoSource + * @property {google.devtools.cloudbuild.v1.IStorageSourceManifest|null} [resolvedStorageSourceManifest] SourceProvenance resolvedStorageSourceManifest * @property {Object.|null} [fileHashes] SourceProvenance fileHashes */ @@ -5649,6 +5930,14 @@ */ SourceProvenance.prototype.resolvedRepoSource = null; + /** + * SourceProvenance resolvedStorageSourceManifest. + * @member {google.devtools.cloudbuild.v1.IStorageSourceManifest|null|undefined} resolvedStorageSourceManifest + * @memberof google.devtools.cloudbuild.v1.SourceProvenance + * @instance + */ + SourceProvenance.prototype.resolvedStorageSourceManifest = null; + /** * SourceProvenance fileHashes. * @member {Object.} fileHashes @@ -5690,6 +5979,8 @@ } if (message.resolvedRepoSource != null && Object.hasOwnProperty.call(message, "resolvedRepoSource")) $root.google.devtools.cloudbuild.v1.RepoSource.encode(message.resolvedRepoSource, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.resolvedStorageSourceManifest != null && Object.hasOwnProperty.call(message, "resolvedStorageSourceManifest")) + $root.google.devtools.cloudbuild.v1.StorageSourceManifest.encode(message.resolvedStorageSourceManifest, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; @@ -5730,6 +6021,9 @@ case 6: message.resolvedRepoSource = $root.google.devtools.cloudbuild.v1.RepoSource.decode(reader, reader.uint32()); break; + case 9: + message.resolvedStorageSourceManifest = $root.google.devtools.cloudbuild.v1.StorageSourceManifest.decode(reader, reader.uint32()); + break; case 4: if (message.fileHashes === $util.emptyObject) message.fileHashes = {}; @@ -5797,6 +6091,11 @@ if (error) return "resolvedRepoSource." + error; } + if (message.resolvedStorageSourceManifest != null && message.hasOwnProperty("resolvedStorageSourceManifest")) { + var error = $root.google.devtools.cloudbuild.v1.StorageSourceManifest.verify(message.resolvedStorageSourceManifest); + if (error) + return "resolvedStorageSourceManifest." + error; + } if (message.fileHashes != null && message.hasOwnProperty("fileHashes")) { if (!$util.isObject(message.fileHashes)) return "fileHashes: object expected"; @@ -5832,6 +6131,11 @@ throw TypeError(".google.devtools.cloudbuild.v1.SourceProvenance.resolvedRepoSource: object expected"); message.resolvedRepoSource = $root.google.devtools.cloudbuild.v1.RepoSource.fromObject(object.resolvedRepoSource); } + if (object.resolvedStorageSourceManifest != null) { + if (typeof object.resolvedStorageSourceManifest !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.SourceProvenance.resolvedStorageSourceManifest: object expected"); + message.resolvedStorageSourceManifest = $root.google.devtools.cloudbuild.v1.StorageSourceManifest.fromObject(object.resolvedStorageSourceManifest); + } if (object.fileHashes) { if (typeof object.fileHashes !== "object") throw TypeError(".google.devtools.cloudbuild.v1.SourceProvenance.fileHashes: object expected"); @@ -5863,6 +6167,7 @@ if (options.defaults) { object.resolvedStorageSource = null; object.resolvedRepoSource = null; + object.resolvedStorageSourceManifest = null; } if (message.resolvedStorageSource != null && message.hasOwnProperty("resolvedStorageSource")) object.resolvedStorageSource = $root.google.devtools.cloudbuild.v1.StorageSource.toObject(message.resolvedStorageSource, options); @@ -5874,6 +6179,8 @@ } if (message.resolvedRepoSource != null && message.hasOwnProperty("resolvedRepoSource")) object.resolvedRepoSource = $root.google.devtools.cloudbuild.v1.RepoSource.toObject(message.resolvedRepoSource, options); + if (message.resolvedStorageSourceManifest != null && message.hasOwnProperty("resolvedStorageSourceManifest")) + object.resolvedStorageSourceManifest = $root.google.devtools.cloudbuild.v1.StorageSourceManifest.toObject(message.resolvedStorageSourceManifest, options); return object; }; diff --git a/packages/google-devtools-cloudbuild/protos/protos.json b/packages/google-devtools-cloudbuild/protos/protos.json index 1b532ad117c..e75c61de2df 100644 --- a/packages/google-devtools-cloudbuild/protos/protos.json +++ b/packages/google-devtools-cloudbuild/protos/protos.json @@ -431,12 +431,29 @@ } } }, + "StorageSourceManifest": { + "fields": { + "bucket": { + "type": "string", + "id": 1 + }, + "object": { + "type": "string", + "id": 2 + }, + "generation": { + "type": "int64", + "id": 3 + } + } + }, "Source": { "oneofs": { "source": { "oneof": [ "storageSource", - "repoSource" + "repoSource", + "storageSourceManifest" ] } }, @@ -448,6 +465,10 @@ "repoSource": { "type": "RepoSource", "id": 3 + }, + "storageSourceManifest": { + "type": "StorageSourceManifest", + "id": 8 } } }, @@ -836,6 +857,10 @@ "type": "RepoSource", "id": 6 }, + "resolvedStorageSourceManifest": { + "type": "StorageSourceManifest", + "id": 9 + }, "fileHashes": { "keyType": "string", "type": "FileHashes", diff --git a/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts b/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts index 80ca891d500..dca2e0d8d36 100644 --- a/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts +++ b/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts @@ -32,6 +32,7 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v1/cloud_build_client_config.json`. @@ -154,22 +155,7 @@ export class CloudBuildClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. @@ -220,15 +206,11 @@ export class CloudBuildClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - const protoFilesRoot = opts.fallback - ? this._gaxModule.protobuf.Root.fromJSON( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - ) - : this._gaxModule.protobuf.loadSync(nodejsProtoPath); this.operationsClient = this._gaxModule .lro({