diff --git a/packages/google-container/protos/google/container/v1/cluster_service.proto b/packages/google-container/protos/google/container/v1/cluster_service.proto index 8b808349c21..4323b2d714e 100644 --- a/packages/google-container/protos/google/container/v1/cluster_service.proto +++ b/packages/google-container/protos/google/container/v1/cluster_service.proto @@ -4719,12 +4719,68 @@ message DatabaseEncryption { DECRYPTED = 2; } + // Current State of etcd encryption. + enum CurrentState { + // Should never be set + CURRENT_STATE_UNSPECIFIED = 0; + + // Secrets in etcd are encrypted. + CURRENT_STATE_ENCRYPTED = 7; + + // Secrets in etcd are stored in plain text (at etcd level) - this is + // unrelated to Compute Engine level full disk encryption. + CURRENT_STATE_DECRYPTED = 2; + + // Encryption (or re-encryption with a different CloudKMS key) + // of Secrets is in progress. + CURRENT_STATE_ENCRYPTION_PENDING = 3; + + // Encryption (or re-encryption with a different CloudKMS key) of Secrets in + // etcd encountered an error. + CURRENT_STATE_ENCRYPTION_ERROR = 4; + + // De-crypting Secrets to plain text in etcd is in progress. + CURRENT_STATE_DECRYPTION_PENDING = 5; + + // De-crypting Secrets to plain text in etcd encountered an error. + CURRENT_STATE_DECRYPTION_ERROR = 6; + } + + // OperationError records errors seen from CloudKMS keys + // encountered during updates to DatabaseEncryption configuration. + message OperationError { + // CloudKMS key resource that had the error. + string key_name = 1; + + // Description of the error seen during the operation. + string error_message = 2; + + // Time when the CloudKMS error was seen. + google.protobuf.Timestamp timestamp = 3; + } + // Name of CloudKMS key to use for the encryption of secrets in etcd. // Ex. projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key string key_name = 1; // The desired state of etcd encryption. State state = 2; + + // Output only. The current state of etcd encryption. + optional CurrentState current_state = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Keys in use by the cluster for decrypting + // existing objects, in addition to the key in `key_name`. + // + // Each item is a CloudKMS key resource. + repeated string decryption_keys = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Records errors seen during DatabaseEncryption update + // operations. + repeated OperationError last_operation_errors = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // ListUsableSubnetworksRequest requests the list of usable subnetworks diff --git a/packages/google-container/protos/google/container/v1beta1/cluster_service.proto b/packages/google-container/protos/google/container/v1beta1/cluster_service.proto index ba97b25b466..4d7e1e23f8e 100644 --- a/packages/google-container/protos/google/container/v1beta1/cluster_service.proto +++ b/packages/google-container/protos/google/container/v1beta1/cluster_service.proto @@ -5265,12 +5265,68 @@ message DatabaseEncryption { DECRYPTED = 2; } + // Current State of etcd encryption. + enum CurrentState { + // Should never be set + CURRENT_STATE_UNSPECIFIED = 0; + + // Secrets in etcd are encrypted. + CURRENT_STATE_ENCRYPTED = 7; + + // Secrets in etcd are stored in plain text (at etcd level) - this is + // unrelated to Compute Engine level full disk encryption. + CURRENT_STATE_DECRYPTED = 2; + + // Encryption (or re-encryption with a different CloudKMS key) + // of Secrets is in progress. + CURRENT_STATE_ENCRYPTION_PENDING = 3; + + // Encryption (or re-encryption with a different CloudKMS key) of Secrets in + // etcd encountered an error. + CURRENT_STATE_ENCRYPTION_ERROR = 4; + + // De-crypting Secrets to plain text in etcd is in progress. + CURRENT_STATE_DECRYPTION_PENDING = 5; + + // De-crypting Secrets to plain text in etcd encountered an error. + CURRENT_STATE_DECRYPTION_ERROR = 6; + } + + // OperationError records errors seen from CloudKMS keys + // encountered during updates to DatabaseEncryption configuration. + message OperationError { + // CloudKMS key resource that had the error. + string key_name = 1; + + // Description of the error seen during the operation. + string error_message = 2; + + // Time when the CloudKMS error was seen. + google.protobuf.Timestamp timestamp = 3; + } + // Name of CloudKMS key to use for the encryption of secrets in etcd. // Ex. projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key string key_name = 1; // The desired state of etcd encryption. State state = 2; + + // Output only. The current state of etcd encryption. + optional CurrentState current_state = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Keys in use by the cluster for decrypting + // existing objects, in addition to the key in `key_name`. + // + // Each item is a CloudKMS key resource. + repeated string decryption_keys = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Records errors seen during DatabaseEncryption update + // operations. + repeated OperationError last_operation_errors = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // Configuration for exporting cluster resource usages. diff --git a/packages/google-container/protos/protos.d.ts b/packages/google-container/protos/protos.d.ts index f52cd7e5b2f..c135ecbad84 100644 --- a/packages/google-container/protos/protos.d.ts +++ b/packages/google-container/protos/protos.d.ts @@ -17863,6 +17863,15 @@ export namespace google { /** DatabaseEncryption state */ state?: (google.container.v1.DatabaseEncryption.State|keyof typeof google.container.v1.DatabaseEncryption.State|null); + + /** DatabaseEncryption currentState */ + currentState?: (google.container.v1.DatabaseEncryption.CurrentState|keyof typeof google.container.v1.DatabaseEncryption.CurrentState|null); + + /** DatabaseEncryption decryptionKeys */ + decryptionKeys?: (string[]|null); + + /** DatabaseEncryption lastOperationErrors */ + lastOperationErrors?: (google.container.v1.DatabaseEncryption.IOperationError[]|null); } /** Represents a DatabaseEncryption. */ @@ -17880,6 +17889,18 @@ export namespace google { /** DatabaseEncryption state. */ public state: (google.container.v1.DatabaseEncryption.State|keyof typeof google.container.v1.DatabaseEncryption.State); + /** DatabaseEncryption currentState. */ + public currentState?: (google.container.v1.DatabaseEncryption.CurrentState|keyof typeof google.container.v1.DatabaseEncryption.CurrentState|null); + + /** DatabaseEncryption decryptionKeys. */ + public decryptionKeys: string[]; + + /** DatabaseEncryption lastOperationErrors. */ + public lastOperationErrors: google.container.v1.DatabaseEncryption.IOperationError[]; + + /** DatabaseEncryption _currentState. */ + public _currentState?: "currentState"; + /** * Creates a new DatabaseEncryption instance using the specified properties. * @param [properties] Properties to set @@ -17966,6 +17987,126 @@ export namespace google { ENCRYPTED = 1, DECRYPTED = 2 } + + /** CurrentState enum. */ + enum CurrentState { + CURRENT_STATE_UNSPECIFIED = 0, + CURRENT_STATE_ENCRYPTED = 7, + CURRENT_STATE_DECRYPTED = 2, + CURRENT_STATE_ENCRYPTION_PENDING = 3, + CURRENT_STATE_ENCRYPTION_ERROR = 4, + CURRENT_STATE_DECRYPTION_PENDING = 5, + CURRENT_STATE_DECRYPTION_ERROR = 6 + } + + /** Properties of an OperationError. */ + interface IOperationError { + + /** OperationError keyName */ + keyName?: (string|null); + + /** OperationError errorMessage */ + errorMessage?: (string|null); + + /** OperationError timestamp */ + timestamp?: (google.protobuf.ITimestamp|null); + } + + /** Represents an OperationError. */ + class OperationError implements IOperationError { + + /** + * Constructs a new OperationError. + * @param [properties] Properties to set + */ + constructor(properties?: google.container.v1.DatabaseEncryption.IOperationError); + + /** OperationError keyName. */ + public keyName: string; + + /** OperationError errorMessage. */ + public errorMessage: string; + + /** OperationError timestamp. */ + public timestamp?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new OperationError instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationError instance + */ + public static create(properties?: google.container.v1.DatabaseEncryption.IOperationError): google.container.v1.DatabaseEncryption.OperationError; + + /** + * Encodes the specified OperationError message. Does not implicitly {@link google.container.v1.DatabaseEncryption.OperationError.verify|verify} messages. + * @param message OperationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.container.v1.DatabaseEncryption.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.container.v1.DatabaseEncryption.OperationError.verify|verify} messages. + * @param message OperationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.container.v1.DatabaseEncryption.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationError + * @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.container.v1.DatabaseEncryption.OperationError; + + /** + * Decodes an OperationError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationError + * @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.container.v1.DatabaseEncryption.OperationError; + + /** + * Verifies an OperationError 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 OperationError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationError + */ + public static fromObject(object: { [k: string]: any }): google.container.v1.DatabaseEncryption.OperationError; + + /** + * Creates a plain object from an OperationError message. Also converts values to other types if specified. + * @param message OperationError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.container.v1.DatabaseEncryption.OperationError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of a ListUsableSubnetworksRequest. */ @@ -41690,6 +41831,15 @@ export namespace google { /** DatabaseEncryption state */ state?: (google.container.v1beta1.DatabaseEncryption.State|keyof typeof google.container.v1beta1.DatabaseEncryption.State|null); + + /** DatabaseEncryption currentState */ + currentState?: (google.container.v1beta1.DatabaseEncryption.CurrentState|keyof typeof google.container.v1beta1.DatabaseEncryption.CurrentState|null); + + /** DatabaseEncryption decryptionKeys */ + decryptionKeys?: (string[]|null); + + /** DatabaseEncryption lastOperationErrors */ + lastOperationErrors?: (google.container.v1beta1.DatabaseEncryption.IOperationError[]|null); } /** Represents a DatabaseEncryption. */ @@ -41707,6 +41857,18 @@ export namespace google { /** DatabaseEncryption state. */ public state: (google.container.v1beta1.DatabaseEncryption.State|keyof typeof google.container.v1beta1.DatabaseEncryption.State); + /** DatabaseEncryption currentState. */ + public currentState?: (google.container.v1beta1.DatabaseEncryption.CurrentState|keyof typeof google.container.v1beta1.DatabaseEncryption.CurrentState|null); + + /** DatabaseEncryption decryptionKeys. */ + public decryptionKeys: string[]; + + /** DatabaseEncryption lastOperationErrors. */ + public lastOperationErrors: google.container.v1beta1.DatabaseEncryption.IOperationError[]; + + /** DatabaseEncryption _currentState. */ + public _currentState?: "currentState"; + /** * Creates a new DatabaseEncryption instance using the specified properties. * @param [properties] Properties to set @@ -41793,6 +41955,126 @@ export namespace google { ENCRYPTED = 1, DECRYPTED = 2 } + + /** CurrentState enum. */ + enum CurrentState { + CURRENT_STATE_UNSPECIFIED = 0, + CURRENT_STATE_ENCRYPTED = 7, + CURRENT_STATE_DECRYPTED = 2, + CURRENT_STATE_ENCRYPTION_PENDING = 3, + CURRENT_STATE_ENCRYPTION_ERROR = 4, + CURRENT_STATE_DECRYPTION_PENDING = 5, + CURRENT_STATE_DECRYPTION_ERROR = 6 + } + + /** Properties of an OperationError. */ + interface IOperationError { + + /** OperationError keyName */ + keyName?: (string|null); + + /** OperationError errorMessage */ + errorMessage?: (string|null); + + /** OperationError timestamp */ + timestamp?: (google.protobuf.ITimestamp|null); + } + + /** Represents an OperationError. */ + class OperationError implements IOperationError { + + /** + * Constructs a new OperationError. + * @param [properties] Properties to set + */ + constructor(properties?: google.container.v1beta1.DatabaseEncryption.IOperationError); + + /** OperationError keyName. */ + public keyName: string; + + /** OperationError errorMessage. */ + public errorMessage: string; + + /** OperationError timestamp. */ + public timestamp?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new OperationError instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationError instance + */ + public static create(properties?: google.container.v1beta1.DatabaseEncryption.IOperationError): google.container.v1beta1.DatabaseEncryption.OperationError; + + /** + * Encodes the specified OperationError message. Does not implicitly {@link google.container.v1beta1.DatabaseEncryption.OperationError.verify|verify} messages. + * @param message OperationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.container.v1beta1.DatabaseEncryption.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.container.v1beta1.DatabaseEncryption.OperationError.verify|verify} messages. + * @param message OperationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.container.v1beta1.DatabaseEncryption.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationError + * @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.container.v1beta1.DatabaseEncryption.OperationError; + + /** + * Decodes an OperationError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationError + * @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.container.v1beta1.DatabaseEncryption.OperationError; + + /** + * Verifies an OperationError 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 OperationError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationError + */ + public static fromObject(object: { [k: string]: any }): google.container.v1beta1.DatabaseEncryption.OperationError; + + /** + * Creates a plain object from an OperationError message. Also converts values to other types if specified. + * @param message OperationError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.container.v1beta1.DatabaseEncryption.OperationError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of a ResourceUsageExportConfig. */ diff --git a/packages/google-container/protos/protos.js b/packages/google-container/protos/protos.js index a4c7284a429..10f02e4fafa 100644 --- a/packages/google-container/protos/protos.js +++ b/packages/google-container/protos/protos.js @@ -46285,6 +46285,9 @@ * @interface IDatabaseEncryption * @property {string|null} [keyName] DatabaseEncryption keyName * @property {google.container.v1.DatabaseEncryption.State|null} [state] DatabaseEncryption state + * @property {google.container.v1.DatabaseEncryption.CurrentState|null} [currentState] DatabaseEncryption currentState + * @property {Array.|null} [decryptionKeys] DatabaseEncryption decryptionKeys + * @property {Array.|null} [lastOperationErrors] DatabaseEncryption lastOperationErrors */ /** @@ -46296,6 +46299,8 @@ * @param {google.container.v1.IDatabaseEncryption=} [properties] Properties to set */ function DatabaseEncryption(properties) { + this.decryptionKeys = []; + this.lastOperationErrors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46318,6 +46323,44 @@ */ DatabaseEncryption.prototype.state = 0; + /** + * DatabaseEncryption currentState. + * @member {google.container.v1.DatabaseEncryption.CurrentState|null|undefined} currentState + * @memberof google.container.v1.DatabaseEncryption + * @instance + */ + DatabaseEncryption.prototype.currentState = null; + + /** + * DatabaseEncryption decryptionKeys. + * @member {Array.} decryptionKeys + * @memberof google.container.v1.DatabaseEncryption + * @instance + */ + DatabaseEncryption.prototype.decryptionKeys = $util.emptyArray; + + /** + * DatabaseEncryption lastOperationErrors. + * @member {Array.} lastOperationErrors + * @memberof google.container.v1.DatabaseEncryption + * @instance + */ + DatabaseEncryption.prototype.lastOperationErrors = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DatabaseEncryption _currentState. + * @member {"currentState"|undefined} _currentState + * @memberof google.container.v1.DatabaseEncryption + * @instance + */ + Object.defineProperty(DatabaseEncryption.prototype, "_currentState", { + get: $util.oneOfGetter($oneOfFields = ["currentState"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new DatabaseEncryption instance using the specified properties. * @function create @@ -46346,6 +46389,14 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.keyName); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.currentState != null && Object.hasOwnProperty.call(message, "currentState")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.currentState); + if (message.decryptionKeys != null && message.decryptionKeys.length) + for (var i = 0; i < message.decryptionKeys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.decryptionKeys[i]); + if (message.lastOperationErrors != null && message.lastOperationErrors.length) + for (var i = 0; i < message.lastOperationErrors.length; ++i) + $root.google.container.v1.DatabaseEncryption.OperationError.encode(message.lastOperationErrors[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -46388,6 +46439,22 @@ message.state = reader.int32(); break; } + case 3: { + message.currentState = reader.int32(); + break; + } + case 4: { + if (!(message.decryptionKeys && message.decryptionKeys.length)) + message.decryptionKeys = []; + message.decryptionKeys.push(reader.string()); + break; + } + case 5: { + if (!(message.lastOperationErrors && message.lastOperationErrors.length)) + message.lastOperationErrors = []; + message.lastOperationErrors.push($root.google.container.v1.DatabaseEncryption.OperationError.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -46423,6 +46490,7 @@ DatabaseEncryption.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.keyName != null && message.hasOwnProperty("keyName")) if (!$util.isString(message.keyName)) return "keyName: string expected"; @@ -46435,6 +46503,37 @@ case 2: break; } + if (message.currentState != null && message.hasOwnProperty("currentState")) { + properties._currentState = 1; + switch (message.currentState) { + default: + return "currentState: enum value expected"; + case 0: + case 7: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + } + if (message.decryptionKeys != null && message.hasOwnProperty("decryptionKeys")) { + if (!Array.isArray(message.decryptionKeys)) + return "decryptionKeys: array expected"; + for (var i = 0; i < message.decryptionKeys.length; ++i) + if (!$util.isString(message.decryptionKeys[i])) + return "decryptionKeys: string[] expected"; + } + if (message.lastOperationErrors != null && message.hasOwnProperty("lastOperationErrors")) { + if (!Array.isArray(message.lastOperationErrors)) + return "lastOperationErrors: array expected"; + for (var i = 0; i < message.lastOperationErrors.length; ++i) { + var error = $root.google.container.v1.DatabaseEncryption.OperationError.verify(message.lastOperationErrors[i]); + if (error) + return "lastOperationErrors." + error; + } + } return null; }; @@ -46472,6 +46571,59 @@ message.state = 2; break; } + switch (object.currentState) { + default: + if (typeof object.currentState === "number") { + message.currentState = object.currentState; + break; + } + break; + case "CURRENT_STATE_UNSPECIFIED": + case 0: + message.currentState = 0; + break; + case "CURRENT_STATE_ENCRYPTED": + case 7: + message.currentState = 7; + break; + case "CURRENT_STATE_DECRYPTED": + case 2: + message.currentState = 2; + break; + case "CURRENT_STATE_ENCRYPTION_PENDING": + case 3: + message.currentState = 3; + break; + case "CURRENT_STATE_ENCRYPTION_ERROR": + case 4: + message.currentState = 4; + break; + case "CURRENT_STATE_DECRYPTION_PENDING": + case 5: + message.currentState = 5; + break; + case "CURRENT_STATE_DECRYPTION_ERROR": + case 6: + message.currentState = 6; + break; + } + if (object.decryptionKeys) { + if (!Array.isArray(object.decryptionKeys)) + throw TypeError(".google.container.v1.DatabaseEncryption.decryptionKeys: array expected"); + message.decryptionKeys = []; + for (var i = 0; i < object.decryptionKeys.length; ++i) + message.decryptionKeys[i] = String(object.decryptionKeys[i]); + } + if (object.lastOperationErrors) { + if (!Array.isArray(object.lastOperationErrors)) + throw TypeError(".google.container.v1.DatabaseEncryption.lastOperationErrors: array expected"); + message.lastOperationErrors = []; + for (var i = 0; i < object.lastOperationErrors.length; ++i) { + if (typeof object.lastOperationErrors[i] !== "object") + throw TypeError(".google.container.v1.DatabaseEncryption.lastOperationErrors: object expected"); + message.lastOperationErrors[i] = $root.google.container.v1.DatabaseEncryption.OperationError.fromObject(object.lastOperationErrors[i]); + } + } return message; }; @@ -46488,6 +46640,10 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.decryptionKeys = []; + object.lastOperationErrors = []; + } if (options.defaults) { object.keyName = ""; object.state = options.enums === String ? "UNKNOWN" : 0; @@ -46496,6 +46652,21 @@ object.keyName = message.keyName; if (message.state != null && message.hasOwnProperty("state")) object.state = options.enums === String ? $root.google.container.v1.DatabaseEncryption.State[message.state] === undefined ? message.state : $root.google.container.v1.DatabaseEncryption.State[message.state] : message.state; + if (message.currentState != null && message.hasOwnProperty("currentState")) { + object.currentState = options.enums === String ? $root.google.container.v1.DatabaseEncryption.CurrentState[message.currentState] === undefined ? message.currentState : $root.google.container.v1.DatabaseEncryption.CurrentState[message.currentState] : message.currentState; + if (options.oneofs) + object._currentState = "currentState"; + } + if (message.decryptionKeys && message.decryptionKeys.length) { + object.decryptionKeys = []; + for (var j = 0; j < message.decryptionKeys.length; ++j) + object.decryptionKeys[j] = message.decryptionKeys[j]; + } + if (message.lastOperationErrors && message.lastOperationErrors.length) { + object.lastOperationErrors = []; + for (var j = 0; j < message.lastOperationErrors.length; ++j) + object.lastOperationErrors[j] = $root.google.container.v1.DatabaseEncryption.OperationError.toObject(message.lastOperationErrors[j], options); + } return object; }; @@ -46541,6 +46712,285 @@ return values; })(); + /** + * CurrentState enum. + * @name google.container.v1.DatabaseEncryption.CurrentState + * @enum {number} + * @property {number} CURRENT_STATE_UNSPECIFIED=0 CURRENT_STATE_UNSPECIFIED value + * @property {number} CURRENT_STATE_ENCRYPTED=7 CURRENT_STATE_ENCRYPTED value + * @property {number} CURRENT_STATE_DECRYPTED=2 CURRENT_STATE_DECRYPTED value + * @property {number} CURRENT_STATE_ENCRYPTION_PENDING=3 CURRENT_STATE_ENCRYPTION_PENDING value + * @property {number} CURRENT_STATE_ENCRYPTION_ERROR=4 CURRENT_STATE_ENCRYPTION_ERROR value + * @property {number} CURRENT_STATE_DECRYPTION_PENDING=5 CURRENT_STATE_DECRYPTION_PENDING value + * @property {number} CURRENT_STATE_DECRYPTION_ERROR=6 CURRENT_STATE_DECRYPTION_ERROR value + */ + DatabaseEncryption.CurrentState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CURRENT_STATE_UNSPECIFIED"] = 0; + values[valuesById[7] = "CURRENT_STATE_ENCRYPTED"] = 7; + values[valuesById[2] = "CURRENT_STATE_DECRYPTED"] = 2; + values[valuesById[3] = "CURRENT_STATE_ENCRYPTION_PENDING"] = 3; + values[valuesById[4] = "CURRENT_STATE_ENCRYPTION_ERROR"] = 4; + values[valuesById[5] = "CURRENT_STATE_DECRYPTION_PENDING"] = 5; + values[valuesById[6] = "CURRENT_STATE_DECRYPTION_ERROR"] = 6; + return values; + })(); + + DatabaseEncryption.OperationError = (function() { + + /** + * Properties of an OperationError. + * @memberof google.container.v1.DatabaseEncryption + * @interface IOperationError + * @property {string|null} [keyName] OperationError keyName + * @property {string|null} [errorMessage] OperationError errorMessage + * @property {google.protobuf.ITimestamp|null} [timestamp] OperationError timestamp + */ + + /** + * Constructs a new OperationError. + * @memberof google.container.v1.DatabaseEncryption + * @classdesc Represents an OperationError. + * @implements IOperationError + * @constructor + * @param {google.container.v1.DatabaseEncryption.IOperationError=} [properties] Properties to set + */ + function OperationError(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]]; + } + + /** + * OperationError keyName. + * @member {string} keyName + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @instance + */ + OperationError.prototype.keyName = ""; + + /** + * OperationError errorMessage. + * @member {string} errorMessage + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @instance + */ + OperationError.prototype.errorMessage = ""; + + /** + * OperationError timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @instance + */ + OperationError.prototype.timestamp = null; + + /** + * Creates a new OperationError instance using the specified properties. + * @function create + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @static + * @param {google.container.v1.DatabaseEncryption.IOperationError=} [properties] Properties to set + * @returns {google.container.v1.DatabaseEncryption.OperationError} OperationError instance + */ + OperationError.create = function create(properties) { + return new OperationError(properties); + }; + + /** + * Encodes the specified OperationError message. Does not implicitly {@link google.container.v1.DatabaseEncryption.OperationError.verify|verify} messages. + * @function encode + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @static + * @param {google.container.v1.DatabaseEncryption.IOperationError} message OperationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keyName != null && Object.hasOwnProperty.call(message, "keyName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.keyName); + if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.errorMessage); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.container.v1.DatabaseEncryption.OperationError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @static + * @param {google.container.v1.DatabaseEncryption.IOperationError} message OperationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationError message from the specified reader or buffer. + * @function decode + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.container.v1.DatabaseEncryption.OperationError} OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationError.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.container.v1.DatabaseEncryption.OperationError(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.keyName = reader.string(); + break; + } + case 2: { + message.errorMessage = reader.string(); + break; + } + case 3: { + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.container.v1.DatabaseEncryption.OperationError} OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationError message. + * @function verify + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keyName != null && message.hasOwnProperty("keyName")) + if (!$util.isString(message.keyName)) + return "keyName: string expected"; + if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + if (!$util.isString(message.errorMessage)) + return "errorMessage: string expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + var error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + return null; + }; + + /** + * Creates an OperationError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @static + * @param {Object.} object Plain object + * @returns {google.container.v1.DatabaseEncryption.OperationError} OperationError + */ + OperationError.fromObject = function fromObject(object) { + if (object instanceof $root.google.container.v1.DatabaseEncryption.OperationError) + return object; + var message = new $root.google.container.v1.DatabaseEncryption.OperationError(); + if (object.keyName != null) + message.keyName = String(object.keyName); + if (object.errorMessage != null) + message.errorMessage = String(object.errorMessage); + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".google.container.v1.DatabaseEncryption.OperationError.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + return message; + }; + + /** + * Creates a plain object from an OperationError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @static + * @param {google.container.v1.DatabaseEncryption.OperationError} message OperationError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.keyName = ""; + object.errorMessage = ""; + object.timestamp = null; + } + if (message.keyName != null && message.hasOwnProperty("keyName")) + object.keyName = message.keyName; + if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + object.errorMessage = message.errorMessage; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + return object; + }; + + /** + * Converts this OperationError to JSON. + * @function toJSON + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @instance + * @returns {Object.} JSON object + */ + OperationError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationError + * @function getTypeUrl + * @memberof google.container.v1.DatabaseEncryption.OperationError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.container.v1.DatabaseEncryption.OperationError"; + }; + + return OperationError; + })(); + return DatabaseEncryption; })(); @@ -106901,6 +107351,9 @@ * @interface IDatabaseEncryption * @property {string|null} [keyName] DatabaseEncryption keyName * @property {google.container.v1beta1.DatabaseEncryption.State|null} [state] DatabaseEncryption state + * @property {google.container.v1beta1.DatabaseEncryption.CurrentState|null} [currentState] DatabaseEncryption currentState + * @property {Array.|null} [decryptionKeys] DatabaseEncryption decryptionKeys + * @property {Array.|null} [lastOperationErrors] DatabaseEncryption lastOperationErrors */ /** @@ -106912,6 +107365,8 @@ * @param {google.container.v1beta1.IDatabaseEncryption=} [properties] Properties to set */ function DatabaseEncryption(properties) { + this.decryptionKeys = []; + this.lastOperationErrors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -106934,6 +107389,44 @@ */ DatabaseEncryption.prototype.state = 0; + /** + * DatabaseEncryption currentState. + * @member {google.container.v1beta1.DatabaseEncryption.CurrentState|null|undefined} currentState + * @memberof google.container.v1beta1.DatabaseEncryption + * @instance + */ + DatabaseEncryption.prototype.currentState = null; + + /** + * DatabaseEncryption decryptionKeys. + * @member {Array.} decryptionKeys + * @memberof google.container.v1beta1.DatabaseEncryption + * @instance + */ + DatabaseEncryption.prototype.decryptionKeys = $util.emptyArray; + + /** + * DatabaseEncryption lastOperationErrors. + * @member {Array.} lastOperationErrors + * @memberof google.container.v1beta1.DatabaseEncryption + * @instance + */ + DatabaseEncryption.prototype.lastOperationErrors = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DatabaseEncryption _currentState. + * @member {"currentState"|undefined} _currentState + * @memberof google.container.v1beta1.DatabaseEncryption + * @instance + */ + Object.defineProperty(DatabaseEncryption.prototype, "_currentState", { + get: $util.oneOfGetter($oneOfFields = ["currentState"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new DatabaseEncryption instance using the specified properties. * @function create @@ -106962,6 +107455,14 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.keyName); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.currentState != null && Object.hasOwnProperty.call(message, "currentState")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.currentState); + if (message.decryptionKeys != null && message.decryptionKeys.length) + for (var i = 0; i < message.decryptionKeys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.decryptionKeys[i]); + if (message.lastOperationErrors != null && message.lastOperationErrors.length) + for (var i = 0; i < message.lastOperationErrors.length; ++i) + $root.google.container.v1beta1.DatabaseEncryption.OperationError.encode(message.lastOperationErrors[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -107004,6 +107505,22 @@ message.state = reader.int32(); break; } + case 3: { + message.currentState = reader.int32(); + break; + } + case 4: { + if (!(message.decryptionKeys && message.decryptionKeys.length)) + message.decryptionKeys = []; + message.decryptionKeys.push(reader.string()); + break; + } + case 5: { + if (!(message.lastOperationErrors && message.lastOperationErrors.length)) + message.lastOperationErrors = []; + message.lastOperationErrors.push($root.google.container.v1beta1.DatabaseEncryption.OperationError.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -107039,6 +107556,7 @@ DatabaseEncryption.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.keyName != null && message.hasOwnProperty("keyName")) if (!$util.isString(message.keyName)) return "keyName: string expected"; @@ -107051,6 +107569,37 @@ case 2: break; } + if (message.currentState != null && message.hasOwnProperty("currentState")) { + properties._currentState = 1; + switch (message.currentState) { + default: + return "currentState: enum value expected"; + case 0: + case 7: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + } + if (message.decryptionKeys != null && message.hasOwnProperty("decryptionKeys")) { + if (!Array.isArray(message.decryptionKeys)) + return "decryptionKeys: array expected"; + for (var i = 0; i < message.decryptionKeys.length; ++i) + if (!$util.isString(message.decryptionKeys[i])) + return "decryptionKeys: string[] expected"; + } + if (message.lastOperationErrors != null && message.hasOwnProperty("lastOperationErrors")) { + if (!Array.isArray(message.lastOperationErrors)) + return "lastOperationErrors: array expected"; + for (var i = 0; i < message.lastOperationErrors.length; ++i) { + var error = $root.google.container.v1beta1.DatabaseEncryption.OperationError.verify(message.lastOperationErrors[i]); + if (error) + return "lastOperationErrors." + error; + } + } return null; }; @@ -107088,6 +107637,59 @@ message.state = 2; break; } + switch (object.currentState) { + default: + if (typeof object.currentState === "number") { + message.currentState = object.currentState; + break; + } + break; + case "CURRENT_STATE_UNSPECIFIED": + case 0: + message.currentState = 0; + break; + case "CURRENT_STATE_ENCRYPTED": + case 7: + message.currentState = 7; + break; + case "CURRENT_STATE_DECRYPTED": + case 2: + message.currentState = 2; + break; + case "CURRENT_STATE_ENCRYPTION_PENDING": + case 3: + message.currentState = 3; + break; + case "CURRENT_STATE_ENCRYPTION_ERROR": + case 4: + message.currentState = 4; + break; + case "CURRENT_STATE_DECRYPTION_PENDING": + case 5: + message.currentState = 5; + break; + case "CURRENT_STATE_DECRYPTION_ERROR": + case 6: + message.currentState = 6; + break; + } + if (object.decryptionKeys) { + if (!Array.isArray(object.decryptionKeys)) + throw TypeError(".google.container.v1beta1.DatabaseEncryption.decryptionKeys: array expected"); + message.decryptionKeys = []; + for (var i = 0; i < object.decryptionKeys.length; ++i) + message.decryptionKeys[i] = String(object.decryptionKeys[i]); + } + if (object.lastOperationErrors) { + if (!Array.isArray(object.lastOperationErrors)) + throw TypeError(".google.container.v1beta1.DatabaseEncryption.lastOperationErrors: array expected"); + message.lastOperationErrors = []; + for (var i = 0; i < object.lastOperationErrors.length; ++i) { + if (typeof object.lastOperationErrors[i] !== "object") + throw TypeError(".google.container.v1beta1.DatabaseEncryption.lastOperationErrors: object expected"); + message.lastOperationErrors[i] = $root.google.container.v1beta1.DatabaseEncryption.OperationError.fromObject(object.lastOperationErrors[i]); + } + } return message; }; @@ -107104,6 +107706,10 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.decryptionKeys = []; + object.lastOperationErrors = []; + } if (options.defaults) { object.keyName = ""; object.state = options.enums === String ? "UNKNOWN" : 0; @@ -107112,6 +107718,21 @@ object.keyName = message.keyName; if (message.state != null && message.hasOwnProperty("state")) object.state = options.enums === String ? $root.google.container.v1beta1.DatabaseEncryption.State[message.state] === undefined ? message.state : $root.google.container.v1beta1.DatabaseEncryption.State[message.state] : message.state; + if (message.currentState != null && message.hasOwnProperty("currentState")) { + object.currentState = options.enums === String ? $root.google.container.v1beta1.DatabaseEncryption.CurrentState[message.currentState] === undefined ? message.currentState : $root.google.container.v1beta1.DatabaseEncryption.CurrentState[message.currentState] : message.currentState; + if (options.oneofs) + object._currentState = "currentState"; + } + if (message.decryptionKeys && message.decryptionKeys.length) { + object.decryptionKeys = []; + for (var j = 0; j < message.decryptionKeys.length; ++j) + object.decryptionKeys[j] = message.decryptionKeys[j]; + } + if (message.lastOperationErrors && message.lastOperationErrors.length) { + object.lastOperationErrors = []; + for (var j = 0; j < message.lastOperationErrors.length; ++j) + object.lastOperationErrors[j] = $root.google.container.v1beta1.DatabaseEncryption.OperationError.toObject(message.lastOperationErrors[j], options); + } return object; }; @@ -107157,6 +107778,285 @@ return values; })(); + /** + * CurrentState enum. + * @name google.container.v1beta1.DatabaseEncryption.CurrentState + * @enum {number} + * @property {number} CURRENT_STATE_UNSPECIFIED=0 CURRENT_STATE_UNSPECIFIED value + * @property {number} CURRENT_STATE_ENCRYPTED=7 CURRENT_STATE_ENCRYPTED value + * @property {number} CURRENT_STATE_DECRYPTED=2 CURRENT_STATE_DECRYPTED value + * @property {number} CURRENT_STATE_ENCRYPTION_PENDING=3 CURRENT_STATE_ENCRYPTION_PENDING value + * @property {number} CURRENT_STATE_ENCRYPTION_ERROR=4 CURRENT_STATE_ENCRYPTION_ERROR value + * @property {number} CURRENT_STATE_DECRYPTION_PENDING=5 CURRENT_STATE_DECRYPTION_PENDING value + * @property {number} CURRENT_STATE_DECRYPTION_ERROR=6 CURRENT_STATE_DECRYPTION_ERROR value + */ + DatabaseEncryption.CurrentState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CURRENT_STATE_UNSPECIFIED"] = 0; + values[valuesById[7] = "CURRENT_STATE_ENCRYPTED"] = 7; + values[valuesById[2] = "CURRENT_STATE_DECRYPTED"] = 2; + values[valuesById[3] = "CURRENT_STATE_ENCRYPTION_PENDING"] = 3; + values[valuesById[4] = "CURRENT_STATE_ENCRYPTION_ERROR"] = 4; + values[valuesById[5] = "CURRENT_STATE_DECRYPTION_PENDING"] = 5; + values[valuesById[6] = "CURRENT_STATE_DECRYPTION_ERROR"] = 6; + return values; + })(); + + DatabaseEncryption.OperationError = (function() { + + /** + * Properties of an OperationError. + * @memberof google.container.v1beta1.DatabaseEncryption + * @interface IOperationError + * @property {string|null} [keyName] OperationError keyName + * @property {string|null} [errorMessage] OperationError errorMessage + * @property {google.protobuf.ITimestamp|null} [timestamp] OperationError timestamp + */ + + /** + * Constructs a new OperationError. + * @memberof google.container.v1beta1.DatabaseEncryption + * @classdesc Represents an OperationError. + * @implements IOperationError + * @constructor + * @param {google.container.v1beta1.DatabaseEncryption.IOperationError=} [properties] Properties to set + */ + function OperationError(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]]; + } + + /** + * OperationError keyName. + * @member {string} keyName + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @instance + */ + OperationError.prototype.keyName = ""; + + /** + * OperationError errorMessage. + * @member {string} errorMessage + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @instance + */ + OperationError.prototype.errorMessage = ""; + + /** + * OperationError timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @instance + */ + OperationError.prototype.timestamp = null; + + /** + * Creates a new OperationError instance using the specified properties. + * @function create + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @static + * @param {google.container.v1beta1.DatabaseEncryption.IOperationError=} [properties] Properties to set + * @returns {google.container.v1beta1.DatabaseEncryption.OperationError} OperationError instance + */ + OperationError.create = function create(properties) { + return new OperationError(properties); + }; + + /** + * Encodes the specified OperationError message. Does not implicitly {@link google.container.v1beta1.DatabaseEncryption.OperationError.verify|verify} messages. + * @function encode + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @static + * @param {google.container.v1beta1.DatabaseEncryption.IOperationError} message OperationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keyName != null && Object.hasOwnProperty.call(message, "keyName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.keyName); + if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.errorMessage); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.container.v1beta1.DatabaseEncryption.OperationError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @static + * @param {google.container.v1beta1.DatabaseEncryption.IOperationError} message OperationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationError message from the specified reader or buffer. + * @function decode + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.container.v1beta1.DatabaseEncryption.OperationError} OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationError.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.container.v1beta1.DatabaseEncryption.OperationError(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.keyName = reader.string(); + break; + } + case 2: { + message.errorMessage = reader.string(); + break; + } + case 3: { + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.container.v1beta1.DatabaseEncryption.OperationError} OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationError message. + * @function verify + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keyName != null && message.hasOwnProperty("keyName")) + if (!$util.isString(message.keyName)) + return "keyName: string expected"; + if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + if (!$util.isString(message.errorMessage)) + return "errorMessage: string expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + var error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + return null; + }; + + /** + * Creates an OperationError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @static + * @param {Object.} object Plain object + * @returns {google.container.v1beta1.DatabaseEncryption.OperationError} OperationError + */ + OperationError.fromObject = function fromObject(object) { + if (object instanceof $root.google.container.v1beta1.DatabaseEncryption.OperationError) + return object; + var message = new $root.google.container.v1beta1.DatabaseEncryption.OperationError(); + if (object.keyName != null) + message.keyName = String(object.keyName); + if (object.errorMessage != null) + message.errorMessage = String(object.errorMessage); + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".google.container.v1beta1.DatabaseEncryption.OperationError.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + return message; + }; + + /** + * Creates a plain object from an OperationError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @static + * @param {google.container.v1beta1.DatabaseEncryption.OperationError} message OperationError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.keyName = ""; + object.errorMessage = ""; + object.timestamp = null; + } + if (message.keyName != null && message.hasOwnProperty("keyName")) + object.keyName = message.keyName; + if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + object.errorMessage = message.errorMessage; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + return object; + }; + + /** + * Converts this OperationError to JSON. + * @function toJSON + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @instance + * @returns {Object.} JSON object + */ + OperationError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationError + * @function getTypeUrl + * @memberof google.container.v1beta1.DatabaseEncryption.OperationError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.container.v1beta1.DatabaseEncryption.OperationError"; + }; + + return OperationError; + })(); + return DatabaseEncryption; })(); diff --git a/packages/google-container/protos/protos.json b/packages/google-container/protos/protos.json index 3e227e61fe5..3c4d5e42322 100644 --- a/packages/google-container/protos/protos.json +++ b/packages/google-container/protos/protos.json @@ -5209,6 +5209,13 @@ } }, "DatabaseEncryption": { + "oneofs": { + "_currentState": { + "oneof": [ + "currentState" + ] + } + }, "fields": { "keyName": { "type": "string", @@ -5217,6 +5224,30 @@ "state": { "type": "State", "id": 2 + }, + "currentState": { + "type": "CurrentState", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "decryptionKeys": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastOperationErrors": { + "rule": "repeated", + "type": "OperationError", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -5226,6 +5257,33 @@ "ENCRYPTED": 1, "DECRYPTED": 2 } + }, + "CurrentState": { + "values": { + "CURRENT_STATE_UNSPECIFIED": 0, + "CURRENT_STATE_ENCRYPTED": 7, + "CURRENT_STATE_DECRYPTED": 2, + "CURRENT_STATE_ENCRYPTION_PENDING": 3, + "CURRENT_STATE_ENCRYPTION_ERROR": 4, + "CURRENT_STATE_DECRYPTION_PENDING": 5, + "CURRENT_STATE_DECRYPTION_ERROR": 6 + } + }, + "OperationError": { + "fields": { + "keyName": { + "type": "string", + "id": 1 + }, + "errorMessage": { + "type": "string", + "id": 2 + }, + "timestamp": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } } } }, @@ -11621,6 +11679,13 @@ } }, "DatabaseEncryption": { + "oneofs": { + "_currentState": { + "oneof": [ + "currentState" + ] + } + }, "fields": { "keyName": { "type": "string", @@ -11629,6 +11694,30 @@ "state": { "type": "State", "id": 2 + }, + "currentState": { + "type": "CurrentState", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "decryptionKeys": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastOperationErrors": { + "rule": "repeated", + "type": "OperationError", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -11638,6 +11727,33 @@ "ENCRYPTED": 1, "DECRYPTED": 2 } + }, + "CurrentState": { + "values": { + "CURRENT_STATE_UNSPECIFIED": 0, + "CURRENT_STATE_ENCRYPTED": 7, + "CURRENT_STATE_DECRYPTED": 2, + "CURRENT_STATE_ENCRYPTION_PENDING": 3, + "CURRENT_STATE_ENCRYPTION_ERROR": 4, + "CURRENT_STATE_DECRYPTION_PENDING": 5, + "CURRENT_STATE_DECRYPTION_ERROR": 6 + } + }, + "OperationError": { + "fields": { + "keyName": { + "type": "string", + "id": 1 + }, + "errorMessage": { + "type": "string", + "id": 2 + }, + "timestamp": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } } } }, diff --git a/packages/google-container/src/v1/cluster_manager_client.ts b/packages/google-container/src/v1/cluster_manager_client.ts index 6a48597f644..f993a3a2d23 100644 --- a/packages/google-container/src/v1/cluster_manager_client.ts +++ b/packages/google-container/src/v1/cluster_manager_client.ts @@ -118,8 +118,15 @@ export class ClusterManagerClient { 'Please set either universe_domain or universeDomain, but not both.' ); } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; this._universeDomain = - opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'container.' + this._universeDomain; const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; @@ -171,7 +178,7 @@ export class ClusterManagerClient { // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { + if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { clientHeader.push(`gl-web/${this._gaxModule.version}`); @@ -319,7 +326,7 @@ export class ClusterManagerClient { */ static get servicePath() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( @@ -337,7 +344,7 @@ export class ClusterManagerClient { */ static get apiEndpoint() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( diff --git a/packages/google-container/src/v1beta1/cluster_manager_client.ts b/packages/google-container/src/v1beta1/cluster_manager_client.ts index a3072146007..0bc5dd20583 100644 --- a/packages/google-container/src/v1beta1/cluster_manager_client.ts +++ b/packages/google-container/src/v1beta1/cluster_manager_client.ts @@ -118,8 +118,15 @@ export class ClusterManagerClient { 'Please set either universe_domain or universeDomain, but not both.' ); } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; this._universeDomain = - opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'container.' + this._universeDomain; const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; @@ -171,7 +178,7 @@ export class ClusterManagerClient { // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { + if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { clientHeader.push(`gl-web/${this._gaxModule.version}`); @@ -320,7 +327,7 @@ export class ClusterManagerClient { */ static get servicePath() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( @@ -338,7 +345,7 @@ export class ClusterManagerClient { */ static get apiEndpoint() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( diff --git a/packages/google-container/test/gapic_cluster_manager_v1.ts b/packages/google-container/test/gapic_cluster_manager_v1.ts index 1fab1475232..99bacb8e478 100644 --- a/packages/google-container/test/gapic_cluster_manager_v1.ts +++ b/packages/google-container/test/gapic_cluster_manager_v1.ts @@ -142,7 +142,7 @@ describe('v1.ClusterManagerClient', () => { }); if ( - typeof process !== 'undefined' && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { it('throws DeprecationWarning if static servicePath is used', () => { @@ -178,6 +178,38 @@ describe('v1.ClusterManagerClient', () => { const servicePath = client.apiEndpoint; assert.strictEqual(servicePath, 'container.example.com'); }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new clustermanagerModule.v1.ClusterManagerClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'container.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new clustermanagerModule.v1.ClusterManagerClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'container.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } it('does not allow setting both universeDomain and universe_domain', () => { assert.throws(() => { new clustermanagerModule.v1.ClusterManagerClient({ diff --git a/packages/google-container/test/gapic_cluster_manager_v1beta1.ts b/packages/google-container/test/gapic_cluster_manager_v1beta1.ts index ff7be149482..2a7907e1c09 100644 --- a/packages/google-container/test/gapic_cluster_manager_v1beta1.ts +++ b/packages/google-container/test/gapic_cluster_manager_v1beta1.ts @@ -142,7 +142,7 @@ describe('v1beta1.ClusterManagerClient', () => { }); if ( - typeof process !== 'undefined' && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { it('throws DeprecationWarning if static servicePath is used', () => { @@ -178,6 +178,39 @@ describe('v1beta1.ClusterManagerClient', () => { const servicePath = client.apiEndpoint; assert.strictEqual(servicePath, 'container.example.com'); }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new clustermanagerModule.v1beta1.ClusterManagerClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'container.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new clustermanagerModule.v1beta1.ClusterManagerClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'container.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } it('does not allow setting both universeDomain and universe_domain', () => { assert.throws(() => { new clustermanagerModule.v1beta1.ClusterManagerClient({