diff --git a/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto b/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto index 76dbd914f..6dfc0e2a9 100644 --- a/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto +++ b/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -274,6 +274,15 @@ service BigtableInstanceAdmin { }; option (google.api.method_signature) = "resource,permissions"; } + + // Lists hot tablets in a cluster, within the time range provided. Hot + // tablets are ordered based on CPU usage. + rpc ListHotTablets(ListHotTabletsRequest) returns (ListHotTabletsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/instances/*/clusters/*}/hotTablets" + }; + option (google.api.method_signature) = "parent"; + } } // Request message for BigtableInstanceAdmin.CreateInstance. @@ -634,3 +643,56 @@ message DeleteAppProfileRequest { message UpdateAppProfileMetadata { } + +// Request message for BigtableInstanceAdmin.ListHotTablets. +message ListHotTabletsRequest { + // Required. The cluster name to list hot tablets. + // Value is in the following form: + // `projects/{project}/instances/{instance}/clusters/{cluster}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; + + // The start time to list hot tablets. The hot tablets in the response will + // have start times between the requested start time and end time. Start time + // defaults to Now if it is unset, and end time defaults to Now - 24 hours if + // it is unset. The start time should be less than the end time, and the + // maximum allowed time range between start time and end time is 48 hours. + // Start time and end time should have values between Now and Now - 14 days. + google.protobuf.Timestamp start_time = 2; + + // The end time to list hot tablets. + google.protobuf.Timestamp end_time = 3; + + // Maximum number of results per page. + // + // A page_size that is empty or zero lets the server choose the number of + // items to return. A page_size which is strictly positive will return at most + // that many items. A negative page_size will cause an error. + // + // Following the first request, subsequent paginated calls do not need a + // page_size field. If a page_size is set in subsequent calls, it must match + // the page_size given in the first request. + int32 page_size = 4; + + // The value of `next_page_token` returned by a previous call. + string page_token = 5; +} + +// Response message for BigtableInstanceAdmin.ListHotTablets. +message ListHotTabletsResponse { + // List of hot tablets in the tables of the requested cluster that fall + // within the requested time range. Hot tablets are ordered by node cpu usage + // percent. If there are multiple hot tablets that correspond to the same + // tablet within a 15-minute interval, only the hot tablet with the highest + // node cpu usage will be included in the response. + repeated HotTablet hot_tablets = 1; + + // Set if not all hot tablets could be returned in a single response. + // Pass this value to `page_token` in another request to get the next + // page of results. + string next_page_token = 2; +} diff --git a/protos/google/bigtable/admin/v2/instance.proto b/protos/google/bigtable/admin/v2/instance.proto index 2e61b0858..c15b91411 100644 --- a/protos/google/bigtable/admin/v2/instance.proto +++ b/protos/google/bigtable/admin/v2/instance.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -291,3 +291,43 @@ message AppProfile { SingleClusterRouting single_cluster_routing = 6; } } + +// A tablet is a defined by a start and end key and is explained in +// https://cloud.google.com/bigtable/docs/overview#architecture and +// https://cloud.google.com/bigtable/docs/performance#optimization. +// A Hot tablet is a tablet that exhibits high average cpu usage during the time +// interval from start time to end time. +message HotTablet { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/HotTablet" + pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}" + }; + + // The unique name of the hot tablet. Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/[a-zA-Z0-9_-]*`. + string name = 1; + + // Name of the table that contains the tablet. Values are of the form + // `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. + string table_name = 2 [(google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + }]; + + // Output only. The start time of the hot tablet. + google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The end time of the hot tablet. + google.protobuf.Timestamp end_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Tablet Start Key (inclusive). + string start_key = 5; + + // Tablet End Key (inclusive). + string end_key = 6; + + // Output only. The average CPU usage spent by a node on this tablet over the start_time to + // end_time time range. The percentage is the amount of CPU used by the node + // to serve the tablet, from 0% (tablet was not interacted with) to 100% (the + // node spent all cycles serving the hot tablet). + float node_cpu_usage_percent = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 1c9e11055..cc06d0e3a 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -325,6 +325,20 @@ export namespace google { * @returns Promise */ public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest): Promise; + + /** + * Calls ListHotTablets. + * @param request ListHotTabletsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListHotTabletsResponse + */ + public listHotTablets(request: google.bigtable.admin.v2.IListHotTabletsRequest, callback: google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTabletsCallback): void; + + /** + * Calls ListHotTablets. + * @param request ListHotTabletsRequest message or plain object + * @returns Promise + */ + public listHotTablets(request: google.bigtable.admin.v2.IListHotTabletsRequest): Promise; } namespace BigtableInstanceAdmin { @@ -468,6 +482,13 @@ export namespace google { * @param [response] TestIamPermissionsResponse */ type TestIamPermissionsCallback = (error: (Error|null), response?: google.iam.v1.TestIamPermissionsResponse) => void; + + /** + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listHotTablets}. + * @param error Error, if any + * @param [response] ListHotTabletsResponse + */ + type ListHotTabletsCallback = (error: (Error|null), response?: google.bigtable.admin.v2.ListHotTabletsResponse) => void; } /** Properties of a CreateInstanceRequest. */ @@ -2822,6 +2843,216 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a ListHotTabletsRequest. */ + interface IListHotTabletsRequest { + + /** ListHotTabletsRequest parent */ + parent?: (string|null); + + /** ListHotTabletsRequest startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** ListHotTabletsRequest endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** ListHotTabletsRequest pageSize */ + pageSize?: (number|null); + + /** ListHotTabletsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListHotTabletsRequest. */ + class ListHotTabletsRequest implements IListHotTabletsRequest { + + /** + * Constructs a new ListHotTabletsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.IListHotTabletsRequest); + + /** ListHotTabletsRequest parent. */ + public parent: string; + + /** ListHotTabletsRequest startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** ListHotTabletsRequest endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** ListHotTabletsRequest pageSize. */ + public pageSize: number; + + /** ListHotTabletsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListHotTabletsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListHotTabletsRequest instance + */ + public static create(properties?: google.bigtable.admin.v2.IListHotTabletsRequest): google.bigtable.admin.v2.ListHotTabletsRequest; + + /** + * Encodes the specified ListHotTabletsRequest message. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsRequest.verify|verify} messages. + * @param message ListHotTabletsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.IListHotTabletsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListHotTabletsRequest message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsRequest.verify|verify} messages. + * @param message ListHotTabletsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.IListHotTabletsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListHotTabletsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListHotTabletsRequest + * @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.bigtable.admin.v2.ListHotTabletsRequest; + + /** + * Decodes a ListHotTabletsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListHotTabletsRequest + * @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.bigtable.admin.v2.ListHotTabletsRequest; + + /** + * Verifies a ListHotTabletsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListHotTabletsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListHotTabletsRequest + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.ListHotTabletsRequest; + + /** + * Creates a plain object from a ListHotTabletsRequest message. Also converts values to other types if specified. + * @param message ListHotTabletsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.ListHotTabletsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListHotTabletsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListHotTabletsResponse. */ + interface IListHotTabletsResponse { + + /** ListHotTabletsResponse hotTablets */ + hotTablets?: (google.bigtable.admin.v2.IHotTablet[]|null); + + /** ListHotTabletsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListHotTabletsResponse. */ + class ListHotTabletsResponse implements IListHotTabletsResponse { + + /** + * Constructs a new ListHotTabletsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.IListHotTabletsResponse); + + /** ListHotTabletsResponse hotTablets. */ + public hotTablets: google.bigtable.admin.v2.IHotTablet[]; + + /** ListHotTabletsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListHotTabletsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListHotTabletsResponse instance + */ + public static create(properties?: google.bigtable.admin.v2.IListHotTabletsResponse): google.bigtable.admin.v2.ListHotTabletsResponse; + + /** + * Encodes the specified ListHotTabletsResponse message. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsResponse.verify|verify} messages. + * @param message ListHotTabletsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.IListHotTabletsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListHotTabletsResponse message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsResponse.verify|verify} messages. + * @param message ListHotTabletsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.IListHotTabletsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListHotTabletsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListHotTabletsResponse + * @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.bigtable.admin.v2.ListHotTabletsResponse; + + /** + * Decodes a ListHotTabletsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListHotTabletsResponse + * @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.bigtable.admin.v2.ListHotTabletsResponse; + + /** + * Verifies a ListHotTabletsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListHotTabletsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListHotTabletsResponse + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.ListHotTabletsResponse; + + /** + * Creates a plain object from a ListHotTabletsResponse message. Also converts values to other types if specified. + * @param message ListHotTabletsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.ListHotTabletsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListHotTabletsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of an Instance. */ interface IInstance { @@ -3868,6 +4099,132 @@ export namespace google { } } + /** Properties of a HotTablet. */ + interface IHotTablet { + + /** HotTablet name */ + name?: (string|null); + + /** HotTablet tableName */ + tableName?: (string|null); + + /** HotTablet startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** HotTablet endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** HotTablet startKey */ + startKey?: (string|null); + + /** HotTablet endKey */ + endKey?: (string|null); + + /** HotTablet nodeCpuUsagePercent */ + nodeCpuUsagePercent?: (number|null); + } + + /** Represents a HotTablet. */ + class HotTablet implements IHotTablet { + + /** + * Constructs a new HotTablet. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.IHotTablet); + + /** HotTablet name. */ + public name: string; + + /** HotTablet tableName. */ + public tableName: string; + + /** HotTablet startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** HotTablet endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** HotTablet startKey. */ + public startKey: string; + + /** HotTablet endKey. */ + public endKey: string; + + /** HotTablet nodeCpuUsagePercent. */ + public nodeCpuUsagePercent: number; + + /** + * Creates a new HotTablet instance using the specified properties. + * @param [properties] Properties to set + * @returns HotTablet instance + */ + public static create(properties?: google.bigtable.admin.v2.IHotTablet): google.bigtable.admin.v2.HotTablet; + + /** + * Encodes the specified HotTablet message. Does not implicitly {@link google.bigtable.admin.v2.HotTablet.verify|verify} messages. + * @param message HotTablet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.IHotTablet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HotTablet message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.HotTablet.verify|verify} messages. + * @param message HotTablet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.IHotTablet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HotTablet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HotTablet + * @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.bigtable.admin.v2.HotTablet; + + /** + * Decodes a HotTablet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HotTablet + * @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.bigtable.admin.v2.HotTablet; + + /** + * Verifies a HotTablet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HotTablet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HotTablet + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.HotTablet; + + /** + * Creates a plain object from a HotTablet message. Also converts values to other types if specified. + * @param message HotTablet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.HotTablet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HotTablet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** StorageType enum. */ enum StorageType { STORAGE_TYPE_UNSPECIFIED = 0, diff --git a/protos/protos.js b/protos/protos.js index 0e08f5852..2732c14b2 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -758,6 +758,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listHotTablets}. + * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin + * @typedef ListHotTabletsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.bigtable.admin.v2.ListHotTabletsResponse} [response] ListHotTabletsResponse + */ + + /** + * Calls ListHotTablets. + * @function listHotTablets + * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin + * @instance + * @param {google.bigtable.admin.v2.IListHotTabletsRequest} request ListHotTabletsRequest message or plain object + * @param {google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTabletsCallback} callback Node-style callback called with the error, if any, and ListHotTabletsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(BigtableInstanceAdmin.prototype.listHotTablets = function listHotTablets(request, callback) { + return this.rpcCall(listHotTablets, $root.google.bigtable.admin.v2.ListHotTabletsRequest, $root.google.bigtable.admin.v2.ListHotTabletsResponse, request, callback); + }, "name", { value: "ListHotTablets" }); + + /** + * Calls ListHotTablets. + * @function listHotTablets + * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin + * @instance + * @param {google.bigtable.admin.v2.IListHotTabletsRequest} request ListHotTabletsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return BigtableInstanceAdmin; })(); @@ -6243,30 +6276,28 @@ return UpdateAppProfileMetadata; })(); - v2.Instance = (function() { + v2.ListHotTabletsRequest = (function() { /** - * Properties of an Instance. + * Properties of a ListHotTabletsRequest. * @memberof google.bigtable.admin.v2 - * @interface IInstance - * @property {string|null} [name] Instance name - * @property {string|null} [displayName] Instance displayName - * @property {google.bigtable.admin.v2.Instance.State|null} [state] Instance state - * @property {google.bigtable.admin.v2.Instance.Type|null} [type] Instance type - * @property {Object.|null} [labels] Instance labels - * @property {google.protobuf.ITimestamp|null} [createTime] Instance createTime + * @interface IListHotTabletsRequest + * @property {string|null} [parent] ListHotTabletsRequest parent + * @property {google.protobuf.ITimestamp|null} [startTime] ListHotTabletsRequest startTime + * @property {google.protobuf.ITimestamp|null} [endTime] ListHotTabletsRequest endTime + * @property {number|null} [pageSize] ListHotTabletsRequest pageSize + * @property {string|null} [pageToken] ListHotTabletsRequest pageToken */ /** - * Constructs a new Instance. + * Constructs a new ListHotTabletsRequest. * @memberof google.bigtable.admin.v2 - * @classdesc Represents an Instance. - * @implements IInstance + * @classdesc Represents a ListHotTabletsRequest. + * @implements IListHotTabletsRequest * @constructor - * @param {google.bigtable.admin.v2.IInstance=} [properties] Properties to set + * @param {google.bigtable.admin.v2.IListHotTabletsRequest=} [properties] Properties to set */ - function Instance(properties) { - this.labels = {}; + function ListHotTabletsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6274,160 +6305,127 @@ } /** - * Instance name. - * @member {string} name - * @memberof google.bigtable.admin.v2.Instance - * @instance - */ - Instance.prototype.name = ""; - - /** - * Instance displayName. - * @member {string} displayName - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest parent. + * @member {string} parent + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.displayName = ""; + ListHotTabletsRequest.prototype.parent = ""; /** - * Instance state. - * @member {google.bigtable.admin.v2.Instance.State} state - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.state = 0; + ListHotTabletsRequest.prototype.startTime = null; /** - * Instance type. - * @member {google.bigtable.admin.v2.Instance.Type} type - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.type = 0; + ListHotTabletsRequest.prototype.endTime = null; /** - * Instance labels. - * @member {Object.} labels - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest pageSize. + * @member {number} pageSize + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.labels = $util.emptyObject; + ListHotTabletsRequest.prototype.pageSize = 0; /** - * Instance createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest pageToken. + * @member {string} pageToken + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.createTime = null; + ListHotTabletsRequest.prototype.pageToken = ""; /** - * Creates a new Instance instance using the specified properties. + * Creates a new ListHotTabletsRequest instance using the specified properties. * @function create - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static - * @param {google.bigtable.admin.v2.IInstance=} [properties] Properties to set - * @returns {google.bigtable.admin.v2.Instance} Instance instance + * @param {google.bigtable.admin.v2.IListHotTabletsRequest=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.ListHotTabletsRequest} ListHotTabletsRequest instance */ - Instance.create = function create(properties) { - return new Instance(properties); + ListHotTabletsRequest.create = function create(properties) { + return new ListHotTabletsRequest(properties); }; /** - * Encodes the specified Instance message. Does not implicitly {@link google.bigtable.admin.v2.Instance.verify|verify} messages. + * Encodes the specified ListHotTabletsRequest message. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsRequest.verify|verify} messages. * @function encode - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static - * @param {google.bigtable.admin.v2.IInstance} message Instance message or plain object to encode + * @param {google.bigtable.admin.v2.IListHotTabletsRequest} message ListHotTabletsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Instance.encode = function encode(message, writer) { + ListHotTabletsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pageToken); return writer; }; /** - * Encodes the specified Instance message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.Instance.verify|verify} messages. + * Encodes the specified ListHotTabletsRequest message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static - * @param {google.bigtable.admin.v2.IInstance} message Instance message or plain object to encode + * @param {google.bigtable.admin.v2.IListHotTabletsRequest} message ListHotTabletsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Instance.encodeDelimited = function encodeDelimited(message, writer) { + ListHotTabletsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Instance message from the specified reader or buffer. + * Decodes a ListHotTabletsRequest message from the specified reader or buffer. * @function decode - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.bigtable.admin.v2.Instance} Instance + * @returns {google.bigtable.admin.v2.ListHotTabletsRequest} ListHotTabletsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Instance.decode = function decode(reader, length) { + ListHotTabletsRequest.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.bigtable.admin.v2.Instance(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.bigtable.admin.v2.ListHotTabletsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.parent = reader.string(); break; case 2: - message.displayName = reader.string(); + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 3: - message.state = reader.int32(); + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 4: - message.type = reader.int32(); + message.pageSize = reader.int32(); break; case 5: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; - break; - case 7: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -6438,130 +6436,682 @@ }; /** - * Decodes an Instance message from the specified reader or buffer, length delimited. + * Decodes a ListHotTabletsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.bigtable.admin.v2.Instance} Instance + * @returns {google.bigtable.admin.v2.ListHotTabletsRequest} ListHotTabletsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Instance.decodeDelimited = function decodeDelimited(reader) { + ListHotTabletsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Instance message. + * Verifies a ListHotTabletsRequest message. * @function verify - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Instance.verify = function verify(message) { + ListHotTabletsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); if (error) - return "createTime." + error; + return "endTime." + error; } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates an Instance message from a plain object. Also converts values to their respective internal types. + * Creates a ListHotTabletsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static * @param {Object.} object Plain object - * @returns {google.bigtable.admin.v2.Instance} Instance + * @returns {google.bigtable.admin.v2.ListHotTabletsRequest} ListHotTabletsRequest */ - Instance.fromObject = function fromObject(object) { - if (object instanceof $root.google.bigtable.admin.v2.Instance) + ListHotTabletsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.ListHotTabletsRequest) return object; - var message = new $root.google.bigtable.admin.v2.Instance(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - switch (object.state) { - case "STATE_NOT_KNOWN": - case 0: - message.state = 0; - break; - case "READY": - case 1: - message.state = 1; - break; - case "CREATING": - case 2: - message.state = 2; - break; - } - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PRODUCTION": - case 1: - message.type = 1; - break; - case "DEVELOPMENT": - case 2: - message.type = 2; - break; - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.bigtable.admin.v2.Instance.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); + var message = new $root.google.bigtable.admin.v2.ListHotTabletsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.bigtable.admin.v2.ListHotTabletsRequest.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); } - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.bigtable.admin.v2.Instance.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.bigtable.admin.v2.ListHotTabletsRequest.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); } - return message; - }; + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListHotTabletsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest + * @static + * @param {google.bigtable.admin.v2.ListHotTabletsRequest} message ListHotTabletsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListHotTabletsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.startTime = null; + object.endTime = null; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListHotTabletsRequest to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest + * @instance + * @returns {Object.} JSON object + */ + ListHotTabletsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListHotTabletsRequest; + })(); + + v2.ListHotTabletsResponse = (function() { + + /** + * Properties of a ListHotTabletsResponse. + * @memberof google.bigtable.admin.v2 + * @interface IListHotTabletsResponse + * @property {Array.|null} [hotTablets] ListHotTabletsResponse hotTablets + * @property {string|null} [nextPageToken] ListHotTabletsResponse nextPageToken + */ + + /** + * Constructs a new ListHotTabletsResponse. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents a ListHotTabletsResponse. + * @implements IListHotTabletsResponse + * @constructor + * @param {google.bigtable.admin.v2.IListHotTabletsResponse=} [properties] Properties to set + */ + function ListHotTabletsResponse(properties) { + this.hotTablets = []; + 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]]; + } + + /** + * ListHotTabletsResponse hotTablets. + * @member {Array.} hotTablets + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @instance + */ + ListHotTabletsResponse.prototype.hotTablets = $util.emptyArray; + + /** + * ListHotTabletsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @instance + */ + ListHotTabletsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListHotTabletsResponse instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {google.bigtable.admin.v2.IListHotTabletsResponse=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.ListHotTabletsResponse} ListHotTabletsResponse instance + */ + ListHotTabletsResponse.create = function create(properties) { + return new ListHotTabletsResponse(properties); + }; + + /** + * Encodes the specified ListHotTabletsResponse message. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsResponse.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {google.bigtable.admin.v2.IListHotTabletsResponse} message ListHotTabletsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListHotTabletsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hotTablets != null && message.hotTablets.length) + for (var i = 0; i < message.hotTablets.length; ++i) + $root.google.bigtable.admin.v2.HotTablet.encode(message.hotTablets[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListHotTabletsResponse message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {google.bigtable.admin.v2.IListHotTabletsResponse} message ListHotTabletsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListHotTabletsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListHotTabletsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.ListHotTabletsResponse} ListHotTabletsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListHotTabletsResponse.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.bigtable.admin.v2.ListHotTabletsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.hotTablets && message.hotTablets.length)) + message.hotTablets = []; + message.hotTablets.push($root.google.bigtable.admin.v2.HotTablet.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListHotTabletsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.ListHotTabletsResponse} ListHotTabletsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListHotTabletsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListHotTabletsResponse message. + * @function verify + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListHotTabletsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hotTablets != null && message.hasOwnProperty("hotTablets")) { + if (!Array.isArray(message.hotTablets)) + return "hotTablets: array expected"; + for (var i = 0; i < message.hotTablets.length; ++i) { + var error = $root.google.bigtable.admin.v2.HotTablet.verify(message.hotTablets[i]); + if (error) + return "hotTablets." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListHotTabletsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.ListHotTabletsResponse} ListHotTabletsResponse + */ + ListHotTabletsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.ListHotTabletsResponse) + return object; + var message = new $root.google.bigtable.admin.v2.ListHotTabletsResponse(); + if (object.hotTablets) { + if (!Array.isArray(object.hotTablets)) + throw TypeError(".google.bigtable.admin.v2.ListHotTabletsResponse.hotTablets: array expected"); + message.hotTablets = []; + for (var i = 0; i < object.hotTablets.length; ++i) { + if (typeof object.hotTablets[i] !== "object") + throw TypeError(".google.bigtable.admin.v2.ListHotTabletsResponse.hotTablets: object expected"); + message.hotTablets[i] = $root.google.bigtable.admin.v2.HotTablet.fromObject(object.hotTablets[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListHotTabletsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {google.bigtable.admin.v2.ListHotTabletsResponse} message ListHotTabletsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListHotTabletsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.hotTablets = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.hotTablets && message.hotTablets.length) { + object.hotTablets = []; + for (var j = 0; j < message.hotTablets.length; ++j) + object.hotTablets[j] = $root.google.bigtable.admin.v2.HotTablet.toObject(message.hotTablets[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListHotTabletsResponse to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @instance + * @returns {Object.} JSON object + */ + ListHotTabletsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListHotTabletsResponse; + })(); + + v2.Instance = (function() { + + /** + * Properties of an Instance. + * @memberof google.bigtable.admin.v2 + * @interface IInstance + * @property {string|null} [name] Instance name + * @property {string|null} [displayName] Instance displayName + * @property {google.bigtable.admin.v2.Instance.State|null} [state] Instance state + * @property {google.bigtable.admin.v2.Instance.Type|null} [type] Instance type + * @property {Object.|null} [labels] Instance labels + * @property {google.protobuf.ITimestamp|null} [createTime] Instance createTime + */ + + /** + * Constructs a new Instance. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents an Instance. + * @implements IInstance + * @constructor + * @param {google.bigtable.admin.v2.IInstance=} [properties] Properties to set + */ + function Instance(properties) { + this.labels = {}; + 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]]; + } + + /** + * Instance name. + * @member {string} name + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.name = ""; + + /** + * Instance displayName. + * @member {string} displayName + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.displayName = ""; + + /** + * Instance state. + * @member {google.bigtable.admin.v2.Instance.State} state + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.state = 0; + + /** + * Instance type. + * @member {google.bigtable.admin.v2.Instance.Type} type + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.type = 0; + + /** + * Instance labels. + * @member {Object.} labels + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.labels = $util.emptyObject; + + /** + * Instance createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.createTime = null; + + /** + * Creates a new Instance instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {google.bigtable.admin.v2.IInstance=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.Instance} Instance instance + */ + Instance.create = function create(properties) { + return new Instance(properties); + }; + + /** + * Encodes the specified Instance message. Does not implicitly {@link google.bigtable.admin.v2.Instance.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {google.bigtable.admin.v2.IInstance} message Instance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Instance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Instance message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.Instance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {google.bigtable.admin.v2.IInstance} message Instance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Instance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Instance message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.Instance} Instance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Instance.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.bigtable.admin.v2.Instance(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.state = reader.int32(); + break; + case 4: + message.type = reader.int32(); + break; + case 5: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Instance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.Instance} Instance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Instance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Instance message. + * @function verify + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Instance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates an Instance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.Instance} Instance + */ + Instance.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.Instance) + return object; + var message = new $root.google.bigtable.admin.v2.Instance(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.state) { + case "STATE_NOT_KNOWN": + case 0: + message.state = 0; + break; + case "READY": + case 1: + message.state = 1; + break; + case "CREATING": + case 2: + message.state = 2; + break; + } + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRODUCTION": + case 1: + message.type = 1; + break; + case "DEVELOPMENT": + case 2: + message.type = 2; + break; + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.bigtable.admin.v2.Instance.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.bigtable.admin.v2.Instance.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; /** * Creates a plain object from an Instance message. Also converts values to other types if specified. @@ -8788,6 +9338,336 @@ return AppProfile; })(); + v2.HotTablet = (function() { + + /** + * Properties of a HotTablet. + * @memberof google.bigtable.admin.v2 + * @interface IHotTablet + * @property {string|null} [name] HotTablet name + * @property {string|null} [tableName] HotTablet tableName + * @property {google.protobuf.ITimestamp|null} [startTime] HotTablet startTime + * @property {google.protobuf.ITimestamp|null} [endTime] HotTablet endTime + * @property {string|null} [startKey] HotTablet startKey + * @property {string|null} [endKey] HotTablet endKey + * @property {number|null} [nodeCpuUsagePercent] HotTablet nodeCpuUsagePercent + */ + + /** + * Constructs a new HotTablet. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents a HotTablet. + * @implements IHotTablet + * @constructor + * @param {google.bigtable.admin.v2.IHotTablet=} [properties] Properties to set + */ + function HotTablet(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]]; + } + + /** + * HotTablet name. + * @member {string} name + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.name = ""; + + /** + * HotTablet tableName. + * @member {string} tableName + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.tableName = ""; + + /** + * HotTablet startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.startTime = null; + + /** + * HotTablet endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.endTime = null; + + /** + * HotTablet startKey. + * @member {string} startKey + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.startKey = ""; + + /** + * HotTablet endKey. + * @member {string} endKey + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.endKey = ""; + + /** + * HotTablet nodeCpuUsagePercent. + * @member {number} nodeCpuUsagePercent + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.nodeCpuUsagePercent = 0; + + /** + * Creates a new HotTablet instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {google.bigtable.admin.v2.IHotTablet=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.HotTablet} HotTablet instance + */ + HotTablet.create = function create(properties) { + return new HotTablet(properties); + }; + + /** + * Encodes the specified HotTablet message. Does not implicitly {@link google.bigtable.admin.v2.HotTablet.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {google.bigtable.admin.v2.IHotTablet} message HotTablet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HotTablet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.tableName != null && Object.hasOwnProperty.call(message, "tableName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableName); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.startKey != null && Object.hasOwnProperty.call(message, "startKey")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.startKey); + if (message.endKey != null && Object.hasOwnProperty.call(message, "endKey")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.endKey); + if (message.nodeCpuUsagePercent != null && Object.hasOwnProperty.call(message, "nodeCpuUsagePercent")) + writer.uint32(/* id 7, wireType 5 =*/61).float(message.nodeCpuUsagePercent); + return writer; + }; + + /** + * Encodes the specified HotTablet message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.HotTablet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {google.bigtable.admin.v2.IHotTablet} message HotTablet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HotTablet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HotTablet message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.HotTablet} HotTablet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HotTablet.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.bigtable.admin.v2.HotTablet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.tableName = reader.string(); + break; + case 3: + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.startKey = reader.string(); + break; + case 6: + message.endKey = reader.string(); + break; + case 7: + message.nodeCpuUsagePercent = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HotTablet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.HotTablet} HotTablet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HotTablet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HotTablet message. + * @function verify + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HotTablet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.tableName != null && message.hasOwnProperty("tableName")) + if (!$util.isString(message.tableName)) + return "tableName: string expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.startKey != null && message.hasOwnProperty("startKey")) + if (!$util.isString(message.startKey)) + return "startKey: string expected"; + if (message.endKey != null && message.hasOwnProperty("endKey")) + if (!$util.isString(message.endKey)) + return "endKey: string expected"; + if (message.nodeCpuUsagePercent != null && message.hasOwnProperty("nodeCpuUsagePercent")) + if (typeof message.nodeCpuUsagePercent !== "number") + return "nodeCpuUsagePercent: number expected"; + return null; + }; + + /** + * Creates a HotTablet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.HotTablet} HotTablet + */ + HotTablet.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.HotTablet) + return object; + var message = new $root.google.bigtable.admin.v2.HotTablet(); + if (object.name != null) + message.name = String(object.name); + if (object.tableName != null) + message.tableName = String(object.tableName); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.bigtable.admin.v2.HotTablet.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.bigtable.admin.v2.HotTablet.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.startKey != null) + message.startKey = String(object.startKey); + if (object.endKey != null) + message.endKey = String(object.endKey); + if (object.nodeCpuUsagePercent != null) + message.nodeCpuUsagePercent = Number(object.nodeCpuUsagePercent); + return message; + }; + + /** + * Creates a plain object from a HotTablet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {google.bigtable.admin.v2.HotTablet} message HotTablet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HotTablet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.tableName = ""; + object.startTime = null; + object.endTime = null; + object.startKey = ""; + object.endKey = ""; + object.nodeCpuUsagePercent = 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.tableName != null && message.hasOwnProperty("tableName")) + object.tableName = message.tableName; + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.startKey != null && message.hasOwnProperty("startKey")) + object.startKey = message.startKey; + if (message.endKey != null && message.hasOwnProperty("endKey")) + object.endKey = message.endKey; + if (message.nodeCpuUsagePercent != null && message.hasOwnProperty("nodeCpuUsagePercent")) + object.nodeCpuUsagePercent = options.json && !isFinite(message.nodeCpuUsagePercent) ? String(message.nodeCpuUsagePercent) : message.nodeCpuUsagePercent; + return object; + }; + + /** + * Converts this HotTablet to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + * @returns {Object.} JSON object + */ + HotTablet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HotTablet; + })(); + /** * StorageType enum. * @name google.bigtable.admin.v2.StorageType diff --git a/protos/protos.json b/protos/protos.json index 4486599ed..64b6e60f2 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -446,6 +446,24 @@ "(google.api.method_signature)": "resource,permissions" } ] + }, + "ListHotTablets": { + "requestType": "ListHotTabletsRequest", + "responseType": "ListHotTabletsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/instances/*/clusters/*}/hotTablets", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/instances/*/clusters/*}/hotTablets" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] } } }, @@ -865,6 +883,47 @@ "UpdateAppProfileMetadata": { "fields": {} }, + "ListHotTabletsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "bigtableadmin.googleapis.com/Cluster" + } + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "pageSize": { + "type": "int32", + "id": 4 + }, + "pageToken": { + "type": "string", + "id": 5 + } + } + }, + "ListHotTabletsResponse": { + "fields": { + "hotTablets": { + "rule": "repeated", + "type": "HotTablet", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, "Instance": { "options": { "(google.api.resource).type": "bigtableadmin.googleapis.com/Instance", @@ -1111,6 +1170,54 @@ } } }, + "HotTablet": { + "options": { + "(google.api.resource).type": "bigtableadmin.googleapis.com/HotTablet", + "(google.api.resource).pattern": "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "tableName": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "bigtableadmin.googleapis.com/Table" + } + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "startKey": { + "type": "string", + "id": 5 + }, + "endKey": { + "type": "string", + "id": 6 + }, + "nodeCpuUsagePercent": { + "type": "float", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, "StorageType": { "values": { "STORAGE_TYPE_UNSPECIFIED": 0, diff --git a/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js b/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js new file mode 100644 index 000000000..7f5d170c6 --- /dev/null +++ b/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js @@ -0,0 +1,89 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + */ + // const parent = 'abc123' + /** + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + */ + // const startTime = {} + /** + * The end time to list hot tablets. + */ + // const endTime = {} + /** + * Maximum number of results per page. + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + */ + // const pageSize = 1234 + /** + * The value of `next_page_token` returned by a previous call. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callListHotTablets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listHotTabletsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListHotTablets(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json b/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json index 657432f09..7036bf8d5 100644 --- a/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json +++ b/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json @@ -935,6 +935,62 @@ } } }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async", + "title": "bigtable listHotTablets Sample", + "origin": "API_DEFINITION", + "description": " Lists hot tablets in a cluster, within the time range provided. Hot tablets are ordered based on CPU usage.", + "canonical": true, + "file": "bigtable_instance_admin.list_hot_tablets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListHotTablets", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTablets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "end_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.ListHotTabletsResponse", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "ListHotTablets", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTablets", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, { "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async", "title": "bigtable createTable Sample", diff --git a/src/v2/bigtable_instance_admin_client.ts b/src/v2/bigtable_instance_admin_client.ts index 6c2517af7..320849636 100644 --- a/src/v2/bigtable_instance_admin_client.ts +++ b/src/v2/bigtable_instance_admin_client.ts @@ -178,6 +178,9 @@ export class BigtableInstanceAdminClient { clusterPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}/clusters/{cluster}' ), + hotTabletPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}' + ), instancePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}' ), @@ -201,6 +204,11 @@ export class BigtableInstanceAdminClient { 'nextPageToken', 'appProfiles' ), + listHotTablets: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'hotTablets' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -357,6 +365,7 @@ export class BigtableInstanceAdminClient { 'getIamPolicy', 'setIamPolicy', 'testIamPermissions', + 'listHotTablets', ]; for (const methodName of bigtableInstanceAdminStubMethods) { const callPromise = this.bigtableInstanceAdminStub.then( @@ -2760,6 +2769,253 @@ export class BigtableInstanceAdminClient { callSettings ) as AsyncIterable; } + /** + * Lists hot tablets in a cluster, within the time range provided. Hot + * tablets are ordered based on CPU usage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listHotTabletsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listHotTablets( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.bigtable.admin.v2.IHotTablet[], + protos.google.bigtable.admin.v2.IListHotTabletsRequest | null, + protos.google.bigtable.admin.v2.IListHotTabletsResponse + ] + >; + listHotTablets( + request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + | protos.google.bigtable.admin.v2.IListHotTabletsResponse + | null + | undefined, + protos.google.bigtable.admin.v2.IHotTablet + > + ): void; + listHotTablets( + request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + | protos.google.bigtable.admin.v2.IListHotTabletsResponse + | null + | undefined, + protos.google.bigtable.admin.v2.IHotTablet + > + ): void; + listHotTablets( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + | protos.google.bigtable.admin.v2.IListHotTabletsResponse + | null + | undefined, + protos.google.bigtable.admin.v2.IHotTablet + >, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + | protos.google.bigtable.admin.v2.IListHotTabletsResponse + | null + | undefined, + protos.google.bigtable.admin.v2.IHotTablet + > + ): Promise< + [ + protos.google.bigtable.admin.v2.IHotTablet[], + protos.google.bigtable.admin.v2.IListHotTabletsRequest | null, + protos.google.bigtable.admin.v2.IListHotTabletsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listHotTablets(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [HotTablet]{@link google.bigtable.admin.v2.HotTablet} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listHotTabletsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listHotTabletsStream( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listHotTablets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHotTablets.createStream( + this.innerApiCalls.listHotTablets as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listHotTablets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async + */ + listHotTabletsAsync( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listHotTablets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHotTablets.asyncIterate( + this.innerApiCalls['listHotTablets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } // -------------------- // -- Path templates -- // -------------------- @@ -2932,6 +3188,77 @@ export class BigtableInstanceAdminClient { return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; } + /** + * Return a fully-qualified hotTablet resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} hot_tablet + * @returns {string} Resource name string. + */ + hotTabletPath( + project: string, + instance: string, + cluster: string, + hotTablet: string + ) { + return this.pathTemplates.hotTabletPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + hot_tablet: hotTablet, + }); + } + + /** + * Parse the project from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .project; + } + + /** + * Parse the instance from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .instance; + } + + /** + * Parse the cluster from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .cluster; + } + + /** + * Parse the hot_tablet from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the hot_tablet. + */ + matchHotTabletFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .hot_tablet; + } + /** * Return a fully-qualified instance resource name string. * diff --git a/src/v2/bigtable_instance_admin_client_config.json b/src/v2/bigtable_instance_admin_client_config.json index 535ce9372..bb5e050c1 100644 --- a/src/v2/bigtable_instance_admin_client_config.json +++ b/src/v2/bigtable_instance_admin_client_config.json @@ -128,6 +128,11 @@ "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListHotTablets": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" } } } diff --git a/src/v2/bigtable_table_admin_client.ts b/src/v2/bigtable_table_admin_client.ts index 8caf897dd..769444792 100644 --- a/src/v2/bigtable_table_admin_client.ts +++ b/src/v2/bigtable_table_admin_client.ts @@ -179,6 +179,9 @@ export class BigtableTableAdminClient { clusterPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}/clusters/{cluster}' ), + hotTabletPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}' + ), instancePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}' ), @@ -3434,6 +3437,77 @@ export class BigtableTableAdminClient { return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; } + /** + * Return a fully-qualified hotTablet resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} hot_tablet + * @returns {string} Resource name string. + */ + hotTabletPath( + project: string, + instance: string, + cluster: string, + hotTablet: string + ) { + return this.pathTemplates.hotTabletPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + hot_tablet: hotTablet, + }); + } + + /** + * Parse the project from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .project; + } + + /** + * Parse the instance from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .instance; + } + + /** + * Parse the cluster from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .cluster; + } + + /** + * Parse the hot_tablet from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the hot_tablet. + */ + matchHotTabletFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .hot_tablet; + } + /** * Return a fully-qualified instance resource name string. * diff --git a/src/v2/gapic_metadata.json b/src/v2/gapic_metadata.json index f53c67d90..8faad0b19 100644 --- a/src/v2/gapic_metadata.json +++ b/src/v2/gapic_metadata.json @@ -111,6 +111,13 @@ "listAppProfilesStream", "listAppProfilesAsync" ] + }, + "ListHotTablets": { + "methods": [ + "listHotTablets", + "listHotTabletsStream", + "listHotTabletsAsync" + ] } } }, @@ -218,6 +225,13 @@ "listAppProfilesStream", "listAppProfilesAsync" ] + }, + "ListHotTablets": { + "methods": [ + "listHotTablets", + "listHotTabletsStream", + "listHotTabletsAsync" + ] } } } diff --git a/test/gapic_bigtable_instance_admin_v2.ts b/test/gapic_bigtable_instance_admin_v2.ts index 53e3112cf..0b37f0ad8 100644 --- a/test/gapic_bigtable_instance_admin_v2.ts +++ b/test/gapic_bigtable_instance_admin_v2.ts @@ -3444,6 +3444,294 @@ describe('v2.BigtableInstanceAdminClient', () => { }); }); + describe('listHotTablets', () => { + it('invokes listHotTablets without error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.innerApiCalls.listHotTablets = stubSimpleCall(expectedResponse); + const [response] = await client.listHotTablets(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listHotTablets without error using callback', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.innerApiCalls.listHotTablets = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHotTablets( + request, + ( + err?: Error | null, + result?: protos.google.bigtable.admin.v2.IHotTablet[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listHotTablets with error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listHotTablets = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listHotTablets(request), expectedError); + assert( + (client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listHotTabletsStream without error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.descriptors.page.listHotTablets.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listHotTabletsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; + stream.on( + 'data', + (response: protos.google.bigtable.admin.v2.HotTablet) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listHotTablets, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listHotTablets.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listHotTabletsStream with error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listHotTablets.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listHotTabletsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; + stream.on( + 'data', + (response: protos.google.bigtable.admin.v2.HotTablet) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listHotTablets, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listHotTablets.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHotTablets without error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.descriptors.page.listHotTablets.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; + const iterable = client.listHotTabletsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listHotTablets.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listHotTablets.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHotTablets with error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listHotTablets.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHotTabletsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listHotTablets.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listHotTablets.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('Path templates', () => { describe('appProfile', () => { const fakePath = '/rendered/path/appProfile'; @@ -3652,6 +3940,83 @@ describe('v2.BigtableInstanceAdminClient', () => { }); }); + describe('hotTablet', () => { + const fakePath = '/rendered/path/hotTablet'; + const expectedParameters = { + project: 'projectValue', + instance: 'instanceValue', + cluster: 'clusterValue', + hot_tablet: 'hotTabletValue', + }; + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hotTabletPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.hotTabletPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('hotTabletPath', () => { + const result = client.hotTabletPath( + 'projectValue', + 'instanceValue', + 'clusterValue', + 'hotTabletValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.hotTabletPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromHotTabletName', () => { + const result = client.matchProjectFromHotTabletName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchInstanceFromHotTabletName', () => { + const result = client.matchInstanceFromHotTabletName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchClusterFromHotTabletName', () => { + const result = client.matchClusterFromHotTabletName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchHotTabletFromHotTabletName', () => { + const result = client.matchHotTabletFromHotTabletName(fakePath); + assert.strictEqual(result, 'hotTabletValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('instance', () => { const fakePath = '/rendered/path/instance'; const expectedParameters = { diff --git a/test/gapic_bigtable_table_admin_v2.ts b/test/gapic_bigtable_table_admin_v2.ts index 2b320b4b4..370dedcda 100644 --- a/test/gapic_bigtable_table_admin_v2.ts +++ b/test/gapic_bigtable_table_admin_v2.ts @@ -3961,6 +3961,82 @@ describe('v2.BigtableTableAdminClient', () => { }); }); + describe('hotTablet', () => { + const fakePath = '/rendered/path/hotTablet'; + const expectedParameters = { + project: 'projectValue', + instance: 'instanceValue', + cluster: 'clusterValue', + hot_tablet: 'hotTabletValue', + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hotTabletPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.hotTabletPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('hotTabletPath', () => { + const result = client.hotTabletPath( + 'projectValue', + 'instanceValue', + 'clusterValue', + 'hotTabletValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.hotTabletPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromHotTabletName', () => { + const result = client.matchProjectFromHotTabletName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchInstanceFromHotTabletName', () => { + const result = client.matchInstanceFromHotTabletName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchClusterFromHotTabletName', () => { + const result = client.matchClusterFromHotTabletName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchHotTabletFromHotTabletName', () => { + const result = client.matchHotTabletFromHotTabletName(fakePath); + assert.strictEqual(result, 'hotTabletValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('instance', () => { const fakePath = '/rendered/path/instance'; const expectedParameters = {