diff --git a/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto b/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto index 0b4a35705..58051df00 100644 --- a/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +++ b/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto @@ -562,6 +562,66 @@ message InstanceConfig { State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; } +// Autoscaling config for an instance. +message AutoscalingConfig { + // The autoscaling limits for the instance. Users can define the minimum and + // maximum compute capacity allocated to the instance, and the autoscaler will + // only scale within that range. Users can either use nodes or processing + // units to specify the limits, but should use the same unit to set both the + // min_limit and max_limit. + message AutoscalingLimits { + // The minimum compute capacity for the instance. + oneof min_limit { + // Minimum number of nodes allocated to the instance. If set, this number + // should be greater than or equal to 1. + int32 min_nodes = 1; + + // Minimum number of processing units allocated to the instance. If set, + // this number should be multiples of 1000. + int32 min_processing_units = 2; + } + + // The maximum compute capacity for the instance. The maximum compute + // capacity should be less than or equal to 10X the minimum compute + // capacity. + oneof max_limit { + // Maximum number of nodes allocated to the instance. If set, this number + // should be greater than or equal to min_nodes. + int32 max_nodes = 3; + + // Maximum number of processing units allocated to the instance. If set, + // this number should be multiples of 1000 and be greater than or equal to + // min_processing_units. + int32 max_processing_units = 4; + } + } + + // The autoscaling targets for an instance. + message AutoscalingTargets { + // Required. The target high priority cpu utilization percentage that the + // autoscaler should be trying to achieve for the instance. This number is + // on a scale from 0 (no utilization) to 100 (full utilization). The valid + // range is [10, 90] inclusive. + int32 high_priority_cpu_utilization_percent = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The target storage utilization percentage that the autoscaler + // should be trying to achieve for the instance. This number is on a scale + // from 0 (no utilization) to 100 (full utilization). The valid range is + // [10, 100] inclusive. + int32 storage_utilization_percent = 2 + [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Autoscaling limits for an instance. + AutoscalingLimits autoscaling_limits = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The autoscaling targets for an instance. + AutoscalingTargets autoscaling_targets = 2 + [(google.api.field_behavior) = REQUIRED]; +} + // An isolated set of Cloud Spanner resources on which databases can be hosted. message Instance { option (google.api.resource) = { @@ -606,8 +666,12 @@ message Instance { string display_name = 3 [(google.api.field_behavior) = REQUIRED]; // The number of nodes allocated to this instance. At most one of either - // node_count or processing_units should be present in the message. This - // may be zero in API responses for instances that are not yet in state + // node_count or processing_units should be present in the message. + // + // Users can set the node_count field to specify the target number of nodes + // allocated to the instance. + // + // This may be zero in API responses for instances that are not yet in state // `READY`. // // See [the @@ -616,14 +680,26 @@ message Instance { int32 node_count = 5; // The number of processing units allocated to this instance. At most one of - // processing_units or node_count should be present in the message. This may - // be zero in API responses for instances that are not yet in state `READY`. + // processing_units or node_count should be present in the message. + // + // Users can set the processing_units field to specify the target number of + // processing units allocated to the instance. + // + // This may be zero in API responses for instances that are not yet in state + // `READY`. // // See [the // documentation](https://cloud.google.com/spanner/docs/compute-capacity) // for more information about nodes and processing units. int32 processing_units = 9; + // Optional. The autoscaling configuration. Autoscaling is enabled if this + // field is set. When autoscaling is enabled, node_count and processing_units + // are treated as OUTPUT_ONLY fields and reflect the current compute capacity + // allocated to the instance. + AutoscalingConfig autoscaling_config = 17 + [(google.api.field_behavior) = OPTIONAL]; + // Output only. The current instance state. For // [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], // the state must be either omitted or set to `CREATING`. For diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 65f971d7a..0ca40c97d 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -12181,6 +12181,336 @@ export namespace google { } } + /** Properties of an AutoscalingConfig. */ + interface IAutoscalingConfig { + + /** AutoscalingConfig autoscalingLimits */ + autoscalingLimits?: (google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits|null); + + /** AutoscalingConfig autoscalingTargets */ + autoscalingTargets?: (google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets|null); + } + + /** Represents an AutoscalingConfig. */ + class AutoscalingConfig implements IAutoscalingConfig { + + /** + * Constructs a new AutoscalingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.instance.v1.IAutoscalingConfig); + + /** AutoscalingConfig autoscalingLimits. */ + public autoscalingLimits?: (google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits|null); + + /** AutoscalingConfig autoscalingTargets. */ + public autoscalingTargets?: (google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets|null); + + /** + * Creates a new AutoscalingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AutoscalingConfig instance + */ + public static create(properties?: google.spanner.admin.instance.v1.IAutoscalingConfig): google.spanner.admin.instance.v1.AutoscalingConfig; + + /** + * Encodes the specified AutoscalingConfig message. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.verify|verify} messages. + * @param message AutoscalingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.instance.v1.IAutoscalingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AutoscalingConfig message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.verify|verify} messages. + * @param message AutoscalingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.instance.v1.IAutoscalingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AutoscalingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AutoscalingConfig + * @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.spanner.admin.instance.v1.AutoscalingConfig; + + /** + * Decodes an AutoscalingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AutoscalingConfig + * @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.spanner.admin.instance.v1.AutoscalingConfig; + + /** + * Verifies an AutoscalingConfig 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 AutoscalingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AutoscalingConfig + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.instance.v1.AutoscalingConfig; + + /** + * Creates a plain object from an AutoscalingConfig message. Also converts values to other types if specified. + * @param message AutoscalingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.instance.v1.AutoscalingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AutoscalingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AutoscalingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AutoscalingConfig { + + /** Properties of an AutoscalingLimits. */ + interface IAutoscalingLimits { + + /** AutoscalingLimits minNodes */ + minNodes?: (number|null); + + /** AutoscalingLimits minProcessingUnits */ + minProcessingUnits?: (number|null); + + /** AutoscalingLimits maxNodes */ + maxNodes?: (number|null); + + /** AutoscalingLimits maxProcessingUnits */ + maxProcessingUnits?: (number|null); + } + + /** Represents an AutoscalingLimits. */ + class AutoscalingLimits implements IAutoscalingLimits { + + /** + * Constructs a new AutoscalingLimits. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits); + + /** AutoscalingLimits minNodes. */ + public minNodes?: (number|null); + + /** AutoscalingLimits minProcessingUnits. */ + public minProcessingUnits?: (number|null); + + /** AutoscalingLimits maxNodes. */ + public maxNodes?: (number|null); + + /** AutoscalingLimits maxProcessingUnits. */ + public maxProcessingUnits?: (number|null); + + /** AutoscalingLimits minLimit. */ + public minLimit?: ("minNodes"|"minProcessingUnits"); + + /** AutoscalingLimits maxLimit. */ + public maxLimit?: ("maxNodes"|"maxProcessingUnits"); + + /** + * Creates a new AutoscalingLimits instance using the specified properties. + * @param [properties] Properties to set + * @returns AutoscalingLimits instance + */ + public static create(properties?: google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits): google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits; + + /** + * Encodes the specified AutoscalingLimits message. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.verify|verify} messages. + * @param message AutoscalingLimits message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AutoscalingLimits message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.verify|verify} messages. + * @param message AutoscalingLimits message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AutoscalingLimits message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AutoscalingLimits + * @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.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits; + + /** + * Decodes an AutoscalingLimits message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AutoscalingLimits + * @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.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits; + + /** + * Verifies an AutoscalingLimits 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 AutoscalingLimits message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AutoscalingLimits + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits; + + /** + * Creates a plain object from an AutoscalingLimits message. Also converts values to other types if specified. + * @param message AutoscalingLimits + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AutoscalingLimits to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AutoscalingLimits + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AutoscalingTargets. */ + interface IAutoscalingTargets { + + /** AutoscalingTargets highPriorityCpuUtilizationPercent */ + highPriorityCpuUtilizationPercent?: (number|null); + + /** AutoscalingTargets storageUtilizationPercent */ + storageUtilizationPercent?: (number|null); + } + + /** Represents an AutoscalingTargets. */ + class AutoscalingTargets implements IAutoscalingTargets { + + /** + * Constructs a new AutoscalingTargets. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets); + + /** AutoscalingTargets highPriorityCpuUtilizationPercent. */ + public highPriorityCpuUtilizationPercent: number; + + /** AutoscalingTargets storageUtilizationPercent. */ + public storageUtilizationPercent: number; + + /** + * Creates a new AutoscalingTargets instance using the specified properties. + * @param [properties] Properties to set + * @returns AutoscalingTargets instance + */ + public static create(properties?: google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets): google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets; + + /** + * Encodes the specified AutoscalingTargets message. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.verify|verify} messages. + * @param message AutoscalingTargets message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AutoscalingTargets message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.verify|verify} messages. + * @param message AutoscalingTargets message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AutoscalingTargets message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AutoscalingTargets + * @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.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets; + + /** + * Decodes an AutoscalingTargets message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AutoscalingTargets + * @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.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets; + + /** + * Verifies an AutoscalingTargets 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 AutoscalingTargets message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AutoscalingTargets + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets; + + /** + * Creates a plain object from an AutoscalingTargets message. Also converts values to other types if specified. + * @param message AutoscalingTargets + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AutoscalingTargets to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AutoscalingTargets + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of an Instance. */ interface IInstance { @@ -12199,6 +12529,9 @@ export namespace google { /** Instance processingUnits */ processingUnits?: (number|null); + /** Instance autoscalingConfig */ + autoscalingConfig?: (google.spanner.admin.instance.v1.IAutoscalingConfig|null); + /** Instance state */ state?: (google.spanner.admin.instance.v1.Instance.State|keyof typeof google.spanner.admin.instance.v1.Instance.State|null); @@ -12239,6 +12572,9 @@ export namespace google { /** Instance processingUnits. */ public processingUnits: number; + /** Instance autoscalingConfig. */ + public autoscalingConfig?: (google.spanner.admin.instance.v1.IAutoscalingConfig|null); + /** Instance state. */ public state: (google.spanner.admin.instance.v1.Instance.State|keyof typeof google.spanner.admin.instance.v1.Instance.State); diff --git a/protos/protos.js b/protos/protos.js index 76eede50f..cc7cbd78f 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -30841,6 +30841,787 @@ return InstanceConfig; })(); + v1.AutoscalingConfig = (function() { + + /** + * Properties of an AutoscalingConfig. + * @memberof google.spanner.admin.instance.v1 + * @interface IAutoscalingConfig + * @property {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits|null} [autoscalingLimits] AutoscalingConfig autoscalingLimits + * @property {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets|null} [autoscalingTargets] AutoscalingConfig autoscalingTargets + */ + + /** + * Constructs a new AutoscalingConfig. + * @memberof google.spanner.admin.instance.v1 + * @classdesc Represents an AutoscalingConfig. + * @implements IAutoscalingConfig + * @constructor + * @param {google.spanner.admin.instance.v1.IAutoscalingConfig=} [properties] Properties to set + */ + function AutoscalingConfig(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]]; + } + + /** + * AutoscalingConfig autoscalingLimits. + * @member {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits|null|undefined} autoscalingLimits + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @instance + */ + AutoscalingConfig.prototype.autoscalingLimits = null; + + /** + * AutoscalingConfig autoscalingTargets. + * @member {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets|null|undefined} autoscalingTargets + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @instance + */ + AutoscalingConfig.prototype.autoscalingTargets = null; + + /** + * Creates a new AutoscalingConfig instance using the specified properties. + * @function create + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @static + * @param {google.spanner.admin.instance.v1.IAutoscalingConfig=} [properties] Properties to set + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig} AutoscalingConfig instance + */ + AutoscalingConfig.create = function create(properties) { + return new AutoscalingConfig(properties); + }; + + /** + * Encodes the specified AutoscalingConfig message. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @static + * @param {google.spanner.admin.instance.v1.IAutoscalingConfig} message AutoscalingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutoscalingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.autoscalingLimits != null && Object.hasOwnProperty.call(message, "autoscalingLimits")) + $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.encode(message.autoscalingLimits, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.autoscalingTargets != null && Object.hasOwnProperty.call(message, "autoscalingTargets")) + $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.encode(message.autoscalingTargets, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AutoscalingConfig message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @static + * @param {google.spanner.admin.instance.v1.IAutoscalingConfig} message AutoscalingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutoscalingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AutoscalingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig} AutoscalingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutoscalingConfig.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.spanner.admin.instance.v1.AutoscalingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.autoscalingLimits = $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.decode(reader, reader.uint32()); + break; + } + case 2: { + message.autoscalingTargets = $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AutoscalingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig} AutoscalingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutoscalingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AutoscalingConfig message. + * @function verify + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AutoscalingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.autoscalingLimits != null && message.hasOwnProperty("autoscalingLimits")) { + var error = $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.verify(message.autoscalingLimits); + if (error) + return "autoscalingLimits." + error; + } + if (message.autoscalingTargets != null && message.hasOwnProperty("autoscalingTargets")) { + var error = $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.verify(message.autoscalingTargets); + if (error) + return "autoscalingTargets." + error; + } + return null; + }; + + /** + * Creates an AutoscalingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig} AutoscalingConfig + */ + AutoscalingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.instance.v1.AutoscalingConfig) + return object; + var message = new $root.google.spanner.admin.instance.v1.AutoscalingConfig(); + if (object.autoscalingLimits != null) { + if (typeof object.autoscalingLimits !== "object") + throw TypeError(".google.spanner.admin.instance.v1.AutoscalingConfig.autoscalingLimits: object expected"); + message.autoscalingLimits = $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.fromObject(object.autoscalingLimits); + } + if (object.autoscalingTargets != null) { + if (typeof object.autoscalingTargets !== "object") + throw TypeError(".google.spanner.admin.instance.v1.AutoscalingConfig.autoscalingTargets: object expected"); + message.autoscalingTargets = $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.fromObject(object.autoscalingTargets); + } + return message; + }; + + /** + * Creates a plain object from an AutoscalingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @static + * @param {google.spanner.admin.instance.v1.AutoscalingConfig} message AutoscalingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AutoscalingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.autoscalingLimits = null; + object.autoscalingTargets = null; + } + if (message.autoscalingLimits != null && message.hasOwnProperty("autoscalingLimits")) + object.autoscalingLimits = $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.toObject(message.autoscalingLimits, options); + if (message.autoscalingTargets != null && message.hasOwnProperty("autoscalingTargets")) + object.autoscalingTargets = $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.toObject(message.autoscalingTargets, options); + return object; + }; + + /** + * Converts this AutoscalingConfig to JSON. + * @function toJSON + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @instance + * @returns {Object.} JSON object + */ + AutoscalingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AutoscalingConfig + * @function getTypeUrl + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AutoscalingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.instance.v1.AutoscalingConfig"; + }; + + AutoscalingConfig.AutoscalingLimits = (function() { + + /** + * Properties of an AutoscalingLimits. + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @interface IAutoscalingLimits + * @property {number|null} [minNodes] AutoscalingLimits minNodes + * @property {number|null} [minProcessingUnits] AutoscalingLimits minProcessingUnits + * @property {number|null} [maxNodes] AutoscalingLimits maxNodes + * @property {number|null} [maxProcessingUnits] AutoscalingLimits maxProcessingUnits + */ + + /** + * Constructs a new AutoscalingLimits. + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @classdesc Represents an AutoscalingLimits. + * @implements IAutoscalingLimits + * @constructor + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits=} [properties] Properties to set + */ + function AutoscalingLimits(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]]; + } + + /** + * AutoscalingLimits minNodes. + * @member {number|null|undefined} minNodes + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @instance + */ + AutoscalingLimits.prototype.minNodes = null; + + /** + * AutoscalingLimits minProcessingUnits. + * @member {number|null|undefined} minProcessingUnits + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @instance + */ + AutoscalingLimits.prototype.minProcessingUnits = null; + + /** + * AutoscalingLimits maxNodes. + * @member {number|null|undefined} maxNodes + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @instance + */ + AutoscalingLimits.prototype.maxNodes = null; + + /** + * AutoscalingLimits maxProcessingUnits. + * @member {number|null|undefined} maxProcessingUnits + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @instance + */ + AutoscalingLimits.prototype.maxProcessingUnits = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AutoscalingLimits minLimit. + * @member {"minNodes"|"minProcessingUnits"|undefined} minLimit + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @instance + */ + Object.defineProperty(AutoscalingLimits.prototype, "minLimit", { + get: $util.oneOfGetter($oneOfFields = ["minNodes", "minProcessingUnits"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * AutoscalingLimits maxLimit. + * @member {"maxNodes"|"maxProcessingUnits"|undefined} maxLimit + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @instance + */ + Object.defineProperty(AutoscalingLimits.prototype, "maxLimit", { + get: $util.oneOfGetter($oneOfFields = ["maxNodes", "maxProcessingUnits"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AutoscalingLimits instance using the specified properties. + * @function create + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @static + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits=} [properties] Properties to set + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits} AutoscalingLimits instance + */ + AutoscalingLimits.create = function create(properties) { + return new AutoscalingLimits(properties); + }; + + /** + * Encodes the specified AutoscalingLimits message. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @static + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits} message AutoscalingLimits message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutoscalingLimits.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.minNodes != null && Object.hasOwnProperty.call(message, "minNodes")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.minNodes); + if (message.minProcessingUnits != null && Object.hasOwnProperty.call(message, "minProcessingUnits")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.minProcessingUnits); + if (message.maxNodes != null && Object.hasOwnProperty.call(message, "maxNodes")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxNodes); + if (message.maxProcessingUnits != null && Object.hasOwnProperty.call(message, "maxProcessingUnits")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.maxProcessingUnits); + return writer; + }; + + /** + * Encodes the specified AutoscalingLimits message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @static + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingLimits} message AutoscalingLimits message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutoscalingLimits.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AutoscalingLimits message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits} AutoscalingLimits + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutoscalingLimits.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.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.minNodes = reader.int32(); + break; + } + case 2: { + message.minProcessingUnits = reader.int32(); + break; + } + case 3: { + message.maxNodes = reader.int32(); + break; + } + case 4: { + message.maxProcessingUnits = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AutoscalingLimits message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits} AutoscalingLimits + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutoscalingLimits.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AutoscalingLimits message. + * @function verify + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AutoscalingLimits.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.minNodes != null && message.hasOwnProperty("minNodes")) { + properties.minLimit = 1; + if (!$util.isInteger(message.minNodes)) + return "minNodes: integer expected"; + } + if (message.minProcessingUnits != null && message.hasOwnProperty("minProcessingUnits")) { + if (properties.minLimit === 1) + return "minLimit: multiple values"; + properties.minLimit = 1; + if (!$util.isInteger(message.minProcessingUnits)) + return "minProcessingUnits: integer expected"; + } + if (message.maxNodes != null && message.hasOwnProperty("maxNodes")) { + properties.maxLimit = 1; + if (!$util.isInteger(message.maxNodes)) + return "maxNodes: integer expected"; + } + if (message.maxProcessingUnits != null && message.hasOwnProperty("maxProcessingUnits")) { + if (properties.maxLimit === 1) + return "maxLimit: multiple values"; + properties.maxLimit = 1; + if (!$util.isInteger(message.maxProcessingUnits)) + return "maxProcessingUnits: integer expected"; + } + return null; + }; + + /** + * Creates an AutoscalingLimits message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits} AutoscalingLimits + */ + AutoscalingLimits.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits) + return object; + var message = new $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits(); + if (object.minNodes != null) + message.minNodes = object.minNodes | 0; + if (object.minProcessingUnits != null) + message.minProcessingUnits = object.minProcessingUnits | 0; + if (object.maxNodes != null) + message.maxNodes = object.maxNodes | 0; + if (object.maxProcessingUnits != null) + message.maxProcessingUnits = object.maxProcessingUnits | 0; + return message; + }; + + /** + * Creates a plain object from an AutoscalingLimits message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @static + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits} message AutoscalingLimits + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AutoscalingLimits.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.minNodes != null && message.hasOwnProperty("minNodes")) { + object.minNodes = message.minNodes; + if (options.oneofs) + object.minLimit = "minNodes"; + } + if (message.minProcessingUnits != null && message.hasOwnProperty("minProcessingUnits")) { + object.minProcessingUnits = message.minProcessingUnits; + if (options.oneofs) + object.minLimit = "minProcessingUnits"; + } + if (message.maxNodes != null && message.hasOwnProperty("maxNodes")) { + object.maxNodes = message.maxNodes; + if (options.oneofs) + object.maxLimit = "maxNodes"; + } + if (message.maxProcessingUnits != null && message.hasOwnProperty("maxProcessingUnits")) { + object.maxProcessingUnits = message.maxProcessingUnits; + if (options.oneofs) + object.maxLimit = "maxProcessingUnits"; + } + return object; + }; + + /** + * Converts this AutoscalingLimits to JSON. + * @function toJSON + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @instance + * @returns {Object.} JSON object + */ + AutoscalingLimits.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AutoscalingLimits + * @function getTypeUrl + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AutoscalingLimits.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits"; + }; + + return AutoscalingLimits; + })(); + + AutoscalingConfig.AutoscalingTargets = (function() { + + /** + * Properties of an AutoscalingTargets. + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @interface IAutoscalingTargets + * @property {number|null} [highPriorityCpuUtilizationPercent] AutoscalingTargets highPriorityCpuUtilizationPercent + * @property {number|null} [storageUtilizationPercent] AutoscalingTargets storageUtilizationPercent + */ + + /** + * Constructs a new AutoscalingTargets. + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig + * @classdesc Represents an AutoscalingTargets. + * @implements IAutoscalingTargets + * @constructor + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets=} [properties] Properties to set + */ + function AutoscalingTargets(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]]; + } + + /** + * AutoscalingTargets highPriorityCpuUtilizationPercent. + * @member {number} highPriorityCpuUtilizationPercent + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @instance + */ + AutoscalingTargets.prototype.highPriorityCpuUtilizationPercent = 0; + + /** + * AutoscalingTargets storageUtilizationPercent. + * @member {number} storageUtilizationPercent + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @instance + */ + AutoscalingTargets.prototype.storageUtilizationPercent = 0; + + /** + * Creates a new AutoscalingTargets instance using the specified properties. + * @function create + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @static + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets=} [properties] Properties to set + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets} AutoscalingTargets instance + */ + AutoscalingTargets.create = function create(properties) { + return new AutoscalingTargets(properties); + }; + + /** + * Encodes the specified AutoscalingTargets message. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @static + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets} message AutoscalingTargets message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutoscalingTargets.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.highPriorityCpuUtilizationPercent != null && Object.hasOwnProperty.call(message, "highPriorityCpuUtilizationPercent")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.highPriorityCpuUtilizationPercent); + if (message.storageUtilizationPercent != null && Object.hasOwnProperty.call(message, "storageUtilizationPercent")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.storageUtilizationPercent); + return writer; + }; + + /** + * Encodes the specified AutoscalingTargets message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @static + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.IAutoscalingTargets} message AutoscalingTargets message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutoscalingTargets.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AutoscalingTargets message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets} AutoscalingTargets + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutoscalingTargets.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.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.highPriorityCpuUtilizationPercent = reader.int32(); + break; + } + case 2: { + message.storageUtilizationPercent = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AutoscalingTargets message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets} AutoscalingTargets + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutoscalingTargets.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AutoscalingTargets message. + * @function verify + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AutoscalingTargets.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.highPriorityCpuUtilizationPercent != null && message.hasOwnProperty("highPriorityCpuUtilizationPercent")) + if (!$util.isInteger(message.highPriorityCpuUtilizationPercent)) + return "highPriorityCpuUtilizationPercent: integer expected"; + if (message.storageUtilizationPercent != null && message.hasOwnProperty("storageUtilizationPercent")) + if (!$util.isInteger(message.storageUtilizationPercent)) + return "storageUtilizationPercent: integer expected"; + return null; + }; + + /** + * Creates an AutoscalingTargets message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets} AutoscalingTargets + */ + AutoscalingTargets.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets) + return object; + var message = new $root.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets(); + if (object.highPriorityCpuUtilizationPercent != null) + message.highPriorityCpuUtilizationPercent = object.highPriorityCpuUtilizationPercent | 0; + if (object.storageUtilizationPercent != null) + message.storageUtilizationPercent = object.storageUtilizationPercent | 0; + return message; + }; + + /** + * Creates a plain object from an AutoscalingTargets message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @static + * @param {google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets} message AutoscalingTargets + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AutoscalingTargets.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.highPriorityCpuUtilizationPercent = 0; + object.storageUtilizationPercent = 0; + } + if (message.highPriorityCpuUtilizationPercent != null && message.hasOwnProperty("highPriorityCpuUtilizationPercent")) + object.highPriorityCpuUtilizationPercent = message.highPriorityCpuUtilizationPercent; + if (message.storageUtilizationPercent != null && message.hasOwnProperty("storageUtilizationPercent")) + object.storageUtilizationPercent = message.storageUtilizationPercent; + return object; + }; + + /** + * Converts this AutoscalingTargets to JSON. + * @function toJSON + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @instance + * @returns {Object.} JSON object + */ + AutoscalingTargets.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AutoscalingTargets + * @function getTypeUrl + * @memberof google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AutoscalingTargets.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets"; + }; + + return AutoscalingTargets; + })(); + + return AutoscalingConfig; + })(); + v1.Instance = (function() { /** @@ -30852,6 +31633,7 @@ * @property {string|null} [displayName] Instance displayName * @property {number|null} [nodeCount] Instance nodeCount * @property {number|null} [processingUnits] Instance processingUnits + * @property {google.spanner.admin.instance.v1.IAutoscalingConfig|null} [autoscalingConfig] Instance autoscalingConfig * @property {google.spanner.admin.instance.v1.Instance.State|null} [state] Instance state * @property {Object.|null} [labels] Instance labels * @property {Array.|null} [endpointUris] Instance endpointUris @@ -30916,6 +31698,14 @@ */ Instance.prototype.processingUnits = 0; + /** + * Instance autoscalingConfig. + * @member {google.spanner.admin.instance.v1.IAutoscalingConfig|null|undefined} autoscalingConfig + * @memberof google.spanner.admin.instance.v1.Instance + * @instance + */ + Instance.prototype.autoscalingConfig = null; + /** * Instance state. * @member {google.spanner.admin.instance.v1.Instance.State} state @@ -31002,6 +31792,8 @@ $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.autoscalingConfig != null && Object.hasOwnProperty.call(message, "autoscalingConfig")) + $root.google.spanner.admin.instance.v1.AutoscalingConfig.encode(message.autoscalingConfig, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); return writer; }; @@ -31056,6 +31848,10 @@ message.processingUnits = reader.int32(); break; } + case 17: { + message.autoscalingConfig = $root.google.spanner.admin.instance.v1.AutoscalingConfig.decode(reader, reader.uint32()); + break; + } case 6: { message.state = reader.int32(); break; @@ -31147,6 +31943,11 @@ if (message.processingUnits != null && message.hasOwnProperty("processingUnits")) if (!$util.isInteger(message.processingUnits)) return "processingUnits: integer expected"; + if (message.autoscalingConfig != null && message.hasOwnProperty("autoscalingConfig")) { + var error = $root.google.spanner.admin.instance.v1.AutoscalingConfig.verify(message.autoscalingConfig); + if (error) + return "autoscalingConfig." + error; + } if (message.state != null && message.hasOwnProperty("state")) switch (message.state) { default: @@ -31206,6 +32007,11 @@ message.nodeCount = object.nodeCount | 0; if (object.processingUnits != null) message.processingUnits = object.processingUnits | 0; + if (object.autoscalingConfig != null) { + if (typeof object.autoscalingConfig !== "object") + throw TypeError(".google.spanner.admin.instance.v1.Instance.autoscalingConfig: object expected"); + message.autoscalingConfig = $root.google.spanner.admin.instance.v1.AutoscalingConfig.fromObject(object.autoscalingConfig); + } switch (object.state) { default: if (typeof object.state === "number") { @@ -31279,6 +32085,7 @@ object.processingUnits = 0; object.createTime = null; object.updateTime = null; + object.autoscalingConfig = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -31307,6 +32114,8 @@ object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); if (message.updateTime != null && message.hasOwnProperty("updateTime")) object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.autoscalingConfig != null && message.hasOwnProperty("autoscalingConfig")) + object.autoscalingConfig = $root.google.spanner.admin.instance.v1.AutoscalingConfig.toObject(message.autoscalingConfig, options); return object; }; diff --git a/protos/protos.json b/protos/protos.json index f58b0e34d..fe69a75ab 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -3552,6 +3552,78 @@ } } }, + "AutoscalingConfig": { + "fields": { + "autoscalingLimits": { + "type": "AutoscalingLimits", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "autoscalingTargets": { + "type": "AutoscalingTargets", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "AutoscalingLimits": { + "oneofs": { + "minLimit": { + "oneof": [ + "minNodes", + "minProcessingUnits" + ] + }, + "maxLimit": { + "oneof": [ + "maxNodes", + "maxProcessingUnits" + ] + } + }, + "fields": { + "minNodes": { + "type": "int32", + "id": 1 + }, + "minProcessingUnits": { + "type": "int32", + "id": 2 + }, + "maxNodes": { + "type": "int32", + "id": 3 + }, + "maxProcessingUnits": { + "type": "int32", + "id": 4 + } + } + }, + "AutoscalingTargets": { + "fields": { + "highPriorityCpuUtilizationPercent": { + "type": "int32", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "storageUtilizationPercent": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, "Instance": { "options": { "(google.api.resource).type": "spanner.googleapis.com/Instance", @@ -3588,6 +3660,13 @@ "type": "int32", "id": 9 }, + "autoscalingConfig": { + "type": "AutoscalingConfig", + "id": 17, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "state": { "type": "State", "id": 6,