diff --git a/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto b/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto new file mode 100644 index 00000000000..d805128fc1c --- /dev/null +++ b/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto @@ -0,0 +1,782 @@ +// Copyright 2021 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 +// +// http://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. + +syntax = "proto3"; + +package google.cloud.tpu.v2alpha1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/tpu/v2alpha1;tpu"; +option java_multiple_files = true; +option java_outer_classname = "CloudTpuProto"; +option java_package = "com.google.cloud.tpu.v2alpha1"; + +// Manages TPU nodes and other resources +// +// TPU API v2alpha1 +service Tpu { + option (google.api.default_host) = "tpu.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists nodes. + rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) { + option (google.api.http) = { + get: "/v2alpha1/{parent=projects/*/locations/*}/nodes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a node. + rpc GetNode(GetNodeRequest) returns (Node) { + option (google.api.http) = { + get: "/v2alpha1/{name=projects/*/locations/*/nodes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a node. + rpc CreateNode(CreateNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{parent=projects/*/locations/*}/nodes" + body: "node" + }; + option (google.api.method_signature) = "parent,node,node_id"; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a node. + rpc DeleteNode(DeleteNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2alpha1/{name=projects/*/locations/*/nodes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Stops a node. This operation is only available with single TPU nodes. + rpc StopNode(StopNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:stop" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Starts a node. + rpc StartNode(StartNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:start" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Updates the configurations of a node. + rpc UpdateNode(UpdateNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2alpha1/{node.name=projects/*/locations/*/nodes/*}" + body: "node" + }; + option (google.api.method_signature) = "node,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Generates the Cloud TPU service identity for the project. + rpc GenerateServiceIdentity(GenerateServiceIdentityRequest) + returns (GenerateServiceIdentityResponse) { + option (google.api.http) = { + post: "/v2alpha1/{parent=projects/*/locations/*}:generateServiceIdentity" + body: "*" + }; + } + + // Lists accelerator types supported by this API. + rpc ListAcceleratorTypes(ListAcceleratorTypesRequest) + returns (ListAcceleratorTypesResponse) { + option (google.api.http) = { + get: "/v2alpha1/{parent=projects/*/locations/*}/acceleratorTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets AcceleratorType. + rpc GetAcceleratorType(GetAcceleratorTypeRequest) returns (AcceleratorType) { + option (google.api.http) = { + get: "/v2alpha1/{name=projects/*/locations/*/acceleratorTypes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists runtime versions supported by this API. + rpc ListRuntimeVersions(ListRuntimeVersionsRequest) + returns (ListRuntimeVersionsResponse) { + option (google.api.http) = { + get: "/v2alpha1/{parent=projects/*/locations/*}/runtimeVersions" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a runtime version. + rpc GetRuntimeVersion(GetRuntimeVersionRequest) returns (RuntimeVersion) { + option (google.api.http) = { + get: "/v2alpha1/{name=projects/*/locations/*/runtimeVersions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves the guest attributes for the node. + rpc GetGuestAttributes(GetGuestAttributesRequest) + returns (GetGuestAttributesResponse) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:getGuestAttributes" + body: "*" + }; + } +} + +// A guest attributes. +message GuestAttributes { + // The path to be queried. This can be the default namespace ('/') or a + // nested namespace ('/\/') or a specified key + // ('/\/\') + string query_path = 1; + + // The value of the requested queried path. + GuestAttributesValue query_value = 2; +} + +// Array of guest attribute namespace/key/value tuples. +message GuestAttributesValue { + // The list of guest attributes entries. + repeated GuestAttributesEntry items = 1; +} + +// A guest attributes namespace/key/value entry. +message GuestAttributesEntry { + // Namespace for the guest attribute entry. + string namespace = 1; + + // Key for the guest attribute entry. + string key = 2; + + // Value for the guest attribute entry. + string value = 3; +} + +// A node-attached disk resource. +// Next ID: 8; +message AttachedDisk { + // The different mode of the attached disk. + enum DiskMode { + // The disk mode is not known/set. + DISK_MODE_UNSPECIFIED = 0; + + // Attaches the disk in read-write mode. Only one TPU node can attach a disk + // in read-write mode at a time. + READ_WRITE = 1; + + // Attaches the disk in read-only mode. Multiple TPU nodes can attach + // a disk in read-only mode at a time. + READ_ONLY = 2; + } + + // Specifies the full path to an existing disk. + // For example: "projects/my-project/zones/us-central1-c/disks/my-disk". + string source_disk = 3; + + // The mode in which to attach this disk. + // If not specified, the default is READ_WRITE mode. + // Only applicable to data_disks. + DiskMode mode = 4; +} + +// Sets the scheduling options for this node. +message SchedulingConfig { + // Defines whether the node is preemptible. + bool preemptible = 1; + + // Whether the node is created under a reservation. + bool reserved = 2; +} + +// A network endpoint over which a TPU worker can be reached. +message NetworkEndpoint { + // The internal IP address of this network endpoint. + string ip_address = 1; + + // The port of this network endpoint. + int32 port = 2; + + // The access config for the TPU worker. + AccessConfig access_config = 5; +} + +// An access config attached to the TPU worker. +message AccessConfig { + // Output only. An external IP address associated with the TPU worker. + string external_ip = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Network related configurations. +message NetworkConfig { + // The name of the network for the TPU node. It must be a preexisting Google + // Compute Engine network. If none is provided, "default" will be used. + string network = 1; + + // The name of the subnetwork for the TPU node. It must be a preexisting + // Google Compute Engine subnetwork. If none is provided, "default" will be + // used. + string subnetwork = 2; + + // Indicates that external IP addresses would be associated with the TPU + // workers. If set to false, the specified subnetwork or network should have + // Private Google Access enabled. + bool enable_external_ips = 3; +} + +// A service account. +message ServiceAccount { + // Email address of the service account. If empty, default Compute service + // account will be used. + string email = 1; + + // The list of scopes to be made available for this service account. If empty, + // access to all Cloud APIs will be allowed. + repeated string scope = 2; +} + +// A TPU instance. +message Node { + option (google.api.resource) = { + type: "tpu.googleapis.com/Node" + pattern: "projects/{project}/locations/{location}/nodes/{node}" + }; + + // Represents the different states of a TPU node during its lifecycle. + enum State { + // TPU node state is not known/set. + STATE_UNSPECIFIED = 0; + + // TPU node is being created. + CREATING = 1; + + // TPU node has been created. + READY = 2; + + // TPU node is restarting. + RESTARTING = 3; + + // TPU node is undergoing reimaging. + REIMAGING = 4; + + // TPU node is being deleted. + DELETING = 5; + + // TPU node is being repaired and may be unusable. Details can be + // found in the `help_description` field. + REPAIRING = 6; + + // TPU node is stopped. + STOPPED = 8; + + // TPU node is currently stopping. + STOPPING = 9; + + // TPU node is currently starting. + STARTING = 10; + + // TPU node has been preempted. Only applies to Preemptible TPU Nodes. + PREEMPTED = 11; + + // TPU node has been terminated due to maintenance or has reached the end of + // its life cycle (for preemptible nodes). + TERMINATED = 12; + + // TPU node is currently hiding. + HIDING = 13; + + // TPU node has been hidden. + HIDDEN = 14; + + // TPU node is currently unhiding. + UNHIDING = 15; + } + + // Health defines the status of a TPU node as reported by + // Health Monitor. + enum Health { + // Health status is unknown: not initialized or failed to retrieve. + HEALTH_UNSPECIFIED = 0; + + // The resource is healthy. + HEALTHY = 1; + + // The resource is unresponsive. + TIMEOUT = 3; + + // The in-guest ML stack is unhealthy. + UNHEALTHY_TENSORFLOW = 4; + + // The node is under maintenance/priority boost caused rescheduling and + // will resume running once rescheduled. + UNHEALTHY_MAINTENANCE = 5; + } + + // TPU API Version. + enum ApiVersion { + // API version is unknown. + API_VERSION_UNSPECIFIED = 0; + + // TPU API V1Alpha1 version. + V1_ALPHA1 = 1; + + // TPU API V1 version. + V1 = 2; + + // TPU API V2Alpha1 version. + V2_ALPHA1 = 3; + } + + // Output only. Immutable. The name of the TPU. + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; + + // The user-supplied description of the TPU. Maximum of 512 characters. + string description = 3; + + // Required. The type of hardware accelerators associated with this node. + string accelerator_type = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The current state for the TPU Node. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If this field is populated, it contains a description of why + // the TPU Node is unhealthy. + string health_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The runtime version running in the Node. + string runtime_version = 11 [(google.api.field_behavior) = REQUIRED]; + + // Network configurations for the TPU node. + NetworkConfig network_config = 36; + + // The CIDR block that the TPU node will use when selecting an IP address. + // This CIDR block must be a /29 block; the Compute Engine networks API + // forbids a smaller block, and using a larger block would be wasteful (a + // node can only consume one IP address). Errors will occur if the CIDR block + // has already been used for a currently existing TPU node, the CIDR block + // conflicts with any subnetworks in the user's provided network, or the + // provided network is peered with another network that is using that CIDR + // block. + string cidr_block = 13; + + // The Google Cloud Platform Service Account to be used by the TPU node VMs. + // If None is specified, the default compute service account will be used. + ServiceAccount service_account = 37; + + // Output only. The time when the node was created. + google.protobuf.Timestamp create_time = 16 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The scheduling options for this node. + SchedulingConfig scheduling_config = 17; + + // Output only. The network endpoints where TPU workers can be accessed and + // sent work. It is recommended that runtime clients of the node reach out + // to the 0th entry in this map first. + repeated NetworkEndpoint network_endpoints = 21 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The health status of the TPU node. + Health health = 22; + + // Resource labels to represent user-provided metadata. + map labels = 24; + + // Custom metadata to apply to the TPU Node. + // Can set startup-script and shutdown-script + map metadata = 34; + + // Tags to apply to the TPU Node. Tags are used to identify valid sources or + // targets for network firewalls. + repeated string tags = 40; + + // Output only. The unique identifier for the TPU Node. + int64 id = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The additional data disks for the Node. + repeated AttachedDisk data_disks = 41; + + // Output only. The API version that created this Node. + ApiVersion api_version = 38 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Symptoms that have occurred to the TPU Node. + repeated Symptom symptoms = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes]. +message ListNodesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes]. +message ListNodesResponse { + // The listed nodes. + repeated Node nodes = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [GetNode][google.cloud.tpu.v2alpha1.Tpu.GetNode]. +message GetNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" } + ]; +} + +// Request for [CreateNode][google.cloud.tpu.v2alpha1.Tpu.CreateNode]. +message CreateNodeRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The unqualified resource name. + string node_id = 2; + + // Required. The node. + Node node = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for [DeleteNode][google.cloud.tpu.v2alpha1.Tpu.DeleteNode]. +message DeleteNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" } + ]; +} + +// Request for [StopNode][google.cloud.tpu.v2alpha1.Tpu.StopNode]. +message StopNodeRequest { + // The resource name. + string name = 1; +} + +// Request for [StartNode][google.cloud.tpu.v2alpha1.Tpu.StartNode]. +message StartNodeRequest { + // The resource name. + string name = 1; +} + +// Request for [UpdateNode][google.cloud.tpu.v2alpha1.Tpu.UpdateNode]. +message UpdateNodeRequest { + // Required. Mask of fields from [Node][Tpu.Node] to update. + // Supported fields: None. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The node. Only fields specified in update_mask are updated. + Node node = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The per-product per-project service identity for Cloud TPU service. +message ServiceIdentity { + // The email address of the service identity. + string email = 1; +} + +// Request for +// [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. +message GenerateServiceIdentityRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; +} + +// Response for +// [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. +message GenerateServiceIdentityResponse { + // ServiceIdentity that was created or retrieved. + ServiceIdentity identity = 1; +} + +// A accelerator type that a Node can be configured with. +message AcceleratorType { + option (google.api.resource) = { + type: "tpu.googleapis.com/AcceleratorType" + pattern: "projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}" + }; + + // The resource name. + string name = 1; + + // the accelerator type. + string type = 2; +} + +// Request for +// [GetAcceleratorType][google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType]. +message GetAcceleratorTypeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/AcceleratorType" + } + ]; +} + +// Request for +// [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. +message ListAcceleratorTypesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/AcceleratorType" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; + + // List filter. + string filter = 5; + + // Sort results. + string order_by = 6; +} + +// Response for +// [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. +message ListAcceleratorTypesResponse { + // The listed nodes. + repeated AcceleratorType accelerator_types = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Note: the following OperationMetadata message was added manually. +// This is caused by a conflict with some other message and will +// be resolved separately. Please make sure to add this message back +// if it's removed during public proto regeneration. + +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Target of the operation - for example + // projects/project-1/connectivityTests/test-1 + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Specifies if cancellation was requested for the operation. + bool cancel_requested = 6; + + // API version. + string api_version = 7; +} + +// A runtime version that a Node can be configured with. +message RuntimeVersion { + option (google.api.resource) = { + type: "tpu.googleapis.com/RuntimeVersion" + pattern: "projects/{project}/locations/{location}/runtimeVersions/{runtime_version}" + }; + + // The resource name. + string name = 1; + + // The runtime version. + string version = 2; +} + +// Request for +// [GetRuntimeVersion][google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion]. +message GetRuntimeVersionRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/RuntimeVersion" + } + ]; +} + +// Request for +// [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. +message ListRuntimeVersionsRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/RuntimeVersion" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; + + // List filter. + string filter = 5; + + // Sort results. + string order_by = 6; +} + +// Response for +// [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. +message ListRuntimeVersionsResponse { + // The listed nodes. + repeated RuntimeVersion runtime_versions = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A Symptom instance. +message Symptom { + // SymptomType represents the different types of Symptoms that a TPU can be + // at. + enum SymptomType { + // Unspecified symptom. + SYMPTOM_TYPE_UNSPECIFIED = 0; + + // TPU VM memory is low. + LOW_MEMORY = 1; + + // TPU runtime is out of memory. + OUT_OF_MEMORY = 2; + + // TPU runtime execution has timed out. + EXECUTE_TIMED_OUT = 3; + + // TPU runtime fails to construct a mesh that recognizes each TPU device's + // neighbors. + MESH_BUILD_FAIL = 4; + + // TPU HBM is out of memory. + HBM_OUT_OF_MEMORY = 5; + + // Abusive behaviors have been identified on the current project. + PROJECT_ABUSE = 6; + } + + // Timestamp when the Symptom is created. + google.protobuf.Timestamp create_time = 1; + + // Type of the Symptom. + SymptomType symptom_type = 2; + + // Detailed information of the current Symptom. + string details = 3; + + // A string used to uniquely distinguish a worker within a TPU node. + string worker_id = 4; +} + +// Request for +// [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. +message GetGuestAttributesRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" } + ]; + + // The guest attributes path to be queried. + string query_path = 2; + + // The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + // returned. + repeated string worker_ids = 3; +} + +// Response for +// [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. +message GetGuestAttributesResponse { + // The guest attributes for the TPU workers. + repeated GuestAttributes guest_attributes = 1; +} diff --git a/packages/google-cloud-tpu/protos/protos.d.ts b/packages/google-cloud-tpu/protos/protos.d.ts index 8cc7f53f47b..871b26a3999 100644 --- a/packages/google-cloud-tpu/protos/protos.d.ts +++ b/packages/google-cloud-tpu/protos/protos.d.ts @@ -2525,6 +2525,3706 @@ export namespace google { } } } + + /** Namespace v2alpha1. */ + namespace v2alpha1 { + + /** Represents a Tpu */ + class Tpu extends $protobuf.rpc.Service { + + /** + * Constructs a new Tpu service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Tpu service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Tpu; + + /** + * Calls ListNodes. + * @param request ListNodesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListNodesResponse + */ + public listNodes(request: google.cloud.tpu.v2alpha1.IListNodesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListNodesCallback): void; + + /** + * Calls ListNodes. + * @param request ListNodesRequest message or plain object + * @returns Promise + */ + public listNodes(request: google.cloud.tpu.v2alpha1.IListNodesRequest): Promise; + + /** + * Calls GetNode. + * @param request GetNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Node + */ + public getNode(request: google.cloud.tpu.v2alpha1.IGetNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetNodeCallback): void; + + /** + * Calls GetNode. + * @param request GetNodeRequest message or plain object + * @returns Promise + */ + public getNode(request: google.cloud.tpu.v2alpha1.IGetNodeRequest): Promise; + + /** + * Calls CreateNode. + * @param request CreateNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createNode(request: google.cloud.tpu.v2alpha1.ICreateNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.CreateNodeCallback): void; + + /** + * Calls CreateNode. + * @param request CreateNodeRequest message or plain object + * @returns Promise + */ + public createNode(request: google.cloud.tpu.v2alpha1.ICreateNodeRequest): Promise; + + /** + * Calls DeleteNode. + * @param request DeleteNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteNode(request: google.cloud.tpu.v2alpha1.IDeleteNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.DeleteNodeCallback): void; + + /** + * Calls DeleteNode. + * @param request DeleteNodeRequest message or plain object + * @returns Promise + */ + public deleteNode(request: google.cloud.tpu.v2alpha1.IDeleteNodeRequest): Promise; + + /** + * Calls StopNode. + * @param request StopNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public stopNode(request: google.cloud.tpu.v2alpha1.IStopNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.StopNodeCallback): void; + + /** + * Calls StopNode. + * @param request StopNodeRequest message or plain object + * @returns Promise + */ + public stopNode(request: google.cloud.tpu.v2alpha1.IStopNodeRequest): Promise; + + /** + * Calls StartNode. + * @param request StartNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public startNode(request: google.cloud.tpu.v2alpha1.IStartNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.StartNodeCallback): void; + + /** + * Calls StartNode. + * @param request StartNodeRequest message or plain object + * @returns Promise + */ + public startNode(request: google.cloud.tpu.v2alpha1.IStartNodeRequest): Promise; + + /** + * Calls UpdateNode. + * @param request UpdateNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateNode(request: google.cloud.tpu.v2alpha1.IUpdateNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.UpdateNodeCallback): void; + + /** + * Calls UpdateNode. + * @param request UpdateNodeRequest message or plain object + * @returns Promise + */ + public updateNode(request: google.cloud.tpu.v2alpha1.IUpdateNodeRequest): Promise; + + /** + * Calls GenerateServiceIdentity. + * @param request GenerateServiceIdentityRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateServiceIdentityResponse + */ + public generateServiceIdentity(request: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentityCallback): void; + + /** + * Calls GenerateServiceIdentity. + * @param request GenerateServiceIdentityRequest message or plain object + * @returns Promise + */ + public generateServiceIdentity(request: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest): Promise; + + /** + * Calls ListAcceleratorTypes. + * @param request ListAcceleratorTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListAcceleratorTypesResponse + */ + public listAcceleratorTypes(request: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypesCallback): void; + + /** + * Calls ListAcceleratorTypes. + * @param request ListAcceleratorTypesRequest message or plain object + * @returns Promise + */ + public listAcceleratorTypes(request: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest): Promise; + + /** + * Calls GetAcceleratorType. + * @param request GetAcceleratorTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AcceleratorType + */ + public getAcceleratorType(request: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorTypeCallback): void; + + /** + * Calls GetAcceleratorType. + * @param request GetAcceleratorTypeRequest message or plain object + * @returns Promise + */ + public getAcceleratorType(request: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest): Promise; + + /** + * Calls ListRuntimeVersions. + * @param request ListRuntimeVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListRuntimeVersionsResponse + */ + public listRuntimeVersions(request: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersionsCallback): void; + + /** + * Calls ListRuntimeVersions. + * @param request ListRuntimeVersionsRequest message or plain object + * @returns Promise + */ + public listRuntimeVersions(request: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest): Promise; + + /** + * Calls GetRuntimeVersion. + * @param request GetRuntimeVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and RuntimeVersion + */ + public getRuntimeVersion(request: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersionCallback): void; + + /** + * Calls GetRuntimeVersion. + * @param request GetRuntimeVersionRequest message or plain object + * @returns Promise + */ + public getRuntimeVersion(request: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest): Promise; + + /** + * Calls GetGuestAttributes. + * @param request GetGuestAttributesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetGuestAttributesResponse + */ + public getGuestAttributes(request: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributesCallback): void; + + /** + * Calls GetGuestAttributes. + * @param request GetGuestAttributesRequest message or plain object + * @returns Promise + */ + public getGuestAttributes(request: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest): Promise; + } + + namespace Tpu { + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#listNodes}. + * @param error Error, if any + * @param [response] ListNodesResponse + */ + type ListNodesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListNodesResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#getNode}. + * @param error Error, if any + * @param [response] Node + */ + type GetNodeCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.Node) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#createNode}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#deleteNode}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#stopNode}. + * @param error Error, if any + * @param [response] Operation + */ + type StopNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#startNode}. + * @param error Error, if any + * @param [response] Operation + */ + type StartNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#updateNode}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#generateServiceIdentity}. + * @param error Error, if any + * @param [response] GenerateServiceIdentityResponse + */ + type GenerateServiceIdentityCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#listAcceleratorTypes}. + * @param error Error, if any + * @param [response] ListAcceleratorTypesResponse + */ + type ListAcceleratorTypesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#getAcceleratorType}. + * @param error Error, if any + * @param [response] AcceleratorType + */ + type GetAcceleratorTypeCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.AcceleratorType) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#listRuntimeVersions}. + * @param error Error, if any + * @param [response] ListRuntimeVersionsResponse + */ + type ListRuntimeVersionsCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#getRuntimeVersion}. + * @param error Error, if any + * @param [response] RuntimeVersion + */ + type GetRuntimeVersionCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.RuntimeVersion) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#getGuestAttributes}. + * @param error Error, if any + * @param [response] GetGuestAttributesResponse + */ + type GetGuestAttributesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.GetGuestAttributesResponse) => void; + } + + /** Properties of a GuestAttributes. */ + interface IGuestAttributes { + + /** GuestAttributes queryPath */ + queryPath?: (string|null); + + /** GuestAttributes queryValue */ + queryValue?: (google.cloud.tpu.v2alpha1.IGuestAttributesValue|null); + } + + /** Represents a GuestAttributes. */ + class GuestAttributes implements IGuestAttributes { + + /** + * Constructs a new GuestAttributes. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGuestAttributes); + + /** GuestAttributes queryPath. */ + public queryPath: string; + + /** GuestAttributes queryValue. */ + public queryValue?: (google.cloud.tpu.v2alpha1.IGuestAttributesValue|null); + + /** + * Creates a new GuestAttributes instance using the specified properties. + * @param [properties] Properties to set + * @returns GuestAttributes instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGuestAttributes): google.cloud.tpu.v2alpha1.GuestAttributes; + + /** + * Encodes the specified GuestAttributes message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * @param message GuestAttributes message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGuestAttributes, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GuestAttributes message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * @param message GuestAttributes message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGuestAttributes, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GuestAttributes message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GuestAttributes + * @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.cloud.tpu.v2alpha1.GuestAttributes; + + /** + * Decodes a GuestAttributes message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GuestAttributes + * @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.cloud.tpu.v2alpha1.GuestAttributes; + + /** + * Verifies a GuestAttributes 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 GuestAttributes message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GuestAttributes + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GuestAttributes; + + /** + * Creates a plain object from a GuestAttributes message. Also converts values to other types if specified. + * @param message GuestAttributes + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GuestAttributes, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GuestAttributes to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GuestAttributesValue. */ + interface IGuestAttributesValue { + + /** GuestAttributesValue items */ + items?: (google.cloud.tpu.v2alpha1.IGuestAttributesEntry[]|null); + } + + /** Represents a GuestAttributesValue. */ + class GuestAttributesValue implements IGuestAttributesValue { + + /** + * Constructs a new GuestAttributesValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesValue); + + /** GuestAttributesValue items. */ + public items: google.cloud.tpu.v2alpha1.IGuestAttributesEntry[]; + + /** + * Creates a new GuestAttributesValue instance using the specified properties. + * @param [properties] Properties to set + * @returns GuestAttributesValue instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesValue): google.cloud.tpu.v2alpha1.GuestAttributesValue; + + /** + * Encodes the specified GuestAttributesValue message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * @param message GuestAttributesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGuestAttributesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GuestAttributesValue message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * @param message GuestAttributesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGuestAttributesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GuestAttributesValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GuestAttributesValue + * @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.cloud.tpu.v2alpha1.GuestAttributesValue; + + /** + * Decodes a GuestAttributesValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GuestAttributesValue + * @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.cloud.tpu.v2alpha1.GuestAttributesValue; + + /** + * Verifies a GuestAttributesValue 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 GuestAttributesValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GuestAttributesValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GuestAttributesValue; + + /** + * Creates a plain object from a GuestAttributesValue message. Also converts values to other types if specified. + * @param message GuestAttributesValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GuestAttributesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GuestAttributesValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GuestAttributesEntry. */ + interface IGuestAttributesEntry { + + /** GuestAttributesEntry namespace */ + namespace?: (string|null); + + /** GuestAttributesEntry key */ + key?: (string|null); + + /** GuestAttributesEntry value */ + value?: (string|null); + } + + /** Represents a GuestAttributesEntry. */ + class GuestAttributesEntry implements IGuestAttributesEntry { + + /** + * Constructs a new GuestAttributesEntry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesEntry); + + /** GuestAttributesEntry namespace. */ + public namespace: string; + + /** GuestAttributesEntry key. */ + public key: string; + + /** GuestAttributesEntry value. */ + public value: string; + + /** + * Creates a new GuestAttributesEntry instance using the specified properties. + * @param [properties] Properties to set + * @returns GuestAttributesEntry instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesEntry): google.cloud.tpu.v2alpha1.GuestAttributesEntry; + + /** + * Encodes the specified GuestAttributesEntry message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * @param message GuestAttributesEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGuestAttributesEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GuestAttributesEntry message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * @param message GuestAttributesEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGuestAttributesEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GuestAttributesEntry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GuestAttributesEntry + * @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.cloud.tpu.v2alpha1.GuestAttributesEntry; + + /** + * Decodes a GuestAttributesEntry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GuestAttributesEntry + * @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.cloud.tpu.v2alpha1.GuestAttributesEntry; + + /** + * Verifies a GuestAttributesEntry 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 GuestAttributesEntry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GuestAttributesEntry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GuestAttributesEntry; + + /** + * Creates a plain object from a GuestAttributesEntry message. Also converts values to other types if specified. + * @param message GuestAttributesEntry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GuestAttributesEntry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GuestAttributesEntry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AttachedDisk. */ + interface IAttachedDisk { + + /** AttachedDisk sourceDisk */ + sourceDisk?: (string|null); + + /** AttachedDisk mode */ + mode?: (google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|keyof typeof google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|null); + } + + /** Represents an AttachedDisk. */ + class AttachedDisk implements IAttachedDisk { + + /** + * Constructs a new AttachedDisk. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IAttachedDisk); + + /** AttachedDisk sourceDisk. */ + public sourceDisk: string; + + /** AttachedDisk mode. */ + public mode: (google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|keyof typeof google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode); + + /** + * Creates a new AttachedDisk instance using the specified properties. + * @param [properties] Properties to set + * @returns AttachedDisk instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IAttachedDisk): google.cloud.tpu.v2alpha1.AttachedDisk; + + /** + * Encodes the specified AttachedDisk message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * @param message AttachedDisk message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IAttachedDisk, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AttachedDisk message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * @param message AttachedDisk message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IAttachedDisk, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AttachedDisk message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AttachedDisk + * @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.cloud.tpu.v2alpha1.AttachedDisk; + + /** + * Decodes an AttachedDisk message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AttachedDisk + * @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.cloud.tpu.v2alpha1.AttachedDisk; + + /** + * Verifies an AttachedDisk message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AttachedDisk message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AttachedDisk + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.AttachedDisk; + + /** + * Creates a plain object from an AttachedDisk message. Also converts values to other types if specified. + * @param message AttachedDisk + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.AttachedDisk, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AttachedDisk to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace AttachedDisk { + + /** DiskMode enum. */ + enum DiskMode { + DISK_MODE_UNSPECIFIED = 0, + READ_WRITE = 1, + READ_ONLY = 2 + } + } + + /** Properties of a SchedulingConfig. */ + interface ISchedulingConfig { + + /** SchedulingConfig preemptible */ + preemptible?: (boolean|null); + + /** SchedulingConfig reserved */ + reserved?: (boolean|null); + } + + /** Represents a SchedulingConfig. */ + class SchedulingConfig implements ISchedulingConfig { + + /** + * Constructs a new SchedulingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.ISchedulingConfig); + + /** SchedulingConfig preemptible. */ + public preemptible: boolean; + + /** SchedulingConfig reserved. */ + public reserved: boolean; + + /** + * Creates a new SchedulingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SchedulingConfig instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.ISchedulingConfig): google.cloud.tpu.v2alpha1.SchedulingConfig; + + /** + * Encodes the specified SchedulingConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * @param message SchedulingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.ISchedulingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SchedulingConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * @param message SchedulingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ISchedulingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SchedulingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SchedulingConfig + * @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.cloud.tpu.v2alpha1.SchedulingConfig; + + /** + * Decodes a SchedulingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SchedulingConfig + * @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.cloud.tpu.v2alpha1.SchedulingConfig; + + /** + * Verifies a SchedulingConfig 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 SchedulingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SchedulingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.SchedulingConfig; + + /** + * Creates a plain object from a SchedulingConfig message. Also converts values to other types if specified. + * @param message SchedulingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.SchedulingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SchedulingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NetworkEndpoint. */ + interface INetworkEndpoint { + + /** NetworkEndpoint ipAddress */ + ipAddress?: (string|null); + + /** NetworkEndpoint port */ + port?: (number|null); + + /** NetworkEndpoint accessConfig */ + accessConfig?: (google.cloud.tpu.v2alpha1.IAccessConfig|null); + } + + /** Represents a NetworkEndpoint. */ + class NetworkEndpoint implements INetworkEndpoint { + + /** + * Constructs a new NetworkEndpoint. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.INetworkEndpoint); + + /** NetworkEndpoint ipAddress. */ + public ipAddress: string; + + /** NetworkEndpoint port. */ + public port: number; + + /** NetworkEndpoint accessConfig. */ + public accessConfig?: (google.cloud.tpu.v2alpha1.IAccessConfig|null); + + /** + * Creates a new NetworkEndpoint instance using the specified properties. + * @param [properties] Properties to set + * @returns NetworkEndpoint instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.INetworkEndpoint): google.cloud.tpu.v2alpha1.NetworkEndpoint; + + /** + * Encodes the specified NetworkEndpoint message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * @param message NetworkEndpoint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.INetworkEndpoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NetworkEndpoint message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * @param message NetworkEndpoint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.INetworkEndpoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NetworkEndpoint message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NetworkEndpoint + * @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.cloud.tpu.v2alpha1.NetworkEndpoint; + + /** + * Decodes a NetworkEndpoint message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NetworkEndpoint + * @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.cloud.tpu.v2alpha1.NetworkEndpoint; + + /** + * Verifies a NetworkEndpoint 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 NetworkEndpoint message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NetworkEndpoint + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.NetworkEndpoint; + + /** + * Creates a plain object from a NetworkEndpoint message. Also converts values to other types if specified. + * @param message NetworkEndpoint + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.NetworkEndpoint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NetworkEndpoint to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AccessConfig. */ + interface IAccessConfig { + + /** AccessConfig externalIp */ + externalIp?: (string|null); + } + + /** Represents an AccessConfig. */ + class AccessConfig implements IAccessConfig { + + /** + * Constructs a new AccessConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IAccessConfig); + + /** AccessConfig externalIp. */ + public externalIp: string; + + /** + * Creates a new AccessConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AccessConfig instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IAccessConfig): google.cloud.tpu.v2alpha1.AccessConfig; + + /** + * Encodes the specified AccessConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * @param message AccessConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IAccessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AccessConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * @param message AccessConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IAccessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AccessConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AccessConfig + * @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.cloud.tpu.v2alpha1.AccessConfig; + + /** + * Decodes an AccessConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AccessConfig + * @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.cloud.tpu.v2alpha1.AccessConfig; + + /** + * Verifies an AccessConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AccessConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AccessConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.AccessConfig; + + /** + * Creates a plain object from an AccessConfig message. Also converts values to other types if specified. + * @param message AccessConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.AccessConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AccessConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NetworkConfig. */ + interface INetworkConfig { + + /** NetworkConfig network */ + network?: (string|null); + + /** NetworkConfig subnetwork */ + subnetwork?: (string|null); + + /** NetworkConfig enableExternalIps */ + enableExternalIps?: (boolean|null); + } + + /** Represents a NetworkConfig. */ + class NetworkConfig implements INetworkConfig { + + /** + * Constructs a new NetworkConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.INetworkConfig); + + /** NetworkConfig network. */ + public network: string; + + /** NetworkConfig subnetwork. */ + public subnetwork: string; + + /** NetworkConfig enableExternalIps. */ + public enableExternalIps: boolean; + + /** + * Creates a new NetworkConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns NetworkConfig instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.INetworkConfig): google.cloud.tpu.v2alpha1.NetworkConfig; + + /** + * Encodes the specified NetworkConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * @param message NetworkConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.INetworkConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NetworkConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * @param message NetworkConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.INetworkConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NetworkConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NetworkConfig + * @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.cloud.tpu.v2alpha1.NetworkConfig; + + /** + * Decodes a NetworkConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NetworkConfig + * @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.cloud.tpu.v2alpha1.NetworkConfig; + + /** + * Verifies a NetworkConfig 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 NetworkConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NetworkConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.NetworkConfig; + + /** + * Creates a plain object from a NetworkConfig message. Also converts values to other types if specified. + * @param message NetworkConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.NetworkConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NetworkConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceAccount. */ + interface IServiceAccount { + + /** ServiceAccount email */ + email?: (string|null); + + /** ServiceAccount scope */ + scope?: (string[]|null); + } + + /** Represents a ServiceAccount. */ + class ServiceAccount implements IServiceAccount { + + /** + * Constructs a new ServiceAccount. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IServiceAccount); + + /** ServiceAccount email. */ + public email: string; + + /** ServiceAccount scope. */ + public scope: string[]; + + /** + * Creates a new ServiceAccount instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceAccount instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IServiceAccount): google.cloud.tpu.v2alpha1.ServiceAccount; + + /** + * Encodes the specified ServiceAccount message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * @param message ServiceAccount message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IServiceAccount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceAccount message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * @param message ServiceAccount message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IServiceAccount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceAccount message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceAccount + * @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.cloud.tpu.v2alpha1.ServiceAccount; + + /** + * Decodes a ServiceAccount message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceAccount + * @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.cloud.tpu.v2alpha1.ServiceAccount; + + /** + * Verifies a ServiceAccount 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 ServiceAccount message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceAccount + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ServiceAccount; + + /** + * Creates a plain object from a ServiceAccount message. Also converts values to other types if specified. + * @param message ServiceAccount + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ServiceAccount, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceAccount to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Node. */ + interface INode { + + /** Node name */ + name?: (string|null); + + /** Node description */ + description?: (string|null); + + /** Node acceleratorType */ + acceleratorType?: (string|null); + + /** Node state */ + state?: (google.cloud.tpu.v2alpha1.Node.State|keyof typeof google.cloud.tpu.v2alpha1.Node.State|null); + + /** Node healthDescription */ + healthDescription?: (string|null); + + /** Node runtimeVersion */ + runtimeVersion?: (string|null); + + /** Node networkConfig */ + networkConfig?: (google.cloud.tpu.v2alpha1.INetworkConfig|null); + + /** Node cidrBlock */ + cidrBlock?: (string|null); + + /** Node serviceAccount */ + serviceAccount?: (google.cloud.tpu.v2alpha1.IServiceAccount|null); + + /** Node createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Node schedulingConfig */ + schedulingConfig?: (google.cloud.tpu.v2alpha1.ISchedulingConfig|null); + + /** Node networkEndpoints */ + networkEndpoints?: (google.cloud.tpu.v2alpha1.INetworkEndpoint[]|null); + + /** Node health */ + health?: (google.cloud.tpu.v2alpha1.Node.Health|keyof typeof google.cloud.tpu.v2alpha1.Node.Health|null); + + /** Node labels */ + labels?: ({ [k: string]: string }|null); + + /** Node metadata */ + metadata?: ({ [k: string]: string }|null); + + /** Node tags */ + tags?: (string[]|null); + + /** Node id */ + id?: (number|Long|string|null); + + /** Node dataDisks */ + dataDisks?: (google.cloud.tpu.v2alpha1.IAttachedDisk[]|null); + + /** Node apiVersion */ + apiVersion?: (google.cloud.tpu.v2alpha1.Node.ApiVersion|keyof typeof google.cloud.tpu.v2alpha1.Node.ApiVersion|null); + + /** Node symptoms */ + symptoms?: (google.cloud.tpu.v2alpha1.ISymptom[]|null); + } + + /** Represents a Node. */ + class Node implements INode { + + /** + * Constructs a new Node. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.INode); + + /** Node name. */ + public name: string; + + /** Node description. */ + public description: string; + + /** Node acceleratorType. */ + public acceleratorType: string; + + /** Node state. */ + public state: (google.cloud.tpu.v2alpha1.Node.State|keyof typeof google.cloud.tpu.v2alpha1.Node.State); + + /** Node healthDescription. */ + public healthDescription: string; + + /** Node runtimeVersion. */ + public runtimeVersion: string; + + /** Node networkConfig. */ + public networkConfig?: (google.cloud.tpu.v2alpha1.INetworkConfig|null); + + /** Node cidrBlock. */ + public cidrBlock: string; + + /** Node serviceAccount. */ + public serviceAccount?: (google.cloud.tpu.v2alpha1.IServiceAccount|null); + + /** Node createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Node schedulingConfig. */ + public schedulingConfig?: (google.cloud.tpu.v2alpha1.ISchedulingConfig|null); + + /** Node networkEndpoints. */ + public networkEndpoints: google.cloud.tpu.v2alpha1.INetworkEndpoint[]; + + /** Node health. */ + public health: (google.cloud.tpu.v2alpha1.Node.Health|keyof typeof google.cloud.tpu.v2alpha1.Node.Health); + + /** Node labels. */ + public labels: { [k: string]: string }; + + /** Node metadata. */ + public metadata: { [k: string]: string }; + + /** Node tags. */ + public tags: string[]; + + /** Node id. */ + public id: (number|Long|string); + + /** Node dataDisks. */ + public dataDisks: google.cloud.tpu.v2alpha1.IAttachedDisk[]; + + /** Node apiVersion. */ + public apiVersion: (google.cloud.tpu.v2alpha1.Node.ApiVersion|keyof typeof google.cloud.tpu.v2alpha1.Node.ApiVersion); + + /** Node symptoms. */ + public symptoms: google.cloud.tpu.v2alpha1.ISymptom[]; + + /** + * Creates a new Node instance using the specified properties. + * @param [properties] Properties to set + * @returns Node instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.INode): google.cloud.tpu.v2alpha1.Node; + + /** + * Encodes the specified Node message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * @param message Node message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.INode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Node message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * @param message Node message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.INode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Node message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Node + * @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.cloud.tpu.v2alpha1.Node; + + /** + * Decodes a Node message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Node + * @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.cloud.tpu.v2alpha1.Node; + + /** + * Verifies a Node 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 Node message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Node + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.Node; + + /** + * Creates a plain object from a Node message. Also converts values to other types if specified. + * @param message Node + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.Node, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Node to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Node { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + READY = 2, + RESTARTING = 3, + REIMAGING = 4, + DELETING = 5, + REPAIRING = 6, + STOPPED = 8, + STOPPING = 9, + STARTING = 10, + PREEMPTED = 11, + TERMINATED = 12, + HIDING = 13, + HIDDEN = 14, + UNHIDING = 15 + } + + /** Health enum. */ + enum Health { + HEALTH_UNSPECIFIED = 0, + HEALTHY = 1, + TIMEOUT = 3, + UNHEALTHY_TENSORFLOW = 4, + UNHEALTHY_MAINTENANCE = 5 + } + + /** ApiVersion enum. */ + enum ApiVersion { + API_VERSION_UNSPECIFIED = 0, + V1_ALPHA1 = 1, + V1 = 2, + V2_ALPHA1 = 3 + } + } + + /** Properties of a ListNodesRequest. */ + interface IListNodesRequest { + + /** ListNodesRequest parent */ + parent?: (string|null); + + /** ListNodesRequest pageSize */ + pageSize?: (number|null); + + /** ListNodesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListNodesRequest. */ + class ListNodesRequest implements IListNodesRequest { + + /** + * Constructs a new ListNodesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListNodesRequest); + + /** ListNodesRequest parent. */ + public parent: string; + + /** ListNodesRequest pageSize. */ + public pageSize: number; + + /** ListNodesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListNodesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListNodesRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListNodesRequest): google.cloud.tpu.v2alpha1.ListNodesRequest; + + /** + * Encodes the specified ListNodesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * @param message ListNodesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListNodesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListNodesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * @param message ListNodesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListNodesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListNodesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListNodesRequest + * @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.cloud.tpu.v2alpha1.ListNodesRequest; + + /** + * Decodes a ListNodesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListNodesRequest + * @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.cloud.tpu.v2alpha1.ListNodesRequest; + + /** + * Verifies a ListNodesRequest 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 ListNodesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListNodesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListNodesRequest; + + /** + * Creates a plain object from a ListNodesRequest message. Also converts values to other types if specified. + * @param message ListNodesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListNodesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListNodesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListNodesResponse. */ + interface IListNodesResponse { + + /** ListNodesResponse nodes */ + nodes?: (google.cloud.tpu.v2alpha1.INode[]|null); + + /** ListNodesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListNodesResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListNodesResponse. */ + class ListNodesResponse implements IListNodesResponse { + + /** + * Constructs a new ListNodesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListNodesResponse); + + /** ListNodesResponse nodes. */ + public nodes: google.cloud.tpu.v2alpha1.INode[]; + + /** ListNodesResponse nextPageToken. */ + public nextPageToken: string; + + /** ListNodesResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListNodesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListNodesResponse instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListNodesResponse): google.cloud.tpu.v2alpha1.ListNodesResponse; + + /** + * Encodes the specified ListNodesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * @param message ListNodesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListNodesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListNodesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * @param message ListNodesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListNodesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListNodesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListNodesResponse + * @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.cloud.tpu.v2alpha1.ListNodesResponse; + + /** + * Decodes a ListNodesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListNodesResponse + * @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.cloud.tpu.v2alpha1.ListNodesResponse; + + /** + * Verifies a ListNodesResponse 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 ListNodesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListNodesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListNodesResponse; + + /** + * Creates a plain object from a ListNodesResponse message. Also converts values to other types if specified. + * @param message ListNodesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListNodesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListNodesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetNodeRequest. */ + interface IGetNodeRequest { + + /** GetNodeRequest name */ + name?: (string|null); + } + + /** Represents a GetNodeRequest. */ + class GetNodeRequest implements IGetNodeRequest { + + /** + * Constructs a new GetNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGetNodeRequest); + + /** GetNodeRequest name. */ + public name: string; + + /** + * Creates a new GetNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGetNodeRequest): google.cloud.tpu.v2alpha1.GetNodeRequest; + + /** + * Encodes the specified GetNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * @param message GetNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGetNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * @param message GetNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGetNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetNodeRequest + * @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.cloud.tpu.v2alpha1.GetNodeRequest; + + /** + * Decodes a GetNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetNodeRequest + * @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.cloud.tpu.v2alpha1.GetNodeRequest; + + /** + * Verifies a GetNodeRequest 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 GetNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GetNodeRequest; + + /** + * Creates a plain object from a GetNodeRequest message. Also converts values to other types if specified. + * @param message GetNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GetNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateNodeRequest. */ + interface ICreateNodeRequest { + + /** CreateNodeRequest parent */ + parent?: (string|null); + + /** CreateNodeRequest nodeId */ + nodeId?: (string|null); + + /** CreateNodeRequest node */ + node?: (google.cloud.tpu.v2alpha1.INode|null); + } + + /** Represents a CreateNodeRequest. */ + class CreateNodeRequest implements ICreateNodeRequest { + + /** + * Constructs a new CreateNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.ICreateNodeRequest); + + /** CreateNodeRequest parent. */ + public parent: string; + + /** CreateNodeRequest nodeId. */ + public nodeId: string; + + /** CreateNodeRequest node. */ + public node?: (google.cloud.tpu.v2alpha1.INode|null); + + /** + * Creates a new CreateNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.ICreateNodeRequest): google.cloud.tpu.v2alpha1.CreateNodeRequest; + + /** + * Encodes the specified CreateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * @param message CreateNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.ICreateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * @param message CreateNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ICreateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateNodeRequest + * @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.cloud.tpu.v2alpha1.CreateNodeRequest; + + /** + * Decodes a CreateNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateNodeRequest + * @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.cloud.tpu.v2alpha1.CreateNodeRequest; + + /** + * Verifies a CreateNodeRequest 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 CreateNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.CreateNodeRequest; + + /** + * Creates a plain object from a CreateNodeRequest message. Also converts values to other types if specified. + * @param message CreateNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.CreateNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteNodeRequest. */ + interface IDeleteNodeRequest { + + /** DeleteNodeRequest name */ + name?: (string|null); + } + + /** Represents a DeleteNodeRequest. */ + class DeleteNodeRequest implements IDeleteNodeRequest { + + /** + * Constructs a new DeleteNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IDeleteNodeRequest); + + /** DeleteNodeRequest name. */ + public name: string; + + /** + * Creates a new DeleteNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IDeleteNodeRequest): google.cloud.tpu.v2alpha1.DeleteNodeRequest; + + /** + * Encodes the specified DeleteNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * @param message DeleteNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IDeleteNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * @param message DeleteNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IDeleteNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteNodeRequest + * @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.cloud.tpu.v2alpha1.DeleteNodeRequest; + + /** + * Decodes a DeleteNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteNodeRequest + * @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.cloud.tpu.v2alpha1.DeleteNodeRequest; + + /** + * Verifies a DeleteNodeRequest 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 DeleteNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.DeleteNodeRequest; + + /** + * Creates a plain object from a DeleteNodeRequest message. Also converts values to other types if specified. + * @param message DeleteNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.DeleteNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StopNodeRequest. */ + interface IStopNodeRequest { + + /** StopNodeRequest name */ + name?: (string|null); + } + + /** Represents a StopNodeRequest. */ + class StopNodeRequest implements IStopNodeRequest { + + /** + * Constructs a new StopNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IStopNodeRequest); + + /** StopNodeRequest name. */ + public name: string; + + /** + * Creates a new StopNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StopNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IStopNodeRequest): google.cloud.tpu.v2alpha1.StopNodeRequest; + + /** + * Encodes the specified StopNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * @param message StopNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IStopNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StopNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * @param message StopNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IStopNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StopNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StopNodeRequest + * @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.cloud.tpu.v2alpha1.StopNodeRequest; + + /** + * Decodes a StopNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StopNodeRequest + * @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.cloud.tpu.v2alpha1.StopNodeRequest; + + /** + * Verifies a StopNodeRequest 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 StopNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StopNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.StopNodeRequest; + + /** + * Creates a plain object from a StopNodeRequest message. Also converts values to other types if specified. + * @param message StopNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.StopNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StopNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StartNodeRequest. */ + interface IStartNodeRequest { + + /** StartNodeRequest name */ + name?: (string|null); + } + + /** Represents a StartNodeRequest. */ + class StartNodeRequest implements IStartNodeRequest { + + /** + * Constructs a new StartNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IStartNodeRequest); + + /** StartNodeRequest name. */ + public name: string; + + /** + * Creates a new StartNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StartNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IStartNodeRequest): google.cloud.tpu.v2alpha1.StartNodeRequest; + + /** + * Encodes the specified StartNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * @param message StartNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IStartNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StartNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * @param message StartNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IStartNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StartNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StartNodeRequest + * @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.cloud.tpu.v2alpha1.StartNodeRequest; + + /** + * Decodes a StartNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StartNodeRequest + * @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.cloud.tpu.v2alpha1.StartNodeRequest; + + /** + * Verifies a StartNodeRequest 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 StartNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StartNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.StartNodeRequest; + + /** + * Creates a plain object from a StartNodeRequest message. Also converts values to other types if specified. + * @param message StartNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.StartNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StartNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateNodeRequest. */ + interface IUpdateNodeRequest { + + /** UpdateNodeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateNodeRequest node */ + node?: (google.cloud.tpu.v2alpha1.INode|null); + } + + /** Represents an UpdateNodeRequest. */ + class UpdateNodeRequest implements IUpdateNodeRequest { + + /** + * Constructs a new UpdateNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IUpdateNodeRequest); + + /** UpdateNodeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateNodeRequest node. */ + public node?: (google.cloud.tpu.v2alpha1.INode|null); + + /** + * Creates a new UpdateNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IUpdateNodeRequest): google.cloud.tpu.v2alpha1.UpdateNodeRequest; + + /** + * Encodes the specified UpdateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * @param message UpdateNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IUpdateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * @param message UpdateNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IUpdateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateNodeRequest + * @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.cloud.tpu.v2alpha1.UpdateNodeRequest; + + /** + * Decodes an UpdateNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateNodeRequest + * @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.cloud.tpu.v2alpha1.UpdateNodeRequest; + + /** + * Verifies an UpdateNodeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.UpdateNodeRequest; + + /** + * Creates a plain object from an UpdateNodeRequest message. Also converts values to other types if specified. + * @param message UpdateNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.UpdateNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceIdentity. */ + interface IServiceIdentity { + + /** ServiceIdentity email */ + email?: (string|null); + } + + /** Represents a ServiceIdentity. */ + class ServiceIdentity implements IServiceIdentity { + + /** + * Constructs a new ServiceIdentity. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IServiceIdentity); + + /** ServiceIdentity email. */ + public email: string; + + /** + * Creates a new ServiceIdentity instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceIdentity instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IServiceIdentity): google.cloud.tpu.v2alpha1.ServiceIdentity; + + /** + * Encodes the specified ServiceIdentity message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceIdentity.verify|verify} messages. + * @param message ServiceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IServiceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceIdentity message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceIdentity.verify|verify} messages. + * @param message ServiceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IServiceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceIdentity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceIdentity + * @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.cloud.tpu.v2alpha1.ServiceIdentity; + + /** + * Decodes a ServiceIdentity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceIdentity + * @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.cloud.tpu.v2alpha1.ServiceIdentity; + + /** + * Verifies a ServiceIdentity 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 ServiceIdentity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceIdentity + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ServiceIdentity; + + /** + * Creates a plain object from a ServiceIdentity message. Also converts values to other types if specified. + * @param message ServiceIdentity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ServiceIdentity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceIdentity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateServiceIdentityRequest. */ + interface IGenerateServiceIdentityRequest { + + /** GenerateServiceIdentityRequest parent */ + parent?: (string|null); + } + + /** Represents a GenerateServiceIdentityRequest. */ + class GenerateServiceIdentityRequest implements IGenerateServiceIdentityRequest { + + /** + * Constructs a new GenerateServiceIdentityRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest); + + /** GenerateServiceIdentityRequest parent. */ + public parent: string; + + /** + * Creates a new GenerateServiceIdentityRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateServiceIdentityRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest): google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest; + + /** + * Encodes the specified GenerateServiceIdentityRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest.verify|verify} messages. + * @param message GenerateServiceIdentityRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateServiceIdentityRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest.verify|verify} messages. + * @param message GenerateServiceIdentityRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateServiceIdentityRequest + * @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.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest; + + /** + * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateServiceIdentityRequest + * @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.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest; + + /** + * Verifies a GenerateServiceIdentityRequest 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 GenerateServiceIdentityRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateServiceIdentityRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest; + + /** + * Creates a plain object from a GenerateServiceIdentityRequest message. Also converts values to other types if specified. + * @param message GenerateServiceIdentityRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateServiceIdentityRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateServiceIdentityResponse. */ + interface IGenerateServiceIdentityResponse { + + /** GenerateServiceIdentityResponse identity */ + identity?: (google.cloud.tpu.v2alpha1.IServiceIdentity|null); + } + + /** Represents a GenerateServiceIdentityResponse. */ + class GenerateServiceIdentityResponse implements IGenerateServiceIdentityResponse { + + /** + * Constructs a new GenerateServiceIdentityResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse); + + /** GenerateServiceIdentityResponse identity. */ + public identity?: (google.cloud.tpu.v2alpha1.IServiceIdentity|null); + + /** + * Creates a new GenerateServiceIdentityResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateServiceIdentityResponse instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse): google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse; + + /** + * Encodes the specified GenerateServiceIdentityResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.verify|verify} messages. + * @param message GenerateServiceIdentityResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateServiceIdentityResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.verify|verify} messages. + * @param message GenerateServiceIdentityResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateServiceIdentityResponse + * @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.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse; + + /** + * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateServiceIdentityResponse + * @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.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse; + + /** + * Verifies a GenerateServiceIdentityResponse 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 GenerateServiceIdentityResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateServiceIdentityResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse; + + /** + * Creates a plain object from a GenerateServiceIdentityResponse message. Also converts values to other types if specified. + * @param message GenerateServiceIdentityResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateServiceIdentityResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AcceleratorType. */ + interface IAcceleratorType { + + /** AcceleratorType name */ + name?: (string|null); + + /** AcceleratorType type */ + type?: (string|null); + } + + /** Represents an AcceleratorType. */ + class AcceleratorType implements IAcceleratorType { + + /** + * Constructs a new AcceleratorType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IAcceleratorType); + + /** AcceleratorType name. */ + public name: string; + + /** AcceleratorType type. */ + public type: string; + + /** + * Creates a new AcceleratorType instance using the specified properties. + * @param [properties] Properties to set + * @returns AcceleratorType instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IAcceleratorType): google.cloud.tpu.v2alpha1.AcceleratorType; + + /** + * Encodes the specified AcceleratorType message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorType.verify|verify} messages. + * @param message AcceleratorType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IAcceleratorType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AcceleratorType message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorType.verify|verify} messages. + * @param message AcceleratorType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IAcceleratorType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AcceleratorType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AcceleratorType + * @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.cloud.tpu.v2alpha1.AcceleratorType; + + /** + * Decodes an AcceleratorType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AcceleratorType + * @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.cloud.tpu.v2alpha1.AcceleratorType; + + /** + * Verifies an AcceleratorType message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AcceleratorType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AcceleratorType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.AcceleratorType; + + /** + * Creates a plain object from an AcceleratorType message. Also converts values to other types if specified. + * @param message AcceleratorType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.AcceleratorType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AcceleratorType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetAcceleratorTypeRequest. */ + interface IGetAcceleratorTypeRequest { + + /** GetAcceleratorTypeRequest name */ + name?: (string|null); + } + + /** Represents a GetAcceleratorTypeRequest. */ + class GetAcceleratorTypeRequest implements IGetAcceleratorTypeRequest { + + /** + * Constructs a new GetAcceleratorTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest); + + /** GetAcceleratorTypeRequest name. */ + public name: string; + + /** + * Creates a new GetAcceleratorTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetAcceleratorTypeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest): google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest; + + /** + * Encodes the specified GetAcceleratorTypeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest.verify|verify} messages. + * @param message GetAcceleratorTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetAcceleratorTypeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest.verify|verify} messages. + * @param message GetAcceleratorTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetAcceleratorTypeRequest + * @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.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest; + + /** + * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetAcceleratorTypeRequest + * @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.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest; + + /** + * Verifies a GetAcceleratorTypeRequest 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 GetAcceleratorTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetAcceleratorTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest; + + /** + * Creates a plain object from a GetAcceleratorTypeRequest message. Also converts values to other types if specified. + * @param message GetAcceleratorTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetAcceleratorTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListAcceleratorTypesRequest. */ + interface IListAcceleratorTypesRequest { + + /** ListAcceleratorTypesRequest parent */ + parent?: (string|null); + + /** ListAcceleratorTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListAcceleratorTypesRequest pageToken */ + pageToken?: (string|null); + + /** ListAcceleratorTypesRequest filter */ + filter?: (string|null); + + /** ListAcceleratorTypesRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListAcceleratorTypesRequest. */ + class ListAcceleratorTypesRequest implements IListAcceleratorTypesRequest { + + /** + * Constructs a new ListAcceleratorTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest); + + /** ListAcceleratorTypesRequest parent. */ + public parent: string; + + /** ListAcceleratorTypesRequest pageSize. */ + public pageSize: number; + + /** ListAcceleratorTypesRequest pageToken. */ + public pageToken: string; + + /** ListAcceleratorTypesRequest filter. */ + public filter: string; + + /** ListAcceleratorTypesRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListAcceleratorTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAcceleratorTypesRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest): google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest; + + /** + * Encodes the specified ListAcceleratorTypesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest.verify|verify} messages. + * @param message ListAcceleratorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAcceleratorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest.verify|verify} messages. + * @param message ListAcceleratorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAcceleratorTypesRequest + * @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.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest; + + /** + * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAcceleratorTypesRequest + * @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.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest; + + /** + * Verifies a ListAcceleratorTypesRequest 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 ListAcceleratorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAcceleratorTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest; + + /** + * Creates a plain object from a ListAcceleratorTypesRequest message. Also converts values to other types if specified. + * @param message ListAcceleratorTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAcceleratorTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListAcceleratorTypesResponse. */ + interface IListAcceleratorTypesResponse { + + /** ListAcceleratorTypesResponse acceleratorTypes */ + acceleratorTypes?: (google.cloud.tpu.v2alpha1.IAcceleratorType[]|null); + + /** ListAcceleratorTypesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListAcceleratorTypesResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListAcceleratorTypesResponse. */ + class ListAcceleratorTypesResponse implements IListAcceleratorTypesResponse { + + /** + * Constructs a new ListAcceleratorTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse); + + /** ListAcceleratorTypesResponse acceleratorTypes. */ + public acceleratorTypes: google.cloud.tpu.v2alpha1.IAcceleratorType[]; + + /** ListAcceleratorTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** ListAcceleratorTypesResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListAcceleratorTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAcceleratorTypesResponse instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse): google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse; + + /** + * Encodes the specified ListAcceleratorTypesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.verify|verify} messages. + * @param message ListAcceleratorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAcceleratorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.verify|verify} messages. + * @param message ListAcceleratorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAcceleratorTypesResponse + * @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.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse; + + /** + * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAcceleratorTypesResponse + * @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.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse; + + /** + * Verifies a ListAcceleratorTypesResponse 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 ListAcceleratorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAcceleratorTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse; + + /** + * Creates a plain object from a ListAcceleratorTypesResponse message. Also converts values to other types if specified. + * @param message ListAcceleratorTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAcceleratorTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target */ + target?: (string|null); + + /** OperationMetadata verb */ + verb?: (string|null); + + /** OperationMetadata statusDetail */ + statusDetail?: (string|null); + + /** OperationMetadata cancelRequested */ + cancelRequested?: (boolean|null); + + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IOperationMetadata); + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target. */ + public target: string; + + /** OperationMetadata verb. */ + public verb: string; + + /** OperationMetadata statusDetail. */ + public statusDetail: string; + + /** OperationMetadata cancelRequested. */ + public cancelRequested: boolean; + + /** OperationMetadata apiVersion. */ + public apiVersion: string; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IOperationMetadata): google.cloud.tpu.v2alpha1.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @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.cloud.tpu.v2alpha1.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @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.cloud.tpu.v2alpha1.OperationMetadata; + + /** + * Verifies an OperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RuntimeVersion. */ + interface IRuntimeVersion { + + /** RuntimeVersion name */ + name?: (string|null); + + /** RuntimeVersion version */ + version?: (string|null); + } + + /** Represents a RuntimeVersion. */ + class RuntimeVersion implements IRuntimeVersion { + + /** + * Constructs a new RuntimeVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IRuntimeVersion); + + /** RuntimeVersion name. */ + public name: string; + + /** RuntimeVersion version. */ + public version: string; + + /** + * Creates a new RuntimeVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns RuntimeVersion instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IRuntimeVersion): google.cloud.tpu.v2alpha1.RuntimeVersion; + + /** + * Encodes the specified RuntimeVersion message. Does not implicitly {@link google.cloud.tpu.v2alpha1.RuntimeVersion.verify|verify} messages. + * @param message RuntimeVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IRuntimeVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RuntimeVersion message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.RuntimeVersion.verify|verify} messages. + * @param message RuntimeVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IRuntimeVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RuntimeVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RuntimeVersion + * @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.cloud.tpu.v2alpha1.RuntimeVersion; + + /** + * Decodes a RuntimeVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RuntimeVersion + * @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.cloud.tpu.v2alpha1.RuntimeVersion; + + /** + * Verifies a RuntimeVersion 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 RuntimeVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RuntimeVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.RuntimeVersion; + + /** + * Creates a plain object from a RuntimeVersion message. Also converts values to other types if specified. + * @param message RuntimeVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.RuntimeVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RuntimeVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetRuntimeVersionRequest. */ + interface IGetRuntimeVersionRequest { + + /** GetRuntimeVersionRequest name */ + name?: (string|null); + } + + /** Represents a GetRuntimeVersionRequest. */ + class GetRuntimeVersionRequest implements IGetRuntimeVersionRequest { + + /** + * Constructs a new GetRuntimeVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest); + + /** GetRuntimeVersionRequest name. */ + public name: string; + + /** + * Creates a new GetRuntimeVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetRuntimeVersionRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest): google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest; + + /** + * Encodes the specified GetRuntimeVersionRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest.verify|verify} messages. + * @param message GetRuntimeVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetRuntimeVersionRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest.verify|verify} messages. + * @param message GetRuntimeVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetRuntimeVersionRequest + * @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.cloud.tpu.v2alpha1.GetRuntimeVersionRequest; + + /** + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetRuntimeVersionRequest + * @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.cloud.tpu.v2alpha1.GetRuntimeVersionRequest; + + /** + * Verifies a GetRuntimeVersionRequest 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 GetRuntimeVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetRuntimeVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest; + + /** + * Creates a plain object from a GetRuntimeVersionRequest message. Also converts values to other types if specified. + * @param message GetRuntimeVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetRuntimeVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimeVersionsRequest. */ + interface IListRuntimeVersionsRequest { + + /** ListRuntimeVersionsRequest parent */ + parent?: (string|null); + + /** ListRuntimeVersionsRequest pageSize */ + pageSize?: (number|null); + + /** ListRuntimeVersionsRequest pageToken */ + pageToken?: (string|null); + + /** ListRuntimeVersionsRequest filter */ + filter?: (string|null); + + /** ListRuntimeVersionsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListRuntimeVersionsRequest. */ + class ListRuntimeVersionsRequest implements IListRuntimeVersionsRequest { + + /** + * Constructs a new ListRuntimeVersionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest); + + /** ListRuntimeVersionsRequest parent. */ + public parent: string; + + /** ListRuntimeVersionsRequest pageSize. */ + public pageSize: number; + + /** ListRuntimeVersionsRequest pageToken. */ + public pageToken: string; + + /** ListRuntimeVersionsRequest filter. */ + public filter: string; + + /** ListRuntimeVersionsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListRuntimeVersionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimeVersionsRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest): google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest; + + /** + * Encodes the specified ListRuntimeVersionsRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest.verify|verify} messages. + * @param message ListRuntimeVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimeVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest.verify|verify} messages. + * @param message ListRuntimeVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimeVersionsRequest + * @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.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest; + + /** + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimeVersionsRequest + * @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.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest; + + /** + * Verifies a ListRuntimeVersionsRequest 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 ListRuntimeVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimeVersionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest; + + /** + * Creates a plain object from a ListRuntimeVersionsRequest message. Also converts values to other types if specified. + * @param message ListRuntimeVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimeVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimeVersionsResponse. */ + interface IListRuntimeVersionsResponse { + + /** ListRuntimeVersionsResponse runtimeVersions */ + runtimeVersions?: (google.cloud.tpu.v2alpha1.IRuntimeVersion[]|null); + + /** ListRuntimeVersionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListRuntimeVersionsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListRuntimeVersionsResponse. */ + class ListRuntimeVersionsResponse implements IListRuntimeVersionsResponse { + + /** + * Constructs a new ListRuntimeVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse); + + /** ListRuntimeVersionsResponse runtimeVersions. */ + public runtimeVersions: google.cloud.tpu.v2alpha1.IRuntimeVersion[]; + + /** ListRuntimeVersionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListRuntimeVersionsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListRuntimeVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimeVersionsResponse instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse): google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + + /** + * Encodes the specified ListRuntimeVersionsResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * @param message ListRuntimeVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimeVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * @param message ListRuntimeVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimeVersionsResponse + * @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.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimeVersionsResponse + * @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.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + + /** + * Verifies a ListRuntimeVersionsResponse 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 ListRuntimeVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimeVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + + /** + * Creates a plain object from a ListRuntimeVersionsResponse message. Also converts values to other types if specified. + * @param message ListRuntimeVersionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimeVersionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Symptom. */ + interface ISymptom { + + /** Symptom createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Symptom symptomType */ + symptomType?: (google.cloud.tpu.v2alpha1.Symptom.SymptomType|keyof typeof google.cloud.tpu.v2alpha1.Symptom.SymptomType|null); + + /** Symptom details */ + details?: (string|null); + + /** Symptom workerId */ + workerId?: (string|null); + } + + /** Represents a Symptom. */ + class Symptom implements ISymptom { + + /** + * Constructs a new Symptom. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.ISymptom); + + /** Symptom createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Symptom symptomType. */ + public symptomType: (google.cloud.tpu.v2alpha1.Symptom.SymptomType|keyof typeof google.cloud.tpu.v2alpha1.Symptom.SymptomType); + + /** Symptom details. */ + public details: string; + + /** Symptom workerId. */ + public workerId: string; + + /** + * Creates a new Symptom instance using the specified properties. + * @param [properties] Properties to set + * @returns Symptom instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.ISymptom): google.cloud.tpu.v2alpha1.Symptom; + + /** + * Encodes the specified Symptom message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Symptom.verify|verify} messages. + * @param message Symptom message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.ISymptom, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Symptom message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Symptom.verify|verify} messages. + * @param message Symptom message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ISymptom, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Symptom message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Symptom + * @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.cloud.tpu.v2alpha1.Symptom; + + /** + * Decodes a Symptom message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Symptom + * @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.cloud.tpu.v2alpha1.Symptom; + + /** + * Verifies a Symptom 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 Symptom message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Symptom + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.Symptom; + + /** + * Creates a plain object from a Symptom message. Also converts values to other types if specified. + * @param message Symptom + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.Symptom, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Symptom to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Symptom { + + /** SymptomType enum. */ + enum SymptomType { + SYMPTOM_TYPE_UNSPECIFIED = 0, + LOW_MEMORY = 1, + OUT_OF_MEMORY = 2, + EXECUTE_TIMED_OUT = 3, + MESH_BUILD_FAIL = 4, + HBM_OUT_OF_MEMORY = 5, + PROJECT_ABUSE = 6 + } + } + + /** Properties of a GetGuestAttributesRequest. */ + interface IGetGuestAttributesRequest { + + /** GetGuestAttributesRequest name */ + name?: (string|null); + + /** GetGuestAttributesRequest queryPath */ + queryPath?: (string|null); + + /** GetGuestAttributesRequest workerIds */ + workerIds?: (string[]|null); + } + + /** Represents a GetGuestAttributesRequest. */ + class GetGuestAttributesRequest implements IGetGuestAttributesRequest { + + /** + * Constructs a new GetGuestAttributesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest); + + /** GetGuestAttributesRequest name. */ + public name: string; + + /** GetGuestAttributesRequest queryPath. */ + public queryPath: string; + + /** GetGuestAttributesRequest workerIds. */ + public workerIds: string[]; + + /** + * Creates a new GetGuestAttributesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetGuestAttributesRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest): google.cloud.tpu.v2alpha1.GetGuestAttributesRequest; + + /** + * Encodes the specified GetGuestAttributesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesRequest.verify|verify} messages. + * @param message GetGuestAttributesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetGuestAttributesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesRequest.verify|verify} messages. + * @param message GetGuestAttributesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetGuestAttributesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetGuestAttributesRequest + * @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.cloud.tpu.v2alpha1.GetGuestAttributesRequest; + + /** + * Decodes a GetGuestAttributesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetGuestAttributesRequest + * @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.cloud.tpu.v2alpha1.GetGuestAttributesRequest; + + /** + * Verifies a GetGuestAttributesRequest 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 GetGuestAttributesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetGuestAttributesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GetGuestAttributesRequest; + + /** + * Creates a plain object from a GetGuestAttributesRequest message. Also converts values to other types if specified. + * @param message GetGuestAttributesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GetGuestAttributesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetGuestAttributesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetGuestAttributesResponse. */ + interface IGetGuestAttributesResponse { + + /** GetGuestAttributesResponse guestAttributes */ + guestAttributes?: (google.cloud.tpu.v2alpha1.IGuestAttributes[]|null); + } + + /** Represents a GetGuestAttributesResponse. */ + class GetGuestAttributesResponse implements IGetGuestAttributesResponse { + + /** + * Constructs a new GetGuestAttributesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse); + + /** GetGuestAttributesResponse guestAttributes. */ + public guestAttributes: google.cloud.tpu.v2alpha1.IGuestAttributes[]; + + /** + * Creates a new GetGuestAttributesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GetGuestAttributesResponse instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse): google.cloud.tpu.v2alpha1.GetGuestAttributesResponse; + + /** + * Encodes the specified GetGuestAttributesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.verify|verify} messages. + * @param message GetGuestAttributesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetGuestAttributesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.verify|verify} messages. + * @param message GetGuestAttributesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetGuestAttributesResponse + * @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.cloud.tpu.v2alpha1.GetGuestAttributesResponse; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetGuestAttributesResponse + * @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.cloud.tpu.v2alpha1.GetGuestAttributesResponse; + + /** + * Verifies a GetGuestAttributesResponse 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 GetGuestAttributesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetGuestAttributesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GetGuestAttributesResponse; + + /** + * Creates a plain object from a GetGuestAttributesResponse message. Also converts values to other types if specified. + * @param message GetGuestAttributesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GetGuestAttributesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetGuestAttributesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } } } @@ -6624,6 +10324,96 @@ export namespace google { */ public toJSON(): { [k: string]: any }; } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @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.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @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.protobuf.FieldMask; + + /** + * Verifies a FieldMask 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 FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } /** Namespace longrunning. */ diff --git a/packages/google-cloud-tpu/protos/protos.js b/packages/google-cloud-tpu/protos/protos.js index ec7715910be..556bf8caa16 100644 --- a/packages/google-cloud-tpu/protos/protos.js +++ b/packages/google-cloud-tpu/protos/protos.js @@ -6009,6 +6009,8739 @@ return v1; })(); + tpu.v2alpha1 = (function() { + + /** + * Namespace v2alpha1. + * @memberof google.cloud.tpu + * @namespace + */ + var v2alpha1 = {}; + + v2alpha1.Tpu = (function() { + + /** + * Constructs a new Tpu service. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a Tpu + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Tpu(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Tpu.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Tpu; + + /** + * Creates new Tpu service using the specified rpc implementation. + * @function create + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Tpu} RPC service. Useful where requests and/or responses are streamed. + */ + Tpu.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#listNodes}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef ListNodesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.ListNodesResponse} [response] ListNodesResponse + */ + + /** + * Calls ListNodes. + * @function listNodes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} request ListNodesRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.ListNodesCallback} callback Node-style callback called with the error, if any, and ListNodesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.listNodes = function listNodes(request, callback) { + return this.rpcCall(listNodes, $root.google.cloud.tpu.v2alpha1.ListNodesRequest, $root.google.cloud.tpu.v2alpha1.ListNodesResponse, request, callback); + }, "name", { value: "ListNodes" }); + + /** + * Calls ListNodes. + * @function listNodes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} request ListNodesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#getNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GetNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.Node} [response] Node + */ + + /** + * Calls GetNode. + * @function getNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} request GetNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GetNodeCallback} callback Node-style callback called with the error, if any, and Node + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.getNode = function getNode(request, callback) { + return this.rpcCall(getNode, $root.google.cloud.tpu.v2alpha1.GetNodeRequest, $root.google.cloud.tpu.v2alpha1.Node, request, callback); + }, "name", { value: "GetNode" }); + + /** + * Calls GetNode. + * @function getNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} request GetNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#createNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef CreateNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateNode. + * @function createNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} request CreateNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.CreateNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.createNode = function createNode(request, callback) { + return this.rpcCall(createNode, $root.google.cloud.tpu.v2alpha1.CreateNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateNode" }); + + /** + * Calls CreateNode. + * @function createNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} request CreateNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#deleteNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef DeleteNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteNode. + * @function deleteNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} request DeleteNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.DeleteNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.deleteNode = function deleteNode(request, callback) { + return this.rpcCall(deleteNode, $root.google.cloud.tpu.v2alpha1.DeleteNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteNode" }); + + /** + * Calls DeleteNode. + * @function deleteNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} request DeleteNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#stopNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef StopNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls StopNode. + * @function stopNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} request StopNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.StopNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.stopNode = function stopNode(request, callback) { + return this.rpcCall(stopNode, $root.google.cloud.tpu.v2alpha1.StopNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "StopNode" }); + + /** + * Calls StopNode. + * @function stopNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} request StopNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#startNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef StartNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls StartNode. + * @function startNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} request StartNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.StartNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.startNode = function startNode(request, callback) { + return this.rpcCall(startNode, $root.google.cloud.tpu.v2alpha1.StartNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "StartNode" }); + + /** + * Calls StartNode. + * @function startNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} request StartNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#updateNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef UpdateNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateNode. + * @function updateNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} request UpdateNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.UpdateNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.updateNode = function updateNode(request, callback) { + return this.rpcCall(updateNode, $root.google.cloud.tpu.v2alpha1.UpdateNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateNode" }); + + /** + * Calls UpdateNode. + * @function updateNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} request UpdateNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#generateServiceIdentity}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GenerateServiceIdentityCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} [response] GenerateServiceIdentityResponse + */ + + /** + * Calls GenerateServiceIdentity. + * @function generateServiceIdentity + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} request GenerateServiceIdentityRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentityCallback} callback Node-style callback called with the error, if any, and GenerateServiceIdentityResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.generateServiceIdentity = function generateServiceIdentity(request, callback) { + return this.rpcCall(generateServiceIdentity, $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest, $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse, request, callback); + }, "name", { value: "GenerateServiceIdentity" }); + + /** + * Calls GenerateServiceIdentity. + * @function generateServiceIdentity + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} request GenerateServiceIdentityRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#listAcceleratorTypes}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef ListAcceleratorTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} [response] ListAcceleratorTypesResponse + */ + + /** + * Calls ListAcceleratorTypes. + * @function listAcceleratorTypes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} request ListAcceleratorTypesRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypesCallback} callback Node-style callback called with the error, if any, and ListAcceleratorTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.listAcceleratorTypes = function listAcceleratorTypes(request, callback) { + return this.rpcCall(listAcceleratorTypes, $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest, $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse, request, callback); + }, "name", { value: "ListAcceleratorTypes" }); + + /** + * Calls ListAcceleratorTypes. + * @function listAcceleratorTypes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} request ListAcceleratorTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#getAcceleratorType}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GetAcceleratorTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.AcceleratorType} [response] AcceleratorType + */ + + /** + * Calls GetAcceleratorType. + * @function getAcceleratorType + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} request GetAcceleratorTypeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorTypeCallback} callback Node-style callback called with the error, if any, and AcceleratorType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.getAcceleratorType = function getAcceleratorType(request, callback) { + return this.rpcCall(getAcceleratorType, $root.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest, $root.google.cloud.tpu.v2alpha1.AcceleratorType, request, callback); + }, "name", { value: "GetAcceleratorType" }); + + /** + * Calls GetAcceleratorType. + * @function getAcceleratorType + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} request GetAcceleratorTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#listRuntimeVersions}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef ListRuntimeVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} [response] ListRuntimeVersionsResponse + */ + + /** + * Calls ListRuntimeVersions. + * @function listRuntimeVersions + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} request ListRuntimeVersionsRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersionsCallback} callback Node-style callback called with the error, if any, and ListRuntimeVersionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.listRuntimeVersions = function listRuntimeVersions(request, callback) { + return this.rpcCall(listRuntimeVersions, $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest, $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse, request, callback); + }, "name", { value: "ListRuntimeVersions" }); + + /** + * Calls ListRuntimeVersions. + * @function listRuntimeVersions + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} request ListRuntimeVersionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#getRuntimeVersion}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GetRuntimeVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.RuntimeVersion} [response] RuntimeVersion + */ + + /** + * Calls GetRuntimeVersion. + * @function getRuntimeVersion + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} request GetRuntimeVersionRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersionCallback} callback Node-style callback called with the error, if any, and RuntimeVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.getRuntimeVersion = function getRuntimeVersion(request, callback) { + return this.rpcCall(getRuntimeVersion, $root.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest, $root.google.cloud.tpu.v2alpha1.RuntimeVersion, request, callback); + }, "name", { value: "GetRuntimeVersion" }); + + /** + * Calls GetRuntimeVersion. + * @function getRuntimeVersion + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} request GetRuntimeVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu#getGuestAttributes}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GetGuestAttributesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} [response] GetGuestAttributesResponse + */ + + /** + * Calls GetGuestAttributes. + * @function getGuestAttributes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest} request GetGuestAttributesRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributesCallback} callback Node-style callback called with the error, if any, and GetGuestAttributesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.getGuestAttributes = function getGuestAttributes(request, callback) { + return this.rpcCall(getGuestAttributes, $root.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest, $root.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse, request, callback); + }, "name", { value: "GetGuestAttributes" }); + + /** + * Calls GetGuestAttributes. + * @function getGuestAttributes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest} request GetGuestAttributesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Tpu; + })(); + + v2alpha1.GuestAttributes = (function() { + + /** + * Properties of a GuestAttributes. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGuestAttributes + * @property {string|null} [queryPath] GuestAttributes queryPath + * @property {google.cloud.tpu.v2alpha1.IGuestAttributesValue|null} [queryValue] GuestAttributes queryValue + */ + + /** + * Constructs a new GuestAttributes. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GuestAttributes. + * @implements IGuestAttributes + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGuestAttributes=} [properties] Properties to set + */ + function GuestAttributes(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]]; + } + + /** + * GuestAttributes queryPath. + * @member {string} queryPath + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @instance + */ + GuestAttributes.prototype.queryPath = ""; + + /** + * GuestAttributes queryValue. + * @member {google.cloud.tpu.v2alpha1.IGuestAttributesValue|null|undefined} queryValue + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @instance + */ + GuestAttributes.prototype.queryValue = null; + + /** + * Creates a new GuestAttributes instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributes=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes instance + */ + GuestAttributes.create = function create(properties) { + return new GuestAttributes(properties); + }; + + /** + * Encodes the specified GuestAttributes message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributes} message GuestAttributes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributes.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryPath != null && Object.hasOwnProperty.call(message, "queryPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.queryPath); + if (message.queryValue != null && Object.hasOwnProperty.call(message, "queryValue")) + $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.encode(message.queryValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GuestAttributes message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributes} message GuestAttributes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributes.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GuestAttributes message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributes.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.cloud.tpu.v2alpha1.GuestAttributes(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.queryPath = reader.string(); + break; + case 2: + message.queryValue = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GuestAttributes message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributes.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GuestAttributes message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GuestAttributes.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryPath != null && message.hasOwnProperty("queryPath")) + if (!$util.isString(message.queryPath)) + return "queryPath: string expected"; + if (message.queryValue != null && message.hasOwnProperty("queryValue")) { + var error = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.verify(message.queryValue); + if (error) + return "queryValue." + error; + } + return null; + }; + + /** + * Creates a GuestAttributes message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes + */ + GuestAttributes.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GuestAttributes) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GuestAttributes(); + if (object.queryPath != null) + message.queryPath = String(object.queryPath); + if (object.queryValue != null) { + if (typeof object.queryValue !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.GuestAttributes.queryValue: object expected"); + message.queryValue = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.fromObject(object.queryValue); + } + return message; + }; + + /** + * Creates a plain object from a GuestAttributes message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {google.cloud.tpu.v2alpha1.GuestAttributes} message GuestAttributes + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GuestAttributes.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.queryPath = ""; + object.queryValue = null; + } + if (message.queryPath != null && message.hasOwnProperty("queryPath")) + object.queryPath = message.queryPath; + if (message.queryValue != null && message.hasOwnProperty("queryValue")) + object.queryValue = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.toObject(message.queryValue, options); + return object; + }; + + /** + * Converts this GuestAttributes to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @instance + * @returns {Object.} JSON object + */ + GuestAttributes.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GuestAttributes; + })(); + + v2alpha1.GuestAttributesValue = (function() { + + /** + * Properties of a GuestAttributesValue. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGuestAttributesValue + * @property {Array.|null} [items] GuestAttributesValue items + */ + + /** + * Constructs a new GuestAttributesValue. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GuestAttributesValue. + * @implements IGuestAttributesValue + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue=} [properties] Properties to set + */ + function GuestAttributesValue(properties) { + this.items = []; + 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]]; + } + + /** + * GuestAttributesValue items. + * @member {Array.} items + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @instance + */ + GuestAttributesValue.prototype.items = $util.emptyArray; + + /** + * Creates a new GuestAttributesValue instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue instance + */ + GuestAttributesValue.create = function create(properties) { + return new GuestAttributesValue(properties); + }; + + /** + * Encodes the specified GuestAttributesValue message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue} message GuestAttributesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributesValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GuestAttributesValue message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue} message GuestAttributesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributesValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GuestAttributesValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributesValue.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.cloud.tpu.v2alpha1.GuestAttributesValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GuestAttributesValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributesValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GuestAttributesValue message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GuestAttributesValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a GuestAttributesValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue + */ + GuestAttributesValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GuestAttributesValue) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GuestAttributesValue(); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.tpu.v2alpha1.GuestAttributesValue.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.GuestAttributesValue.items: object expected"); + message.items[i] = $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GuestAttributesValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {google.cloud.tpu.v2alpha1.GuestAttributesValue} message GuestAttributesValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GuestAttributesValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this GuestAttributesValue to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @instance + * @returns {Object.} JSON object + */ + GuestAttributesValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GuestAttributesValue; + })(); + + v2alpha1.GuestAttributesEntry = (function() { + + /** + * Properties of a GuestAttributesEntry. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGuestAttributesEntry + * @property {string|null} [namespace] GuestAttributesEntry namespace + * @property {string|null} [key] GuestAttributesEntry key + * @property {string|null} [value] GuestAttributesEntry value + */ + + /** + * Constructs a new GuestAttributesEntry. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GuestAttributesEntry. + * @implements IGuestAttributesEntry + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry=} [properties] Properties to set + */ + function GuestAttributesEntry(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]]; + } + + /** + * GuestAttributesEntry namespace. + * @member {string} namespace + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @instance + */ + GuestAttributesEntry.prototype.namespace = ""; + + /** + * GuestAttributesEntry key. + * @member {string} key + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @instance + */ + GuestAttributesEntry.prototype.key = ""; + + /** + * GuestAttributesEntry value. + * @member {string} value + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @instance + */ + GuestAttributesEntry.prototype.value = ""; + + /** + * Creates a new GuestAttributesEntry instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry instance + */ + GuestAttributesEntry.create = function create(properties) { + return new GuestAttributesEntry(properties); + }; + + /** + * Encodes the specified GuestAttributesEntry message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry} message GuestAttributesEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributesEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.namespace != null && Object.hasOwnProperty.call(message, "namespace")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namespace); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.value); + return writer; + }; + + /** + * Encodes the specified GuestAttributesEntry message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry} message GuestAttributesEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributesEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GuestAttributesEntry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributesEntry.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.cloud.tpu.v2alpha1.GuestAttributesEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namespace = reader.string(); + break; + case 2: + message.key = reader.string(); + break; + case 3: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GuestAttributesEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributesEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GuestAttributesEntry message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GuestAttributesEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.namespace != null && message.hasOwnProperty("namespace")) + if (!$util.isString(message.namespace)) + return "namespace: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a GuestAttributesEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry + */ + GuestAttributesEntry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry(); + if (object.namespace != null) + message.namespace = String(object.namespace); + if (object.key != null) + message.key = String(object.key); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a GuestAttributesEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {google.cloud.tpu.v2alpha1.GuestAttributesEntry} message GuestAttributesEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GuestAttributesEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namespace = ""; + object.key = ""; + object.value = ""; + } + if (message.namespace != null && message.hasOwnProperty("namespace")) + object.namespace = message.namespace; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this GuestAttributesEntry to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @instance + * @returns {Object.} JSON object + */ + GuestAttributesEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GuestAttributesEntry; + })(); + + v2alpha1.AttachedDisk = (function() { + + /** + * Properties of an AttachedDisk. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IAttachedDisk + * @property {string|null} [sourceDisk] AttachedDisk sourceDisk + * @property {google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|null} [mode] AttachedDisk mode + */ + + /** + * Constructs a new AttachedDisk. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an AttachedDisk. + * @implements IAttachedDisk + * @constructor + * @param {google.cloud.tpu.v2alpha1.IAttachedDisk=} [properties] Properties to set + */ + function AttachedDisk(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]]; + } + + /** + * AttachedDisk sourceDisk. + * @member {string} sourceDisk + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @instance + */ + AttachedDisk.prototype.sourceDisk = ""; + + /** + * AttachedDisk mode. + * @member {google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode} mode + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @instance + */ + AttachedDisk.prototype.mode = 0; + + /** + * Creates a new AttachedDisk instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {google.cloud.tpu.v2alpha1.IAttachedDisk=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk instance + */ + AttachedDisk.create = function create(properties) { + return new AttachedDisk(properties); + }; + + /** + * Encodes the specified AttachedDisk message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {google.cloud.tpu.v2alpha1.IAttachedDisk} message AttachedDisk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AttachedDisk.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sourceDisk != null && Object.hasOwnProperty.call(message, "sourceDisk")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sourceDisk); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified AttachedDisk message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {google.cloud.tpu.v2alpha1.IAttachedDisk} message AttachedDisk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AttachedDisk.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AttachedDisk message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AttachedDisk.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.cloud.tpu.v2alpha1.AttachedDisk(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.sourceDisk = reader.string(); + break; + case 4: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AttachedDisk message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AttachedDisk.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AttachedDisk message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AttachedDisk.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sourceDisk != null && message.hasOwnProperty("sourceDisk")) + if (!$util.isString(message.sourceDisk)) + return "sourceDisk: string expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an AttachedDisk message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk + */ + AttachedDisk.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.AttachedDisk) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.AttachedDisk(); + if (object.sourceDisk != null) + message.sourceDisk = String(object.sourceDisk); + switch (object.mode) { + case "DISK_MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "READ_WRITE": + case 1: + message.mode = 1; + break; + case "READ_ONLY": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an AttachedDisk message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {google.cloud.tpu.v2alpha1.AttachedDisk} message AttachedDisk + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AttachedDisk.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sourceDisk = ""; + object.mode = options.enums === String ? "DISK_MODE_UNSPECIFIED" : 0; + } + if (message.sourceDisk != null && message.hasOwnProperty("sourceDisk")) + object.sourceDisk = message.sourceDisk; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this AttachedDisk to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @instance + * @returns {Object.} JSON object + */ + AttachedDisk.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * DiskMode enum. + * @name google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode + * @enum {number} + * @property {number} DISK_MODE_UNSPECIFIED=0 DISK_MODE_UNSPECIFIED value + * @property {number} READ_WRITE=1 READ_WRITE value + * @property {number} READ_ONLY=2 READ_ONLY value + */ + AttachedDisk.DiskMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DISK_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "READ_WRITE"] = 1; + values[valuesById[2] = "READ_ONLY"] = 2; + return values; + })(); + + return AttachedDisk; + })(); + + v2alpha1.SchedulingConfig = (function() { + + /** + * Properties of a SchedulingConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @interface ISchedulingConfig + * @property {boolean|null} [preemptible] SchedulingConfig preemptible + * @property {boolean|null} [reserved] SchedulingConfig reserved + */ + + /** + * Constructs a new SchedulingConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a SchedulingConfig. + * @implements ISchedulingConfig + * @constructor + * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig=} [properties] Properties to set + */ + function SchedulingConfig(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]]; + } + + /** + * SchedulingConfig preemptible. + * @member {boolean} preemptible + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @instance + */ + SchedulingConfig.prototype.preemptible = false; + + /** + * SchedulingConfig reserved. + * @member {boolean} reserved + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @instance + */ + SchedulingConfig.prototype.reserved = false; + + /** + * Creates a new SchedulingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig instance + */ + SchedulingConfig.create = function create(properties) { + return new SchedulingConfig(properties); + }; + + /** + * Encodes the specified SchedulingConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig} message SchedulingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SchedulingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.preemptible != null && Object.hasOwnProperty.call(message, "preemptible")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.preemptible); + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.reserved); + return writer; + }; + + /** + * Encodes the specified SchedulingConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig} message SchedulingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SchedulingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SchedulingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SchedulingConfig.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.cloud.tpu.v2alpha1.SchedulingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.preemptible = reader.bool(); + break; + case 2: + message.reserved = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SchedulingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SchedulingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SchedulingConfig message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SchedulingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.preemptible != null && message.hasOwnProperty("preemptible")) + if (typeof message.preemptible !== "boolean") + return "preemptible: boolean expected"; + if (message.reserved != null && message.hasOwnProperty("reserved")) + if (typeof message.reserved !== "boolean") + return "reserved: boolean expected"; + return null; + }; + + /** + * Creates a SchedulingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig + */ + SchedulingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.SchedulingConfig) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.SchedulingConfig(); + if (object.preemptible != null) + message.preemptible = Boolean(object.preemptible); + if (object.reserved != null) + message.reserved = Boolean(object.reserved); + return message; + }; + + /** + * Creates a plain object from a SchedulingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {google.cloud.tpu.v2alpha1.SchedulingConfig} message SchedulingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SchedulingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.preemptible = false; + object.reserved = false; + } + if (message.preemptible != null && message.hasOwnProperty("preemptible")) + object.preemptible = message.preemptible; + if (message.reserved != null && message.hasOwnProperty("reserved")) + object.reserved = message.reserved; + return object; + }; + + /** + * Converts this SchedulingConfig to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @instance + * @returns {Object.} JSON object + */ + SchedulingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SchedulingConfig; + })(); + + v2alpha1.NetworkEndpoint = (function() { + + /** + * Properties of a NetworkEndpoint. + * @memberof google.cloud.tpu.v2alpha1 + * @interface INetworkEndpoint + * @property {string|null} [ipAddress] NetworkEndpoint ipAddress + * @property {number|null} [port] NetworkEndpoint port + * @property {google.cloud.tpu.v2alpha1.IAccessConfig|null} [accessConfig] NetworkEndpoint accessConfig + */ + + /** + * Constructs a new NetworkEndpoint. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a NetworkEndpoint. + * @implements INetworkEndpoint + * @constructor + * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint=} [properties] Properties to set + */ + function NetworkEndpoint(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]]; + } + + /** + * NetworkEndpoint ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @instance + */ + NetworkEndpoint.prototype.ipAddress = ""; + + /** + * NetworkEndpoint port. + * @member {number} port + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @instance + */ + NetworkEndpoint.prototype.port = 0; + + /** + * NetworkEndpoint accessConfig. + * @member {google.cloud.tpu.v2alpha1.IAccessConfig|null|undefined} accessConfig + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @instance + */ + NetworkEndpoint.prototype.accessConfig = null; + + /** + * Creates a new NetworkEndpoint instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint instance + */ + NetworkEndpoint.create = function create(properties) { + return new NetworkEndpoint(properties); + }; + + /** + * Encodes the specified NetworkEndpoint message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint} message NetworkEndpoint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetworkEndpoint.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ipAddress); + if (message.port != null && Object.hasOwnProperty.call(message, "port")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.port); + if (message.accessConfig != null && Object.hasOwnProperty.call(message, "accessConfig")) + $root.google.cloud.tpu.v2alpha1.AccessConfig.encode(message.accessConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NetworkEndpoint message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint} message NetworkEndpoint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetworkEndpoint.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NetworkEndpoint message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetworkEndpoint.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.cloud.tpu.v2alpha1.NetworkEndpoint(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ipAddress = reader.string(); + break; + case 2: + message.port = reader.int32(); + break; + case 5: + message.accessConfig = $root.google.cloud.tpu.v2alpha1.AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NetworkEndpoint message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetworkEndpoint.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NetworkEndpoint message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NetworkEndpoint.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.port != null && message.hasOwnProperty("port")) + if (!$util.isInteger(message.port)) + return "port: integer expected"; + if (message.accessConfig != null && message.hasOwnProperty("accessConfig")) { + var error = $root.google.cloud.tpu.v2alpha1.AccessConfig.verify(message.accessConfig); + if (error) + return "accessConfig." + error; + } + return null; + }; + + /** + * Creates a NetworkEndpoint message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint + */ + NetworkEndpoint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.NetworkEndpoint) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.NetworkEndpoint(); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.port != null) + message.port = object.port | 0; + if (object.accessConfig != null) { + if (typeof object.accessConfig !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.NetworkEndpoint.accessConfig: object expected"); + message.accessConfig = $root.google.cloud.tpu.v2alpha1.AccessConfig.fromObject(object.accessConfig); + } + return message; + }; + + /** + * Creates a plain object from a NetworkEndpoint message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {google.cloud.tpu.v2alpha1.NetworkEndpoint} message NetworkEndpoint + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NetworkEndpoint.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ipAddress = ""; + object.port = 0; + object.accessConfig = null; + } + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.port != null && message.hasOwnProperty("port")) + object.port = message.port; + if (message.accessConfig != null && message.hasOwnProperty("accessConfig")) + object.accessConfig = $root.google.cloud.tpu.v2alpha1.AccessConfig.toObject(message.accessConfig, options); + return object; + }; + + /** + * Converts this NetworkEndpoint to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @instance + * @returns {Object.} JSON object + */ + NetworkEndpoint.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NetworkEndpoint; + })(); + + v2alpha1.AccessConfig = (function() { + + /** + * Properties of an AccessConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IAccessConfig + * @property {string|null} [externalIp] AccessConfig externalIp + */ + + /** + * Constructs a new AccessConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an AccessConfig. + * @implements IAccessConfig + * @constructor + * @param {google.cloud.tpu.v2alpha1.IAccessConfig=} [properties] Properties to set + */ + function AccessConfig(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]]; + } + + /** + * AccessConfig externalIp. + * @member {string} externalIp + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @instance + */ + AccessConfig.prototype.externalIp = ""; + + /** + * Creates a new AccessConfig instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {google.cloud.tpu.v2alpha1.IAccessConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig instance + */ + AccessConfig.create = function create(properties) { + return new AccessConfig(properties); + }; + + /** + * Encodes the specified AccessConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {google.cloud.tpu.v2alpha1.IAccessConfig} message AccessConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccessConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.externalIp != null && Object.hasOwnProperty.call(message, "externalIp")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.externalIp); + return writer; + }; + + /** + * Encodes the specified AccessConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {google.cloud.tpu.v2alpha1.IAccessConfig} message AccessConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccessConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AccessConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccessConfig.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.cloud.tpu.v2alpha1.AccessConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.externalIp = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AccessConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccessConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AccessConfig message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AccessConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.externalIp != null && message.hasOwnProperty("externalIp")) + if (!$util.isString(message.externalIp)) + return "externalIp: string expected"; + return null; + }; + + /** + * Creates an AccessConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig + */ + AccessConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.AccessConfig) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.AccessConfig(); + if (object.externalIp != null) + message.externalIp = String(object.externalIp); + return message; + }; + + /** + * Creates a plain object from an AccessConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {google.cloud.tpu.v2alpha1.AccessConfig} message AccessConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AccessConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.externalIp = ""; + if (message.externalIp != null && message.hasOwnProperty("externalIp")) + object.externalIp = message.externalIp; + return object; + }; + + /** + * Converts this AccessConfig to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @instance + * @returns {Object.} JSON object + */ + AccessConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AccessConfig; + })(); + + v2alpha1.NetworkConfig = (function() { + + /** + * Properties of a NetworkConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @interface INetworkConfig + * @property {string|null} [network] NetworkConfig network + * @property {string|null} [subnetwork] NetworkConfig subnetwork + * @property {boolean|null} [enableExternalIps] NetworkConfig enableExternalIps + */ + + /** + * Constructs a new NetworkConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a NetworkConfig. + * @implements INetworkConfig + * @constructor + * @param {google.cloud.tpu.v2alpha1.INetworkConfig=} [properties] Properties to set + */ + function NetworkConfig(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]]; + } + + /** + * NetworkConfig network. + * @member {string} network + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + */ + NetworkConfig.prototype.network = ""; + + /** + * NetworkConfig subnetwork. + * @member {string} subnetwork + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + */ + NetworkConfig.prototype.subnetwork = ""; + + /** + * NetworkConfig enableExternalIps. + * @member {boolean} enableExternalIps + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + */ + NetworkConfig.prototype.enableExternalIps = false; + + /** + * Creates a new NetworkConfig instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig instance + */ + NetworkConfig.create = function create(properties) { + return new NetworkConfig(properties); + }; + + /** + * Encodes the specified NetworkConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkConfig} message NetworkConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetworkConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.network != null && Object.hasOwnProperty.call(message, "network")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.network); + if (message.subnetwork != null && Object.hasOwnProperty.call(message, "subnetwork")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subnetwork); + if (message.enableExternalIps != null && Object.hasOwnProperty.call(message, "enableExternalIps")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableExternalIps); + return writer; + }; + + /** + * Encodes the specified NetworkConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkConfig} message NetworkConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetworkConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NetworkConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetworkConfig.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.cloud.tpu.v2alpha1.NetworkConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.network = reader.string(); + break; + case 2: + message.subnetwork = reader.string(); + break; + case 3: + message.enableExternalIps = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NetworkConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetworkConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NetworkConfig message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NetworkConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.network != null && message.hasOwnProperty("network")) + if (!$util.isString(message.network)) + return "network: string expected"; + if (message.subnetwork != null && message.hasOwnProperty("subnetwork")) + if (!$util.isString(message.subnetwork)) + return "subnetwork: string expected"; + if (message.enableExternalIps != null && message.hasOwnProperty("enableExternalIps")) + if (typeof message.enableExternalIps !== "boolean") + return "enableExternalIps: boolean expected"; + return null; + }; + + /** + * Creates a NetworkConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig + */ + NetworkConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.NetworkConfig) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.NetworkConfig(); + if (object.network != null) + message.network = String(object.network); + if (object.subnetwork != null) + message.subnetwork = String(object.subnetwork); + if (object.enableExternalIps != null) + message.enableExternalIps = Boolean(object.enableExternalIps); + return message; + }; + + /** + * Creates a plain object from a NetworkConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {google.cloud.tpu.v2alpha1.NetworkConfig} message NetworkConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NetworkConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.network = ""; + object.subnetwork = ""; + object.enableExternalIps = false; + } + if (message.network != null && message.hasOwnProperty("network")) + object.network = message.network; + if (message.subnetwork != null && message.hasOwnProperty("subnetwork")) + object.subnetwork = message.subnetwork; + if (message.enableExternalIps != null && message.hasOwnProperty("enableExternalIps")) + object.enableExternalIps = message.enableExternalIps; + return object; + }; + + /** + * Converts this NetworkConfig to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + * @returns {Object.} JSON object + */ + NetworkConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NetworkConfig; + })(); + + v2alpha1.ServiceAccount = (function() { + + /** + * Properties of a ServiceAccount. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IServiceAccount + * @property {string|null} [email] ServiceAccount email + * @property {Array.|null} [scope] ServiceAccount scope + */ + + /** + * Constructs a new ServiceAccount. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ServiceAccount. + * @implements IServiceAccount + * @constructor + * @param {google.cloud.tpu.v2alpha1.IServiceAccount=} [properties] Properties to set + */ + function ServiceAccount(properties) { + this.scope = []; + 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]]; + } + + /** + * ServiceAccount email. + * @member {string} email + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @instance + */ + ServiceAccount.prototype.email = ""; + + /** + * ServiceAccount scope. + * @member {Array.} scope + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @instance + */ + ServiceAccount.prototype.scope = $util.emptyArray; + + /** + * Creates a new ServiceAccount instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceAccount=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount instance + */ + ServiceAccount.create = function create(properties) { + return new ServiceAccount(properties); + }; + + /** + * Encodes the specified ServiceAccount message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceAccount} message ServiceAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.email != null && Object.hasOwnProperty.call(message, "email")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.email); + if (message.scope != null && message.scope.length) + for (var i = 0; i < message.scope.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.scope[i]); + return writer; + }; + + /** + * Encodes the specified ServiceAccount message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceAccount} message ServiceAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceAccount message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceAccount.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.cloud.tpu.v2alpha1.ServiceAccount(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.email = reader.string(); + break; + case 2: + if (!(message.scope && message.scope.length)) + message.scope = []; + message.scope.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceAccount message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceAccount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.email != null && message.hasOwnProperty("email")) + if (!$util.isString(message.email)) + return "email: string expected"; + if (message.scope != null && message.hasOwnProperty("scope")) { + if (!Array.isArray(message.scope)) + return "scope: array expected"; + for (var i = 0; i < message.scope.length; ++i) + if (!$util.isString(message.scope[i])) + return "scope: string[] expected"; + } + return null; + }; + + /** + * Creates a ServiceAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount + */ + ServiceAccount.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ServiceAccount) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ServiceAccount(); + if (object.email != null) + message.email = String(object.email); + if (object.scope) { + if (!Array.isArray(object.scope)) + throw TypeError(".google.cloud.tpu.v2alpha1.ServiceAccount.scope: array expected"); + message.scope = []; + for (var i = 0; i < object.scope.length; ++i) + message.scope[i] = String(object.scope[i]); + } + return message; + }; + + /** + * Creates a plain object from a ServiceAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {google.cloud.tpu.v2alpha1.ServiceAccount} message ServiceAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.scope = []; + if (options.defaults) + object.email = ""; + if (message.email != null && message.hasOwnProperty("email")) + object.email = message.email; + if (message.scope && message.scope.length) { + object.scope = []; + for (var j = 0; j < message.scope.length; ++j) + object.scope[j] = message.scope[j]; + } + return object; + }; + + /** + * Converts this ServiceAccount to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @instance + * @returns {Object.} JSON object + */ + ServiceAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceAccount; + })(); + + v2alpha1.Node = (function() { + + /** + * Properties of a Node. + * @memberof google.cloud.tpu.v2alpha1 + * @interface INode + * @property {string|null} [name] Node name + * @property {string|null} [description] Node description + * @property {string|null} [acceleratorType] Node acceleratorType + * @property {google.cloud.tpu.v2alpha1.Node.State|null} [state] Node state + * @property {string|null} [healthDescription] Node healthDescription + * @property {string|null} [runtimeVersion] Node runtimeVersion + * @property {google.cloud.tpu.v2alpha1.INetworkConfig|null} [networkConfig] Node networkConfig + * @property {string|null} [cidrBlock] Node cidrBlock + * @property {google.cloud.tpu.v2alpha1.IServiceAccount|null} [serviceAccount] Node serviceAccount + * @property {google.protobuf.ITimestamp|null} [createTime] Node createTime + * @property {google.cloud.tpu.v2alpha1.ISchedulingConfig|null} [schedulingConfig] Node schedulingConfig + * @property {Array.|null} [networkEndpoints] Node networkEndpoints + * @property {google.cloud.tpu.v2alpha1.Node.Health|null} [health] Node health + * @property {Object.|null} [labels] Node labels + * @property {Object.|null} [metadata] Node metadata + * @property {Array.|null} [tags] Node tags + * @property {number|Long|null} [id] Node id + * @property {Array.|null} [dataDisks] Node dataDisks + * @property {google.cloud.tpu.v2alpha1.Node.ApiVersion|null} [apiVersion] Node apiVersion + * @property {Array.|null} [symptoms] Node symptoms + */ + + /** + * Constructs a new Node. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a Node. + * @implements INode + * @constructor + * @param {google.cloud.tpu.v2alpha1.INode=} [properties] Properties to set + */ + function Node(properties) { + this.networkEndpoints = []; + this.labels = {}; + this.metadata = {}; + this.tags = []; + this.dataDisks = []; + this.symptoms = []; + 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]]; + } + + /** + * Node name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.name = ""; + + /** + * Node description. + * @member {string} description + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.description = ""; + + /** + * Node acceleratorType. + * @member {string} acceleratorType + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.acceleratorType = ""; + + /** + * Node state. + * @member {google.cloud.tpu.v2alpha1.Node.State} state + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.state = 0; + + /** + * Node healthDescription. + * @member {string} healthDescription + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.healthDescription = ""; + + /** + * Node runtimeVersion. + * @member {string} runtimeVersion + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.runtimeVersion = ""; + + /** + * Node networkConfig. + * @member {google.cloud.tpu.v2alpha1.INetworkConfig|null|undefined} networkConfig + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.networkConfig = null; + + /** + * Node cidrBlock. + * @member {string} cidrBlock + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.cidrBlock = ""; + + /** + * Node serviceAccount. + * @member {google.cloud.tpu.v2alpha1.IServiceAccount|null|undefined} serviceAccount + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.serviceAccount = null; + + /** + * Node createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.createTime = null; + + /** + * Node schedulingConfig. + * @member {google.cloud.tpu.v2alpha1.ISchedulingConfig|null|undefined} schedulingConfig + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.schedulingConfig = null; + + /** + * Node networkEndpoints. + * @member {Array.} networkEndpoints + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.networkEndpoints = $util.emptyArray; + + /** + * Node health. + * @member {google.cloud.tpu.v2alpha1.Node.Health} health + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.health = 0; + + /** + * Node labels. + * @member {Object.} labels + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.labels = $util.emptyObject; + + /** + * Node metadata. + * @member {Object.} metadata + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.metadata = $util.emptyObject; + + /** + * Node tags. + * @member {Array.} tags + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.tags = $util.emptyArray; + + /** + * Node id. + * @member {number|Long} id + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Node dataDisks. + * @member {Array.} dataDisks + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.dataDisks = $util.emptyArray; + + /** + * Node apiVersion. + * @member {google.cloud.tpu.v2alpha1.Node.ApiVersion} apiVersion + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.apiVersion = 0; + + /** + * Node symptoms. + * @member {Array.} symptoms + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.symptoms = $util.emptyArray; + + /** + * Creates a new Node instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {google.cloud.tpu.v2alpha1.INode=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.Node} Node instance + */ + Node.create = function create(properties) { + return new Node(properties); + }; + + /** + * Encodes the specified Node message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {google.cloud.tpu.v2alpha1.INode} message Node message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Node.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.acceleratorType != null && Object.hasOwnProperty.call(message, "acceleratorType")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.acceleratorType); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); + if (message.healthDescription != null && Object.hasOwnProperty.call(message, "healthDescription")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.healthDescription); + if (message.runtimeVersion != null && Object.hasOwnProperty.call(message, "runtimeVersion")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.runtimeVersion); + if (message.cidrBlock != null && Object.hasOwnProperty.call(message, "cidrBlock")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.cidrBlock); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.schedulingConfig != null && Object.hasOwnProperty.call(message, "schedulingConfig")) + $root.google.cloud.tpu.v2alpha1.SchedulingConfig.encode(message.schedulingConfig, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.networkEndpoints != null && message.networkEndpoints.length) + for (var i = 0; i < message.networkEndpoints.length; ++i) + $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.encode(message.networkEndpoints[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.health != null && Object.hasOwnProperty.call(message, "health")) + writer.uint32(/* id 22, wireType 0 =*/176).int32(message.health); + 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 24, wireType 2 =*/194).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 33, wireType 0 =*/264).int64(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 34, wireType 2 =*/274).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.networkConfig != null && Object.hasOwnProperty.call(message, "networkConfig")) + $root.google.cloud.tpu.v2alpha1.NetworkConfig.encode(message.networkConfig, writer.uint32(/* id 36, wireType 2 =*/290).fork()).ldelim(); + if (message.serviceAccount != null && Object.hasOwnProperty.call(message, "serviceAccount")) + $root.google.cloud.tpu.v2alpha1.ServiceAccount.encode(message.serviceAccount, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 38, wireType 0 =*/304).int32(message.apiVersion); + if (message.symptoms != null && message.symptoms.length) + for (var i = 0; i < message.symptoms.length; ++i) + $root.google.cloud.tpu.v2alpha1.Symptom.encode(message.symptoms[i], writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.tags[i]); + if (message.dataDisks != null && message.dataDisks.length) + for (var i = 0; i < message.dataDisks.length; ++i) + $root.google.cloud.tpu.v2alpha1.AttachedDisk.encode(message.dataDisks[i], writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Node message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {google.cloud.tpu.v2alpha1.INode} message Node message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Node.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Node message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.Node} Node + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Node.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.cloud.tpu.v2alpha1.Node(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 5: + message.acceleratorType = reader.string(); + break; + case 9: + message.state = reader.int32(); + break; + case 10: + message.healthDescription = reader.string(); + break; + case 11: + message.runtimeVersion = reader.string(); + break; + case 36: + message.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.decode(reader, reader.uint32()); + break; + case 13: + message.cidrBlock = reader.string(); + break; + case 37: + message.serviceAccount = $root.google.cloud.tpu.v2alpha1.ServiceAccount.decode(reader, reader.uint32()); + break; + case 16: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 17: + message.schedulingConfig = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.decode(reader, reader.uint32()); + break; + case 21: + if (!(message.networkEndpoints && message.networkEndpoints.length)) + message.networkEndpoints = []; + message.networkEndpoints.push($root.google.cloud.tpu.v2alpha1.NetworkEndpoint.decode(reader, reader.uint32())); + break; + case 22: + message.health = reader.int32(); + break; + case 24: + 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 34: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + 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.metadata[key] = value; + break; + case 40: + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + case 33: + message.id = reader.int64(); + break; + case 41: + if (!(message.dataDisks && message.dataDisks.length)) + message.dataDisks = []; + message.dataDisks.push($root.google.cloud.tpu.v2alpha1.AttachedDisk.decode(reader, reader.uint32())); + break; + case 38: + message.apiVersion = reader.int32(); + break; + case 39: + if (!(message.symptoms && message.symptoms.length)) + message.symptoms = []; + message.symptoms.push($root.google.cloud.tpu.v2alpha1.Symptom.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Node message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.Node} Node + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Node.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Node message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Node.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.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.acceleratorType != null && message.hasOwnProperty("acceleratorType")) + if (!$util.isString(message.acceleratorType)) + return "acceleratorType: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + break; + } + if (message.healthDescription != null && message.hasOwnProperty("healthDescription")) + if (!$util.isString(message.healthDescription)) + return "healthDescription: string expected"; + if (message.runtimeVersion != null && message.hasOwnProperty("runtimeVersion")) + if (!$util.isString(message.runtimeVersion)) + return "runtimeVersion: string expected"; + if (message.networkConfig != null && message.hasOwnProperty("networkConfig")) { + var error = $root.google.cloud.tpu.v2alpha1.NetworkConfig.verify(message.networkConfig); + if (error) + return "networkConfig." + error; + } + if (message.cidrBlock != null && message.hasOwnProperty("cidrBlock")) + if (!$util.isString(message.cidrBlock)) + return "cidrBlock: string expected"; + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) { + var error = $root.google.cloud.tpu.v2alpha1.ServiceAccount.verify(message.serviceAccount); + if (error) + return "serviceAccount." + error; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.schedulingConfig != null && message.hasOwnProperty("schedulingConfig")) { + var error = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.verify(message.schedulingConfig); + if (error) + return "schedulingConfig." + error; + } + if (message.networkEndpoints != null && message.hasOwnProperty("networkEndpoints")) { + if (!Array.isArray(message.networkEndpoints)) + return "networkEndpoints: array expected"; + for (var i = 0; i < message.networkEndpoints.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.verify(message.networkEndpoints[i]); + if (error) + return "networkEndpoints." + error; + } + } + if (message.health != null && message.hasOwnProperty("health")) + switch (message.health) { + default: + return "health: enum value expected"; + case 0: + case 1: + case 3: + case 4: + case 5: + 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.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.dataDisks != null && message.hasOwnProperty("dataDisks")) { + if (!Array.isArray(message.dataDisks)) + return "dataDisks: array expected"; + for (var i = 0; i < message.dataDisks.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.AttachedDisk.verify(message.dataDisks[i]); + if (error) + return "dataDisks." + error; + } + } + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + switch (message.apiVersion) { + default: + return "apiVersion: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.symptoms != null && message.hasOwnProperty("symptoms")) { + if (!Array.isArray(message.symptoms)) + return "symptoms: array expected"; + for (var i = 0; i < message.symptoms.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.Symptom.verify(message.symptoms[i]); + if (error) + return "symptoms." + error; + } + } + return null; + }; + + /** + * Creates a Node message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.Node} Node + */ + Node.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.Node) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.Node(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.acceleratorType != null) + message.acceleratorType = String(object.acceleratorType); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATING": + case 1: + message.state = 1; + break; + case "READY": + case 2: + message.state = 2; + break; + case "RESTARTING": + case 3: + message.state = 3; + break; + case "REIMAGING": + case 4: + message.state = 4; + break; + case "DELETING": + case 5: + message.state = 5; + break; + case "REPAIRING": + case 6: + message.state = 6; + break; + case "STOPPED": + case 8: + message.state = 8; + break; + case "STOPPING": + case 9: + message.state = 9; + break; + case "STARTING": + case 10: + message.state = 10; + break; + case "PREEMPTED": + case 11: + message.state = 11; + break; + case "TERMINATED": + case 12: + message.state = 12; + break; + case "HIDING": + case 13: + message.state = 13; + break; + case "HIDDEN": + case 14: + message.state = 14; + break; + case "UNHIDING": + case 15: + message.state = 15; + break; + } + if (object.healthDescription != null) + message.healthDescription = String(object.healthDescription); + if (object.runtimeVersion != null) + message.runtimeVersion = String(object.runtimeVersion); + if (object.networkConfig != null) { + if (typeof object.networkConfig !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkConfig: object expected"); + message.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.fromObject(object.networkConfig); + } + if (object.cidrBlock != null) + message.cidrBlock = String(object.cidrBlock); + if (object.serviceAccount != null) { + if (typeof object.serviceAccount !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.serviceAccount: object expected"); + message.serviceAccount = $root.google.cloud.tpu.v2alpha1.ServiceAccount.fromObject(object.serviceAccount); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.schedulingConfig != null) { + if (typeof object.schedulingConfig !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.schedulingConfig: object expected"); + message.schedulingConfig = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.fromObject(object.schedulingConfig); + } + if (object.networkEndpoints) { + if (!Array.isArray(object.networkEndpoints)) + throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkEndpoints: array expected"); + message.networkEndpoints = []; + for (var i = 0; i < object.networkEndpoints.length; ++i) { + if (typeof object.networkEndpoints[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkEndpoints: object expected"); + message.networkEndpoints[i] = $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.fromObject(object.networkEndpoints[i]); + } + } + switch (object.health) { + case "HEALTH_UNSPECIFIED": + case 0: + message.health = 0; + break; + case "HEALTHY": + case 1: + message.health = 1; + break; + case "TIMEOUT": + case 3: + message.health = 3; + break; + case "UNHEALTHY_TENSORFLOW": + case 4: + message.health = 4; + break; + case "UNHEALTHY_MAINTENANCE": + case 5: + message.health = 5; + break; + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.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.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.tpu.v2alpha1.Node.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = false; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); + if (object.dataDisks) { + if (!Array.isArray(object.dataDisks)) + throw TypeError(".google.cloud.tpu.v2alpha1.Node.dataDisks: array expected"); + message.dataDisks = []; + for (var i = 0; i < object.dataDisks.length; ++i) { + if (typeof object.dataDisks[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.dataDisks: object expected"); + message.dataDisks[i] = $root.google.cloud.tpu.v2alpha1.AttachedDisk.fromObject(object.dataDisks[i]); + } + } + switch (object.apiVersion) { + case "API_VERSION_UNSPECIFIED": + case 0: + message.apiVersion = 0; + break; + case "V1_ALPHA1": + case 1: + message.apiVersion = 1; + break; + case "V1": + case 2: + message.apiVersion = 2; + break; + case "V2_ALPHA1": + case 3: + message.apiVersion = 3; + break; + } + if (object.symptoms) { + if (!Array.isArray(object.symptoms)) + throw TypeError(".google.cloud.tpu.v2alpha1.Node.symptoms: array expected"); + message.symptoms = []; + for (var i = 0; i < object.symptoms.length; ++i) { + if (typeof object.symptoms[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.symptoms: object expected"); + message.symptoms[i] = $root.google.cloud.tpu.v2alpha1.Symptom.fromObject(object.symptoms[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Node message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {google.cloud.tpu.v2alpha1.Node} message Node + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Node.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.networkEndpoints = []; + object.symptoms = []; + object.tags = []; + object.dataDisks = []; + } + if (options.objects || options.defaults) { + object.labels = {}; + object.metadata = {}; + } + if (options.defaults) { + object.name = ""; + object.description = ""; + object.acceleratorType = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.healthDescription = ""; + object.runtimeVersion = ""; + object.cidrBlock = ""; + object.createTime = null; + object.schedulingConfig = null; + object.health = options.enums === String ? "HEALTH_UNSPECIFIED" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + object.networkConfig = null; + object.serviceAccount = null; + object.apiVersion = options.enums === String ? "API_VERSION_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.acceleratorType != null && message.hasOwnProperty("acceleratorType")) + object.acceleratorType = message.acceleratorType; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Node.State[message.state] : message.state; + if (message.healthDescription != null && message.hasOwnProperty("healthDescription")) + object.healthDescription = message.healthDescription; + if (message.runtimeVersion != null && message.hasOwnProperty("runtimeVersion")) + object.runtimeVersion = message.runtimeVersion; + if (message.cidrBlock != null && message.hasOwnProperty("cidrBlock")) + object.cidrBlock = message.cidrBlock; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.schedulingConfig != null && message.hasOwnProperty("schedulingConfig")) + object.schedulingConfig = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.toObject(message.schedulingConfig, options); + if (message.networkEndpoints && message.networkEndpoints.length) { + object.networkEndpoints = []; + for (var j = 0; j < message.networkEndpoints.length; ++j) + object.networkEndpoints[j] = $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.toObject(message.networkEndpoints[j], options); + } + if (message.health != null && message.hasOwnProperty("health")) + object.health = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Node.Health[message.health] : message.health; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.networkConfig != null && message.hasOwnProperty("networkConfig")) + object.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.toObject(message.networkConfig, options); + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) + object.serviceAccount = $root.google.cloud.tpu.v2alpha1.ServiceAccount.toObject(message.serviceAccount, options); + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Node.ApiVersion[message.apiVersion] : message.apiVersion; + if (message.symptoms && message.symptoms.length) { + object.symptoms = []; + for (var j = 0; j < message.symptoms.length; ++j) + object.symptoms[j] = $root.google.cloud.tpu.v2alpha1.Symptom.toObject(message.symptoms[j], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.dataDisks && message.dataDisks.length) { + object.dataDisks = []; + for (var j = 0; j < message.dataDisks.length; ++j) + object.dataDisks[j] = $root.google.cloud.tpu.v2alpha1.AttachedDisk.toObject(message.dataDisks[j], options); + } + return object; + }; + + /** + * Converts this Node to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + * @returns {Object.} JSON object + */ + Node.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.tpu.v2alpha1.Node.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} READY=2 READY value + * @property {number} RESTARTING=3 RESTARTING value + * @property {number} REIMAGING=4 REIMAGING value + * @property {number} DELETING=5 DELETING value + * @property {number} REPAIRING=6 REPAIRING value + * @property {number} STOPPED=8 STOPPED value + * @property {number} STOPPING=9 STOPPING value + * @property {number} STARTING=10 STARTING value + * @property {number} PREEMPTED=11 PREEMPTED value + * @property {number} TERMINATED=12 TERMINATED value + * @property {number} HIDING=13 HIDING value + * @property {number} HIDDEN=14 HIDDEN value + * @property {number} UNHIDING=15 UNHIDING value + */ + Node.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "READY"] = 2; + values[valuesById[3] = "RESTARTING"] = 3; + values[valuesById[4] = "REIMAGING"] = 4; + values[valuesById[5] = "DELETING"] = 5; + values[valuesById[6] = "REPAIRING"] = 6; + values[valuesById[8] = "STOPPED"] = 8; + values[valuesById[9] = "STOPPING"] = 9; + values[valuesById[10] = "STARTING"] = 10; + values[valuesById[11] = "PREEMPTED"] = 11; + values[valuesById[12] = "TERMINATED"] = 12; + values[valuesById[13] = "HIDING"] = 13; + values[valuesById[14] = "HIDDEN"] = 14; + values[valuesById[15] = "UNHIDING"] = 15; + return values; + })(); + + /** + * Health enum. + * @name google.cloud.tpu.v2alpha1.Node.Health + * @enum {number} + * @property {number} HEALTH_UNSPECIFIED=0 HEALTH_UNSPECIFIED value + * @property {number} HEALTHY=1 HEALTHY value + * @property {number} TIMEOUT=3 TIMEOUT value + * @property {number} UNHEALTHY_TENSORFLOW=4 UNHEALTHY_TENSORFLOW value + * @property {number} UNHEALTHY_MAINTENANCE=5 UNHEALTHY_MAINTENANCE value + */ + Node.Health = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HEALTH_UNSPECIFIED"] = 0; + values[valuesById[1] = "HEALTHY"] = 1; + values[valuesById[3] = "TIMEOUT"] = 3; + values[valuesById[4] = "UNHEALTHY_TENSORFLOW"] = 4; + values[valuesById[5] = "UNHEALTHY_MAINTENANCE"] = 5; + return values; + })(); + + /** + * ApiVersion enum. + * @name google.cloud.tpu.v2alpha1.Node.ApiVersion + * @enum {number} + * @property {number} API_VERSION_UNSPECIFIED=0 API_VERSION_UNSPECIFIED value + * @property {number} V1_ALPHA1=1 V1_ALPHA1 value + * @property {number} V1=2 V1 value + * @property {number} V2_ALPHA1=3 V2_ALPHA1 value + */ + Node.ApiVersion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "API_VERSION_UNSPECIFIED"] = 0; + values[valuesById[1] = "V1_ALPHA1"] = 1; + values[valuesById[2] = "V1"] = 2; + values[valuesById[3] = "V2_ALPHA1"] = 3; + return values; + })(); + + return Node; + })(); + + v2alpha1.ListNodesRequest = (function() { + + /** + * Properties of a ListNodesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListNodesRequest + * @property {string|null} [parent] ListNodesRequest parent + * @property {number|null} [pageSize] ListNodesRequest pageSize + * @property {string|null} [pageToken] ListNodesRequest pageToken + */ + + /** + * Constructs a new ListNodesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListNodesRequest. + * @implements IListNodesRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest=} [properties] Properties to set + */ + function ListNodesRequest(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]]; + } + + /** + * ListNodesRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @instance + */ + ListNodesRequest.prototype.parent = ""; + + /** + * ListNodesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @instance + */ + ListNodesRequest.prototype.pageSize = 0; + + /** + * ListNodesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @instance + */ + ListNodesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListNodesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest instance + */ + ListNodesRequest.create = function create(properties) { + return new ListNodesRequest(properties); + }; + + /** + * Encodes the specified ListNodesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} message ListNodesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNodesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListNodesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} message ListNodesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNodesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListNodesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNodesRequest.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.cloud.tpu.v2alpha1.ListNodesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListNodesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNodesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListNodesRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListNodesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + 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 a ListNodesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest + */ + ListNodesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListNodesRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListNodesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + 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 ListNodesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ListNodesRequest} message ListNodesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListNodesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + 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 ListNodesRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @instance + * @returns {Object.} JSON object + */ + ListNodesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListNodesRequest; + })(); + + v2alpha1.ListNodesResponse = (function() { + + /** + * Properties of a ListNodesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListNodesResponse + * @property {Array.|null} [nodes] ListNodesResponse nodes + * @property {string|null} [nextPageToken] ListNodesResponse nextPageToken + * @property {Array.|null} [unreachable] ListNodesResponse unreachable + */ + + /** + * Constructs a new ListNodesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListNodesResponse. + * @implements IListNodesResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListNodesResponse=} [properties] Properties to set + */ + function ListNodesResponse(properties) { + this.nodes = []; + this.unreachable = []; + 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]]; + } + + /** + * ListNodesResponse nodes. + * @member {Array.} nodes + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @instance + */ + ListNodesResponse.prototype.nodes = $util.emptyArray; + + /** + * ListNodesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @instance + */ + ListNodesResponse.prototype.nextPageToken = ""; + + /** + * ListNodesResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @instance + */ + ListNodesResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListNodesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse instance + */ + ListNodesResponse.create = function create(properties) { + return new ListNodesResponse(properties); + }; + + /** + * Encodes the specified ListNodesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesResponse} message ListNodesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNodesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nodes != null && message.nodes.length) + for (var i = 0; i < message.nodes.length; ++i) + $root.google.cloud.tpu.v2alpha1.Node.encode(message.nodes[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); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListNodesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesResponse} message ListNodesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNodesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListNodesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNodesResponse.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.cloud.tpu.v2alpha1.ListNodesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.nodes && message.nodes.length)) + message.nodes = []; + message.nodes.push($root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListNodesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNodesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListNodesResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListNodesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.nodes != null && message.hasOwnProperty("nodes")) { + if (!Array.isArray(message.nodes)) + return "nodes: array expected"; + for (var i = 0; i < message.nodes.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.nodes[i]); + if (error) + return "nodes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListNodesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse + */ + ListNodesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListNodesResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListNodesResponse(); + if (object.nodes) { + if (!Array.isArray(object.nodes)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListNodesResponse.nodes: array expected"); + message.nodes = []; + for (var i = 0; i < object.nodes.length; ++i) { + if (typeof object.nodes[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.ListNodesResponse.nodes: object expected"); + message.nodes[i] = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.nodes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListNodesResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListNodesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.ListNodesResponse} message ListNodesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListNodesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.nodes = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.nodes && message.nodes.length) { + object.nodes = []; + for (var j = 0; j < message.nodes.length; ++j) + object.nodes[j] = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.nodes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListNodesResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @instance + * @returns {Object.} JSON object + */ + ListNodesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListNodesResponse; + })(); + + v2alpha1.GetNodeRequest = (function() { + + /** + * Properties of a GetNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGetNodeRequest + * @property {string|null} [name] GetNodeRequest name + */ + + /** + * Constructs a new GetNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GetNodeRequest. + * @implements IGetNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest=} [properties] Properties to set + */ + function GetNodeRequest(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]]; + } + + /** + * GetNodeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @instance + */ + GetNodeRequest.prototype.name = ""; + + /** + * Creates a new GetNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest instance + */ + GetNodeRequest.create = function create(properties) { + return new GetNodeRequest(properties); + }; + + /** + * Encodes the specified GetNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} message GetNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNodeRequest.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); + return writer; + }; + + /** + * Encodes the specified GetNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} message GetNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNodeRequest.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.cloud.tpu.v2alpha1.GetNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetNodeRequest.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"; + return null; + }; + + /** + * Creates a GetNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest + */ + GetNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetNodeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GetNodeRequest} message GetNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @instance + * @returns {Object.} JSON object + */ + GetNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetNodeRequest; + })(); + + v2alpha1.CreateNodeRequest = (function() { + + /** + * Properties of a CreateNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface ICreateNodeRequest + * @property {string|null} [parent] CreateNodeRequest parent + * @property {string|null} [nodeId] CreateNodeRequest nodeId + * @property {google.cloud.tpu.v2alpha1.INode|null} [node] CreateNodeRequest node + */ + + /** + * Constructs a new CreateNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a CreateNodeRequest. + * @implements ICreateNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest=} [properties] Properties to set + */ + function CreateNodeRequest(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]]; + } + + /** + * CreateNodeRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @instance + */ + CreateNodeRequest.prototype.parent = ""; + + /** + * CreateNodeRequest nodeId. + * @member {string} nodeId + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @instance + */ + CreateNodeRequest.prototype.nodeId = ""; + + /** + * CreateNodeRequest node. + * @member {google.cloud.tpu.v2alpha1.INode|null|undefined} node + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @instance + */ + CreateNodeRequest.prototype.node = null; + + /** + * Creates a new CreateNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest instance + */ + CreateNodeRequest.create = function create(properties) { + return new CreateNodeRequest(properties); + }; + + /** + * Encodes the specified CreateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} message CreateNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateNodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.nodeId != null && Object.hasOwnProperty.call(message, "nodeId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nodeId); + if (message.node != null && Object.hasOwnProperty.call(message, "node")) + $root.google.cloud.tpu.v2alpha1.Node.encode(message.node, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} message CreateNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateNodeRequest.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.cloud.tpu.v2alpha1.CreateNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.nodeId = reader.string(); + break; + case 3: + message.node = $root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateNodeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.nodeId != null && message.hasOwnProperty("nodeId")) + if (!$util.isString(message.nodeId)) + return "nodeId: string expected"; + if (message.node != null && message.hasOwnProperty("node")) { + var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.node); + if (error) + return "node." + error; + } + return null; + }; + + /** + * Creates a CreateNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest + */ + CreateNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.CreateNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.CreateNodeRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.nodeId != null) + message.nodeId = String(object.nodeId); + if (object.node != null) { + if (typeof object.node !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.CreateNodeRequest.node: object expected"); + message.node = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.node); + } + return message; + }; + + /** + * Creates a plain object from a CreateNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.CreateNodeRequest} message CreateNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.nodeId = ""; + object.node = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.nodeId != null && message.hasOwnProperty("nodeId")) + object.nodeId = message.nodeId; + if (message.node != null && message.hasOwnProperty("node")) + object.node = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.node, options); + return object; + }; + + /** + * Converts this CreateNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @instance + * @returns {Object.} JSON object + */ + CreateNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateNodeRequest; + })(); + + v2alpha1.DeleteNodeRequest = (function() { + + /** + * Properties of a DeleteNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IDeleteNodeRequest + * @property {string|null} [name] DeleteNodeRequest name + */ + + /** + * Constructs a new DeleteNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a DeleteNodeRequest. + * @implements IDeleteNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest=} [properties] Properties to set + */ + function DeleteNodeRequest(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]]; + } + + /** + * DeleteNodeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @instance + */ + DeleteNodeRequest.prototype.name = ""; + + /** + * Creates a new DeleteNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest instance + */ + DeleteNodeRequest.create = function create(properties) { + return new DeleteNodeRequest(properties); + }; + + /** + * Encodes the specified DeleteNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} message DeleteNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteNodeRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} message DeleteNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteNodeRequest.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.cloud.tpu.v2alpha1.DeleteNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteNodeRequest.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"; + return null; + }; + + /** + * Creates a DeleteNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest + */ + DeleteNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.DeleteNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.DeleteNodeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.DeleteNodeRequest} message DeleteNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteNodeRequest; + })(); + + v2alpha1.StopNodeRequest = (function() { + + /** + * Properties of a StopNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IStopNodeRequest + * @property {string|null} [name] StopNodeRequest name + */ + + /** + * Constructs a new StopNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a StopNodeRequest. + * @implements IStopNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest=} [properties] Properties to set + */ + function StopNodeRequest(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]]; + } + + /** + * StopNodeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @instance + */ + StopNodeRequest.prototype.name = ""; + + /** + * Creates a new StopNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest instance + */ + StopNodeRequest.create = function create(properties) { + return new StopNodeRequest(properties); + }; + + /** + * Encodes the specified StopNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} message StopNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StopNodeRequest.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); + return writer; + }; + + /** + * Encodes the specified StopNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} message StopNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StopNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StopNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StopNodeRequest.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.cloud.tpu.v2alpha1.StopNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StopNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StopNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StopNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StopNodeRequest.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"; + return null; + }; + + /** + * Creates a StopNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest + */ + StopNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.StopNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.StopNodeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a StopNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.StopNodeRequest} message StopNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StopNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this StopNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @instance + * @returns {Object.} JSON object + */ + StopNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StopNodeRequest; + })(); + + v2alpha1.StartNodeRequest = (function() { + + /** + * Properties of a StartNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IStartNodeRequest + * @property {string|null} [name] StartNodeRequest name + */ + + /** + * Constructs a new StartNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a StartNodeRequest. + * @implements IStartNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest=} [properties] Properties to set + */ + function StartNodeRequest(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]]; + } + + /** + * StartNodeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @instance + */ + StartNodeRequest.prototype.name = ""; + + /** + * Creates a new StartNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest instance + */ + StartNodeRequest.create = function create(properties) { + return new StartNodeRequest(properties); + }; + + /** + * Encodes the specified StartNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} message StartNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartNodeRequest.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); + return writer; + }; + + /** + * Encodes the specified StartNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} message StartNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StartNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartNodeRequest.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.cloud.tpu.v2alpha1.StartNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StartNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StartNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StartNodeRequest.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"; + return null; + }; + + /** + * Creates a StartNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest + */ + StartNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.StartNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.StartNodeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a StartNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.StartNodeRequest} message StartNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StartNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this StartNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @instance + * @returns {Object.} JSON object + */ + StartNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StartNodeRequest; + })(); + + v2alpha1.UpdateNodeRequest = (function() { + + /** + * Properties of an UpdateNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IUpdateNodeRequest + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateNodeRequest updateMask + * @property {google.cloud.tpu.v2alpha1.INode|null} [node] UpdateNodeRequest node + */ + + /** + * Constructs a new UpdateNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an UpdateNodeRequest. + * @implements IUpdateNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest=} [properties] Properties to set + */ + function UpdateNodeRequest(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]]; + } + + /** + * UpdateNodeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @instance + */ + UpdateNodeRequest.prototype.updateMask = null; + + /** + * UpdateNodeRequest node. + * @member {google.cloud.tpu.v2alpha1.INode|null|undefined} node + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @instance + */ + UpdateNodeRequest.prototype.node = null; + + /** + * Creates a new UpdateNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest instance + */ + UpdateNodeRequest.create = function create(properties) { + return new UpdateNodeRequest(properties); + }; + + /** + * Encodes the specified UpdateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} message UpdateNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateNodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.node != null && Object.hasOwnProperty.call(message, "node")) + $root.google.cloud.tpu.v2alpha1.Node.encode(message.node, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} message UpdateNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateNodeRequest.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.cloud.tpu.v2alpha1.UpdateNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 2: + message.node = $root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateNodeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.node != null && message.hasOwnProperty("node")) { + var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.node); + if (error) + return "node." + error; + } + return null; + }; + + /** + * Creates an UpdateNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest + */ + UpdateNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.UpdateNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.UpdateNodeRequest(); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.UpdateNodeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.node != null) { + if (typeof object.node !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.UpdateNodeRequest.node: object expected"); + message.node = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.node); + } + return message; + }; + + /** + * Creates a plain object from an UpdateNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.UpdateNodeRequest} message UpdateNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.updateMask = null; + object.node = null; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.node != null && message.hasOwnProperty("node")) + object.node = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.node, options); + return object; + }; + + /** + * Converts this UpdateNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateNodeRequest; + })(); + + v2alpha1.ServiceIdentity = (function() { + + /** + * Properties of a ServiceIdentity. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IServiceIdentity + * @property {string|null} [email] ServiceIdentity email + */ + + /** + * Constructs a new ServiceIdentity. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ServiceIdentity. + * @implements IServiceIdentity + * @constructor + * @param {google.cloud.tpu.v2alpha1.IServiceIdentity=} [properties] Properties to set + */ + function ServiceIdentity(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]]; + } + + /** + * ServiceIdentity email. + * @member {string} email + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @instance + */ + ServiceIdentity.prototype.email = ""; + + /** + * Creates a new ServiceIdentity instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceIdentity=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity instance + */ + ServiceIdentity.create = function create(properties) { + return new ServiceIdentity(properties); + }; + + /** + * Encodes the specified ServiceIdentity message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceIdentity.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceIdentity} message ServiceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceIdentity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.email != null && Object.hasOwnProperty.call(message, "email")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.email); + return writer; + }; + + /** + * Encodes the specified ServiceIdentity message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceIdentity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceIdentity} message ServiceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceIdentity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceIdentity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceIdentity.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.cloud.tpu.v2alpha1.ServiceIdentity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.email = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceIdentity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceIdentity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceIdentity message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceIdentity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.email != null && message.hasOwnProperty("email")) + if (!$util.isString(message.email)) + return "email: string expected"; + return null; + }; + + /** + * Creates a ServiceIdentity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity + */ + ServiceIdentity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ServiceIdentity) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ServiceIdentity(); + if (object.email != null) + message.email = String(object.email); + return message; + }; + + /** + * Creates a plain object from a ServiceIdentity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {google.cloud.tpu.v2alpha1.ServiceIdentity} message ServiceIdentity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceIdentity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.email = ""; + if (message.email != null && message.hasOwnProperty("email")) + object.email = message.email; + return object; + }; + + /** + * Converts this ServiceIdentity to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @instance + * @returns {Object.} JSON object + */ + ServiceIdentity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceIdentity; + })(); + + v2alpha1.GenerateServiceIdentityRequest = (function() { + + /** + * Properties of a GenerateServiceIdentityRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGenerateServiceIdentityRequest + * @property {string|null} [parent] GenerateServiceIdentityRequest parent + */ + + /** + * Constructs a new GenerateServiceIdentityRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GenerateServiceIdentityRequest. + * @implements IGenerateServiceIdentityRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest=} [properties] Properties to set + */ + function GenerateServiceIdentityRequest(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]]; + } + + /** + * GenerateServiceIdentityRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @instance + */ + GenerateServiceIdentityRequest.prototype.parent = ""; + + /** + * Creates a new GenerateServiceIdentityRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest instance + */ + GenerateServiceIdentityRequest.create = function create(properties) { + return new GenerateServiceIdentityRequest(properties); + }; + + /** + * Encodes the specified GenerateServiceIdentityRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} message GenerateServiceIdentityRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateServiceIdentityRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + return writer; + }; + + /** + * Encodes the specified GenerateServiceIdentityRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} message GenerateServiceIdentityRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateServiceIdentityRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateServiceIdentityRequest.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.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateServiceIdentityRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateServiceIdentityRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateServiceIdentityRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a GenerateServiceIdentityRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest + */ + GenerateServiceIdentityRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a GenerateServiceIdentityRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} message GenerateServiceIdentityRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateServiceIdentityRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GenerateServiceIdentityRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateServiceIdentityRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateServiceIdentityRequest; + })(); + + v2alpha1.GenerateServiceIdentityResponse = (function() { + + /** + * Properties of a GenerateServiceIdentityResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGenerateServiceIdentityResponse + * @property {google.cloud.tpu.v2alpha1.IServiceIdentity|null} [identity] GenerateServiceIdentityResponse identity + */ + + /** + * Constructs a new GenerateServiceIdentityResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GenerateServiceIdentityResponse. + * @implements IGenerateServiceIdentityResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse=} [properties] Properties to set + */ + function GenerateServiceIdentityResponse(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]]; + } + + /** + * GenerateServiceIdentityResponse identity. + * @member {google.cloud.tpu.v2alpha1.IServiceIdentity|null|undefined} identity + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @instance + */ + GenerateServiceIdentityResponse.prototype.identity = null; + + /** + * Creates a new GenerateServiceIdentityResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse instance + */ + GenerateServiceIdentityResponse.create = function create(properties) { + return new GenerateServiceIdentityResponse(properties); + }; + + /** + * Encodes the specified GenerateServiceIdentityResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse} message GenerateServiceIdentityResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateServiceIdentityResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) + $root.google.cloud.tpu.v2alpha1.ServiceIdentity.encode(message.identity, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateServiceIdentityResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse} message GenerateServiceIdentityResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateServiceIdentityResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateServiceIdentityResponse.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.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identity = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateServiceIdentityResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateServiceIdentityResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateServiceIdentityResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identity != null && message.hasOwnProperty("identity")) { + var error = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.verify(message.identity); + if (error) + return "identity." + error; + } + return null; + }; + + /** + * Creates a GenerateServiceIdentityResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse + */ + GenerateServiceIdentityResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse(); + if (object.identity != null) { + if (typeof object.identity !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.identity: object expected"); + message.identity = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.fromObject(object.identity); + } + return message; + }; + + /** + * Creates a plain object from a GenerateServiceIdentityResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} message GenerateServiceIdentityResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateServiceIdentityResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.identity = null; + if (message.identity != null && message.hasOwnProperty("identity")) + object.identity = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.toObject(message.identity, options); + return object; + }; + + /** + * Converts this GenerateServiceIdentityResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateServiceIdentityResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateServiceIdentityResponse; + })(); + + v2alpha1.AcceleratorType = (function() { + + /** + * Properties of an AcceleratorType. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IAcceleratorType + * @property {string|null} [name] AcceleratorType name + * @property {string|null} [type] AcceleratorType type + */ + + /** + * Constructs a new AcceleratorType. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an AcceleratorType. + * @implements IAcceleratorType + * @constructor + * @param {google.cloud.tpu.v2alpha1.IAcceleratorType=} [properties] Properties to set + */ + function AcceleratorType(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]]; + } + + /** + * AcceleratorType name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @instance + */ + AcceleratorType.prototype.name = ""; + + /** + * AcceleratorType type. + * @member {string} type + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @instance + */ + AcceleratorType.prototype.type = ""; + + /** + * Creates a new AcceleratorType instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {google.cloud.tpu.v2alpha1.IAcceleratorType=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType instance + */ + AcceleratorType.create = function create(properties) { + return new AcceleratorType(properties); + }; + + /** + * Encodes the specified AcceleratorType message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorType.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {google.cloud.tpu.v2alpha1.IAcceleratorType} message AcceleratorType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcceleratorType.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.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + return writer; + }; + + /** + * Encodes the specified AcceleratorType message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {google.cloud.tpu.v2alpha1.IAcceleratorType} message AcceleratorType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcceleratorType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AcceleratorType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcceleratorType.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.cloud.tpu.v2alpha1.AcceleratorType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AcceleratorType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcceleratorType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AcceleratorType message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AcceleratorType.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.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + return null; + }; + + /** + * Creates an AcceleratorType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType + */ + AcceleratorType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.AcceleratorType) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.AcceleratorType(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + return message; + }; + + /** + * Creates a plain object from an AcceleratorType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {google.cloud.tpu.v2alpha1.AcceleratorType} message AcceleratorType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AcceleratorType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.type = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + return object; + }; + + /** + * Converts this AcceleratorType to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @instance + * @returns {Object.} JSON object + */ + AcceleratorType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AcceleratorType; + })(); + + v2alpha1.GetAcceleratorTypeRequest = (function() { + + /** + * Properties of a GetAcceleratorTypeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGetAcceleratorTypeRequest + * @property {string|null} [name] GetAcceleratorTypeRequest name + */ + + /** + * Constructs a new GetAcceleratorTypeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GetAcceleratorTypeRequest. + * @implements IGetAcceleratorTypeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest=} [properties] Properties to set + */ + function GetAcceleratorTypeRequest(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]]; + } + + /** + * GetAcceleratorTypeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @instance + */ + GetAcceleratorTypeRequest.prototype.name = ""; + + /** + * Creates a new GetAcceleratorTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest instance + */ + GetAcceleratorTypeRequest.create = function create(properties) { + return new GetAcceleratorTypeRequest(properties); + }; + + /** + * Encodes the specified GetAcceleratorTypeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} message GetAcceleratorTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAcceleratorTypeRequest.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); + return writer; + }; + + /** + * Encodes the specified GetAcceleratorTypeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} message GetAcceleratorTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAcceleratorTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAcceleratorTypeRequest.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.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAcceleratorTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetAcceleratorTypeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetAcceleratorTypeRequest.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"; + return null; + }; + + /** + * Creates a GetAcceleratorTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest + */ + GetAcceleratorTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetAcceleratorTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} message GetAcceleratorTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetAcceleratorTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetAcceleratorTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @instance + * @returns {Object.} JSON object + */ + GetAcceleratorTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetAcceleratorTypeRequest; + })(); + + v2alpha1.ListAcceleratorTypesRequest = (function() { + + /** + * Properties of a ListAcceleratorTypesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListAcceleratorTypesRequest + * @property {string|null} [parent] ListAcceleratorTypesRequest parent + * @property {number|null} [pageSize] ListAcceleratorTypesRequest pageSize + * @property {string|null} [pageToken] ListAcceleratorTypesRequest pageToken + * @property {string|null} [filter] ListAcceleratorTypesRequest filter + * @property {string|null} [orderBy] ListAcceleratorTypesRequest orderBy + */ + + /** + * Constructs a new ListAcceleratorTypesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListAcceleratorTypesRequest. + * @implements IListAcceleratorTypesRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest=} [properties] Properties to set + */ + function ListAcceleratorTypesRequest(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]]; + } + + /** + * ListAcceleratorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.parent = ""; + + /** + * ListAcceleratorTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.pageSize = 0; + + /** + * ListAcceleratorTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.pageToken = ""; + + /** + * ListAcceleratorTypesRequest filter. + * @member {string} filter + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.filter = ""; + + /** + * ListAcceleratorTypesRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.orderBy = ""; + + /** + * Creates a new ListAcceleratorTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest instance + */ + ListAcceleratorTypesRequest.create = function create(properties) { + return new ListAcceleratorTypesRequest(properties); + }; + + /** + * Encodes the specified ListAcceleratorTypesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} message ListAcceleratorTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAcceleratorTypesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListAcceleratorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} message ListAcceleratorTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAcceleratorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAcceleratorTypesRequest.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.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.orderBy = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAcceleratorTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAcceleratorTypesRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAcceleratorTypesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + 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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListAcceleratorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest + */ + ListAcceleratorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListAcceleratorTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} message ListAcceleratorTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAcceleratorTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListAcceleratorTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListAcceleratorTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListAcceleratorTypesRequest; + })(); + + v2alpha1.ListAcceleratorTypesResponse = (function() { + + /** + * Properties of a ListAcceleratorTypesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListAcceleratorTypesResponse + * @property {Array.|null} [acceleratorTypes] ListAcceleratorTypesResponse acceleratorTypes + * @property {string|null} [nextPageToken] ListAcceleratorTypesResponse nextPageToken + * @property {Array.|null} [unreachable] ListAcceleratorTypesResponse unreachable + */ + + /** + * Constructs a new ListAcceleratorTypesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListAcceleratorTypesResponse. + * @implements IListAcceleratorTypesResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse=} [properties] Properties to set + */ + function ListAcceleratorTypesResponse(properties) { + this.acceleratorTypes = []; + this.unreachable = []; + 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]]; + } + + /** + * ListAcceleratorTypesResponse acceleratorTypes. + * @member {Array.} acceleratorTypes + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @instance + */ + ListAcceleratorTypesResponse.prototype.acceleratorTypes = $util.emptyArray; + + /** + * ListAcceleratorTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @instance + */ + ListAcceleratorTypesResponse.prototype.nextPageToken = ""; + + /** + * ListAcceleratorTypesResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @instance + */ + ListAcceleratorTypesResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListAcceleratorTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse instance + */ + ListAcceleratorTypesResponse.create = function create(properties) { + return new ListAcceleratorTypesResponse(properties); + }; + + /** + * Encodes the specified ListAcceleratorTypesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse} message ListAcceleratorTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAcceleratorTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.acceleratorTypes != null && message.acceleratorTypes.length) + for (var i = 0; i < message.acceleratorTypes.length; ++i) + $root.google.cloud.tpu.v2alpha1.AcceleratorType.encode(message.acceleratorTypes[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); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListAcceleratorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse} message ListAcceleratorTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAcceleratorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAcceleratorTypesResponse.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.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.acceleratorTypes && message.acceleratorTypes.length)) + message.acceleratorTypes = []; + message.acceleratorTypes.push($root.google.cloud.tpu.v2alpha1.AcceleratorType.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAcceleratorTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAcceleratorTypesResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAcceleratorTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.acceleratorTypes != null && message.hasOwnProperty("acceleratorTypes")) { + if (!Array.isArray(message.acceleratorTypes)) + return "acceleratorTypes: array expected"; + for (var i = 0; i < message.acceleratorTypes.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.AcceleratorType.verify(message.acceleratorTypes[i]); + if (error) + return "acceleratorTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListAcceleratorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse + */ + ListAcceleratorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse(); + if (object.acceleratorTypes) { + if (!Array.isArray(object.acceleratorTypes)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.acceleratorTypes: array expected"); + message.acceleratorTypes = []; + for (var i = 0; i < object.acceleratorTypes.length; ++i) { + if (typeof object.acceleratorTypes[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.acceleratorTypes: object expected"); + message.acceleratorTypes[i] = $root.google.cloud.tpu.v2alpha1.AcceleratorType.fromObject(object.acceleratorTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListAcceleratorTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} message ListAcceleratorTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAcceleratorTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.acceleratorTypes = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.acceleratorTypes && message.acceleratorTypes.length) { + object.acceleratorTypes = []; + for (var j = 0; j < message.acceleratorTypes.length; ++j) + object.acceleratorTypes[j] = $root.google.cloud.tpu.v2alpha1.AcceleratorType.toObject(message.acceleratorTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListAcceleratorTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListAcceleratorTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListAcceleratorTypesResponse; + })(); + + v2alpha1.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IOperationMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime + * @property {string|null} [target] OperationMetadata target + * @property {string|null} [verb] OperationMetadata verb + * @property {string|null} [statusDetail] OperationMetadata statusDetail + * @property {boolean|null} [cancelRequested] OperationMetadata cancelRequested + * @property {string|null} [apiVersion] OperationMetadata apiVersion + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.tpu.v2alpha1.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(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]]; + } + + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.endTime = null; + + /** + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.target = ""; + + /** + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata statusDetail. + * @member {string} statusDetail + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.statusDetail = ""; + + /** + * OperationMetadata cancelRequested. + * @member {boolean} cancelRequested + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.cancelRequested = false; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {google.cloud.tpu.v2alpha1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {google.cloud.tpu.v2alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); + if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); + if (message.statusDetail != null && Object.hasOwnProperty.call(message, "statusDetail")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusDetail); + if (message.cancelRequested != null && Object.hasOwnProperty.call(message, "cancelRequested")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.cancelRequested); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {google.cloud.tpu.v2alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.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.cloud.tpu.v2alpha1.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.target = reader.string(); + break; + case 4: + message.verb = reader.string(); + break; + case 5: + message.statusDetail = reader.string(); + break; + case 6: + message.cancelRequested = reader.bool(); + break; + case 7: + message.apiVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.verb != null && message.hasOwnProperty("verb")) + if (!$util.isString(message.verb)) + return "verb: string expected"; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + if (!$util.isString(message.statusDetail)) + return "statusDetail: string expected"; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + if (typeof message.cancelRequested !== "boolean") + return "cancelRequested: boolean expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; + return null; + }; + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.OperationMetadata) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.OperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.target != null) + message.target = String(object.target); + if (object.verb != null) + message.verb = String(object.verb); + if (object.statusDetail != null) + message.statusDetail = String(object.statusDetail); + if (object.cancelRequested != null) + message.cancelRequested = Boolean(object.cancelRequested); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {google.cloud.tpu.v2alpha1.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.statusDetail = ""; + object.cancelRequested = false; + object.apiVersion = ""; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.verb != null && message.hasOwnProperty("verb")) + object.verb = message.verb; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + object.statusDetail = message.statusDetail; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + object.cancelRequested = message.cancelRequested; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; + return object; + }; + + /** + * Converts this OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OperationMetadata; + })(); + + v2alpha1.RuntimeVersion = (function() { + + /** + * Properties of a RuntimeVersion. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IRuntimeVersion + * @property {string|null} [name] RuntimeVersion name + * @property {string|null} [version] RuntimeVersion version + */ + + /** + * Constructs a new RuntimeVersion. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a RuntimeVersion. + * @implements IRuntimeVersion + * @constructor + * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion=} [properties] Properties to set + */ + function RuntimeVersion(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]]; + } + + /** + * RuntimeVersion name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @instance + */ + RuntimeVersion.prototype.name = ""; + + /** + * RuntimeVersion version. + * @member {string} version + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @instance + */ + RuntimeVersion.prototype.version = ""; + + /** + * Creates a new RuntimeVersion instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion instance + */ + RuntimeVersion.create = function create(properties) { + return new RuntimeVersion(properties); + }; + + /** + * Encodes the specified RuntimeVersion message. Does not implicitly {@link google.cloud.tpu.v2alpha1.RuntimeVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion} message RuntimeVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RuntimeVersion.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.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); + return writer; + }; + + /** + * Encodes the specified RuntimeVersion message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.RuntimeVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion} message RuntimeVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RuntimeVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RuntimeVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RuntimeVersion.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.cloud.tpu.v2alpha1.RuntimeVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RuntimeVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RuntimeVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RuntimeVersion message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RuntimeVersion.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.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a RuntimeVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion + */ + RuntimeVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.RuntimeVersion) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.RuntimeVersion(); + if (object.name != null) + message.name = String(object.name); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a RuntimeVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {google.cloud.tpu.v2alpha1.RuntimeVersion} message RuntimeVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RuntimeVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.version = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this RuntimeVersion to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @instance + * @returns {Object.} JSON object + */ + RuntimeVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RuntimeVersion; + })(); + + v2alpha1.GetRuntimeVersionRequest = (function() { + + /** + * Properties of a GetRuntimeVersionRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGetRuntimeVersionRequest + * @property {string|null} [name] GetRuntimeVersionRequest name + */ + + /** + * Constructs a new GetRuntimeVersionRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GetRuntimeVersionRequest. + * @implements IGetRuntimeVersionRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest=} [properties] Properties to set + */ + function GetRuntimeVersionRequest(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]]; + } + + /** + * GetRuntimeVersionRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @instance + */ + GetRuntimeVersionRequest.prototype.name = ""; + + /** + * Creates a new GetRuntimeVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest instance + */ + GetRuntimeVersionRequest.create = function create(properties) { + return new GetRuntimeVersionRequest(properties); + }; + + /** + * Encodes the specified GetRuntimeVersionRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} message GetRuntimeVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetRuntimeVersionRequest.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); + return writer; + }; + + /** + * Encodes the specified GetRuntimeVersionRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} message GetRuntimeVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetRuntimeVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetRuntimeVersionRequest.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.cloud.tpu.v2alpha1.GetRuntimeVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetRuntimeVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetRuntimeVersionRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetRuntimeVersionRequest.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"; + return null; + }; + + /** + * Creates a GetRuntimeVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest + */ + GetRuntimeVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetRuntimeVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} message GetRuntimeVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetRuntimeVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetRuntimeVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetRuntimeVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetRuntimeVersionRequest; + })(); + + v2alpha1.ListRuntimeVersionsRequest = (function() { + + /** + * Properties of a ListRuntimeVersionsRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListRuntimeVersionsRequest + * @property {string|null} [parent] ListRuntimeVersionsRequest parent + * @property {number|null} [pageSize] ListRuntimeVersionsRequest pageSize + * @property {string|null} [pageToken] ListRuntimeVersionsRequest pageToken + * @property {string|null} [filter] ListRuntimeVersionsRequest filter + * @property {string|null} [orderBy] ListRuntimeVersionsRequest orderBy + */ + + /** + * Constructs a new ListRuntimeVersionsRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListRuntimeVersionsRequest. + * @implements IListRuntimeVersionsRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest=} [properties] Properties to set + */ + function ListRuntimeVersionsRequest(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]]; + } + + /** + * ListRuntimeVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.parent = ""; + + /** + * ListRuntimeVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.pageSize = 0; + + /** + * ListRuntimeVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.pageToken = ""; + + /** + * ListRuntimeVersionsRequest filter. + * @member {string} filter + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.filter = ""; + + /** + * ListRuntimeVersionsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListRuntimeVersionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest instance + */ + ListRuntimeVersionsRequest.create = function create(properties) { + return new ListRuntimeVersionsRequest(properties); + }; + + /** + * Encodes the specified ListRuntimeVersionsRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} message ListRuntimeVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimeVersionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListRuntimeVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} message ListRuntimeVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimeVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimeVersionsRequest.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.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.orderBy = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimeVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimeVersionsRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimeVersionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + 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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListRuntimeVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest + */ + ListRuntimeVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListRuntimeVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} message ListRuntimeVersionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimeVersionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListRuntimeVersionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListRuntimeVersionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListRuntimeVersionsRequest; + })(); + + v2alpha1.ListRuntimeVersionsResponse = (function() { + + /** + * Properties of a ListRuntimeVersionsResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListRuntimeVersionsResponse + * @property {Array.|null} [runtimeVersions] ListRuntimeVersionsResponse runtimeVersions + * @property {string|null} [nextPageToken] ListRuntimeVersionsResponse nextPageToken + * @property {Array.|null} [unreachable] ListRuntimeVersionsResponse unreachable + */ + + /** + * Constructs a new ListRuntimeVersionsResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListRuntimeVersionsResponse. + * @implements IListRuntimeVersionsResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse=} [properties] Properties to set + */ + function ListRuntimeVersionsResponse(properties) { + this.runtimeVersions = []; + this.unreachable = []; + 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]]; + } + + /** + * ListRuntimeVersionsResponse runtimeVersions. + * @member {Array.} runtimeVersions + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @instance + */ + ListRuntimeVersionsResponse.prototype.runtimeVersions = $util.emptyArray; + + /** + * ListRuntimeVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @instance + */ + ListRuntimeVersionsResponse.prototype.nextPageToken = ""; + + /** + * ListRuntimeVersionsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @instance + */ + ListRuntimeVersionsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListRuntimeVersionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse instance + */ + ListRuntimeVersionsResponse.create = function create(properties) { + return new ListRuntimeVersionsResponse(properties); + }; + + /** + * Encodes the specified ListRuntimeVersionsResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse} message ListRuntimeVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimeVersionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.runtimeVersions != null && message.runtimeVersions.length) + for (var i = 0; i < message.runtimeVersions.length; ++i) + $root.google.cloud.tpu.v2alpha1.RuntimeVersion.encode(message.runtimeVersions[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); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListRuntimeVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse} message ListRuntimeVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimeVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimeVersionsResponse.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.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.runtimeVersions && message.runtimeVersions.length)) + message.runtimeVersions = []; + message.runtimeVersions.push($root.google.cloud.tpu.v2alpha1.RuntimeVersion.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimeVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimeVersionsResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimeVersionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.runtimeVersions != null && message.hasOwnProperty("runtimeVersions")) { + if (!Array.isArray(message.runtimeVersions)) + return "runtimeVersions: array expected"; + for (var i = 0; i < message.runtimeVersions.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.RuntimeVersion.verify(message.runtimeVersions[i]); + if (error) + return "runtimeVersions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListRuntimeVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse + */ + ListRuntimeVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse(); + if (object.runtimeVersions) { + if (!Array.isArray(object.runtimeVersions)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.runtimeVersions: array expected"); + message.runtimeVersions = []; + for (var i = 0; i < object.runtimeVersions.length; ++i) { + if (typeof object.runtimeVersions[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.runtimeVersions: object expected"); + message.runtimeVersions[i] = $root.google.cloud.tpu.v2alpha1.RuntimeVersion.fromObject(object.runtimeVersions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListRuntimeVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} message ListRuntimeVersionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimeVersionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.runtimeVersions = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.runtimeVersions && message.runtimeVersions.length) { + object.runtimeVersions = []; + for (var j = 0; j < message.runtimeVersions.length; ++j) + object.runtimeVersions[j] = $root.google.cloud.tpu.v2alpha1.RuntimeVersion.toObject(message.runtimeVersions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListRuntimeVersionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListRuntimeVersionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListRuntimeVersionsResponse; + })(); + + v2alpha1.Symptom = (function() { + + /** + * Properties of a Symptom. + * @memberof google.cloud.tpu.v2alpha1 + * @interface ISymptom + * @property {google.protobuf.ITimestamp|null} [createTime] Symptom createTime + * @property {google.cloud.tpu.v2alpha1.Symptom.SymptomType|null} [symptomType] Symptom symptomType + * @property {string|null} [details] Symptom details + * @property {string|null} [workerId] Symptom workerId + */ + + /** + * Constructs a new Symptom. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a Symptom. + * @implements ISymptom + * @constructor + * @param {google.cloud.tpu.v2alpha1.ISymptom=} [properties] Properties to set + */ + function Symptom(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]]; + } + + /** + * Symptom createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @instance + */ + Symptom.prototype.createTime = null; + + /** + * Symptom symptomType. + * @member {google.cloud.tpu.v2alpha1.Symptom.SymptomType} symptomType + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @instance + */ + Symptom.prototype.symptomType = 0; + + /** + * Symptom details. + * @member {string} details + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @instance + */ + Symptom.prototype.details = ""; + + /** + * Symptom workerId. + * @member {string} workerId + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @instance + */ + Symptom.prototype.workerId = ""; + + /** + * Creates a new Symptom instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @static + * @param {google.cloud.tpu.v2alpha1.ISymptom=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.Symptom} Symptom instance + */ + Symptom.create = function create(properties) { + return new Symptom(properties); + }; + + /** + * Encodes the specified Symptom message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Symptom.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @static + * @param {google.cloud.tpu.v2alpha1.ISymptom} message Symptom message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symptom.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.symptomType != null && Object.hasOwnProperty.call(message, "symptomType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.symptomType); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.details); + if (message.workerId != null && Object.hasOwnProperty.call(message, "workerId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.workerId); + return writer; + }; + + /** + * Encodes the specified Symptom message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Symptom.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @static + * @param {google.cloud.tpu.v2alpha1.ISymptom} message Symptom message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symptom.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Symptom message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.Symptom} Symptom + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symptom.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.cloud.tpu.v2alpha1.Symptom(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.symptomType = reader.int32(); + break; + case 3: + message.details = reader.string(); + break; + case 4: + message.workerId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Symptom message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.Symptom} Symptom + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symptom.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Symptom message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Symptom.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.symptomType != null && message.hasOwnProperty("symptomType")) + switch (message.symptomType) { + default: + return "symptomType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.details != null && message.hasOwnProperty("details")) + if (!$util.isString(message.details)) + return "details: string expected"; + if (message.workerId != null && message.hasOwnProperty("workerId")) + if (!$util.isString(message.workerId)) + return "workerId: string expected"; + return null; + }; + + /** + * Creates a Symptom message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.Symptom} Symptom + */ + Symptom.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.Symptom) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.Symptom(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Symptom.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + switch (object.symptomType) { + case "SYMPTOM_TYPE_UNSPECIFIED": + case 0: + message.symptomType = 0; + break; + case "LOW_MEMORY": + case 1: + message.symptomType = 1; + break; + case "OUT_OF_MEMORY": + case 2: + message.symptomType = 2; + break; + case "EXECUTE_TIMED_OUT": + case 3: + message.symptomType = 3; + break; + case "MESH_BUILD_FAIL": + case 4: + message.symptomType = 4; + break; + case "HBM_OUT_OF_MEMORY": + case 5: + message.symptomType = 5; + break; + case "PROJECT_ABUSE": + case 6: + message.symptomType = 6; + break; + } + if (object.details != null) + message.details = String(object.details); + if (object.workerId != null) + message.workerId = String(object.workerId); + return message; + }; + + /** + * Creates a plain object from a Symptom message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @static + * @param {google.cloud.tpu.v2alpha1.Symptom} message Symptom + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Symptom.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.symptomType = options.enums === String ? "SYMPTOM_TYPE_UNSPECIFIED" : 0; + object.details = ""; + object.workerId = ""; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.symptomType != null && message.hasOwnProperty("symptomType")) + object.symptomType = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Symptom.SymptomType[message.symptomType] : message.symptomType; + if (message.details != null && message.hasOwnProperty("details")) + object.details = message.details; + if (message.workerId != null && message.hasOwnProperty("workerId")) + object.workerId = message.workerId; + return object; + }; + + /** + * Converts this Symptom to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.Symptom + * @instance + * @returns {Object.} JSON object + */ + Symptom.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * SymptomType enum. + * @name google.cloud.tpu.v2alpha1.Symptom.SymptomType + * @enum {number} + * @property {number} SYMPTOM_TYPE_UNSPECIFIED=0 SYMPTOM_TYPE_UNSPECIFIED value + * @property {number} LOW_MEMORY=1 LOW_MEMORY value + * @property {number} OUT_OF_MEMORY=2 OUT_OF_MEMORY value + * @property {number} EXECUTE_TIMED_OUT=3 EXECUTE_TIMED_OUT value + * @property {number} MESH_BUILD_FAIL=4 MESH_BUILD_FAIL value + * @property {number} HBM_OUT_OF_MEMORY=5 HBM_OUT_OF_MEMORY value + * @property {number} PROJECT_ABUSE=6 PROJECT_ABUSE value + */ + Symptom.SymptomType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SYMPTOM_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "LOW_MEMORY"] = 1; + values[valuesById[2] = "OUT_OF_MEMORY"] = 2; + values[valuesById[3] = "EXECUTE_TIMED_OUT"] = 3; + values[valuesById[4] = "MESH_BUILD_FAIL"] = 4; + values[valuesById[5] = "HBM_OUT_OF_MEMORY"] = 5; + values[valuesById[6] = "PROJECT_ABUSE"] = 6; + return values; + })(); + + return Symptom; + })(); + + v2alpha1.GetGuestAttributesRequest = (function() { + + /** + * Properties of a GetGuestAttributesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGetGuestAttributesRequest + * @property {string|null} [name] GetGuestAttributesRequest name + * @property {string|null} [queryPath] GetGuestAttributesRequest queryPath + * @property {Array.|null} [workerIds] GetGuestAttributesRequest workerIds + */ + + /** + * Constructs a new GetGuestAttributesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GetGuestAttributesRequest. + * @implements IGetGuestAttributesRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest=} [properties] Properties to set + */ + function GetGuestAttributesRequest(properties) { + this.workerIds = []; + 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]]; + } + + /** + * GetGuestAttributesRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @instance + */ + GetGuestAttributesRequest.prototype.name = ""; + + /** + * GetGuestAttributesRequest queryPath. + * @member {string} queryPath + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @instance + */ + GetGuestAttributesRequest.prototype.queryPath = ""; + + /** + * GetGuestAttributesRequest workerIds. + * @member {Array.} workerIds + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @instance + */ + GetGuestAttributesRequest.prototype.workerIds = $util.emptyArray; + + /** + * Creates a new GetGuestAttributesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesRequest} GetGuestAttributesRequest instance + */ + GetGuestAttributesRequest.create = function create(properties) { + return new GetGuestAttributesRequest(properties); + }; + + /** + * Encodes the specified GetGuestAttributesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest} message GetGuestAttributesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesRequest.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.queryPath != null && Object.hasOwnProperty.call(message, "queryPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryPath); + if (message.workerIds != null && message.workerIds.length) + for (var i = 0; i < message.workerIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.workerIds[i]); + return writer; + }; + + /** + * Encodes the specified GetGuestAttributesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest} message GetGuestAttributesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetGuestAttributesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesRequest} GetGuestAttributesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesRequest.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.cloud.tpu.v2alpha1.GetGuestAttributesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.queryPath = reader.string(); + break; + case 3: + if (!(message.workerIds && message.workerIds.length)) + message.workerIds = []; + message.workerIds.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetGuestAttributesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesRequest} GetGuestAttributesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetGuestAttributesRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetGuestAttributesRequest.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.queryPath != null && message.hasOwnProperty("queryPath")) + if (!$util.isString(message.queryPath)) + return "queryPath: string expected"; + if (message.workerIds != null && message.hasOwnProperty("workerIds")) { + if (!Array.isArray(message.workerIds)) + return "workerIds: array expected"; + for (var i = 0; i < message.workerIds.length; ++i) + if (!$util.isString(message.workerIds[i])) + return "workerIds: string[] expected"; + } + return null; + }; + + /** + * Creates a GetGuestAttributesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesRequest} GetGuestAttributesRequest + */ + GetGuestAttributesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.queryPath != null) + message.queryPath = String(object.queryPath); + if (object.workerIds) { + if (!Array.isArray(object.workerIds)) + throw TypeError(".google.cloud.tpu.v2alpha1.GetGuestAttributesRequest.workerIds: array expected"); + message.workerIds = []; + for (var i = 0; i < object.workerIds.length; ++i) + message.workerIds[i] = String(object.workerIds[i]); + } + return message; + }; + + /** + * Creates a plain object from a GetGuestAttributesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GetGuestAttributesRequest} message GetGuestAttributesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetGuestAttributesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.workerIds = []; + if (options.defaults) { + object.name = ""; + object.queryPath = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.queryPath != null && message.hasOwnProperty("queryPath")) + object.queryPath = message.queryPath; + if (message.workerIds && message.workerIds.length) { + object.workerIds = []; + for (var j = 0; j < message.workerIds.length; ++j) + object.workerIds[j] = message.workerIds[j]; + } + return object; + }; + + /** + * Converts this GetGuestAttributesRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesRequest + * @instance + * @returns {Object.} JSON object + */ + GetGuestAttributesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetGuestAttributesRequest; + })(); + + v2alpha1.GetGuestAttributesResponse = (function() { + + /** + * Properties of a GetGuestAttributesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGetGuestAttributesResponse + * @property {Array.|null} [guestAttributes] GetGuestAttributesResponse guestAttributes + */ + + /** + * Constructs a new GetGuestAttributesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GetGuestAttributesResponse. + * @implements IGetGuestAttributesResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse=} [properties] Properties to set + */ + function GetGuestAttributesResponse(properties) { + this.guestAttributes = []; + 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]]; + } + + /** + * GetGuestAttributesResponse guestAttributes. + * @member {Array.} guestAttributes + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @instance + */ + GetGuestAttributesResponse.prototype.guestAttributes = $util.emptyArray; + + /** + * Creates a new GetGuestAttributesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse instance + */ + GetGuestAttributesResponse.create = function create(properties) { + return new GetGuestAttributesResponse(properties); + }; + + /** + * Encodes the specified GetGuestAttributesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse} message GetGuestAttributesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.guestAttributes != null && message.guestAttributes.length) + for (var i = 0; i < message.guestAttributes.length; ++i) + $root.google.cloud.tpu.v2alpha1.GuestAttributes.encode(message.guestAttributes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetGuestAttributesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse} message GetGuestAttributesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesResponse.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.cloud.tpu.v2alpha1.GetGuestAttributesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.guestAttributes && message.guestAttributes.length)) + message.guestAttributes = []; + message.guestAttributes.push($root.google.cloud.tpu.v2alpha1.GuestAttributes.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetGuestAttributesResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetGuestAttributesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.guestAttributes != null && message.hasOwnProperty("guestAttributes")) { + if (!Array.isArray(message.guestAttributes)) + return "guestAttributes: array expected"; + for (var i = 0; i < message.guestAttributes.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.GuestAttributes.verify(message.guestAttributes[i]); + if (error) + return "guestAttributes." + error; + } + } + return null; + }; + + /** + * Creates a GetGuestAttributesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse + */ + GetGuestAttributesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse(); + if (object.guestAttributes) { + if (!Array.isArray(object.guestAttributes)) + throw TypeError(".google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.guestAttributes: array expected"); + message.guestAttributes = []; + for (var i = 0; i < object.guestAttributes.length; ++i) { + if (typeof object.guestAttributes[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.guestAttributes: object expected"); + message.guestAttributes[i] = $root.google.cloud.tpu.v2alpha1.GuestAttributes.fromObject(object.guestAttributes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GetGuestAttributesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} message GetGuestAttributesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetGuestAttributesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.guestAttributes = []; + if (message.guestAttributes && message.guestAttributes.length) { + object.guestAttributes = []; + for (var j = 0; j < message.guestAttributes.length; ++j) + object.guestAttributes[j] = $root.google.cloud.tpu.v2alpha1.GuestAttributes.toObject(message.guestAttributes[j], options); + } + return object; + }; + + /** + * Converts this GetGuestAttributesResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @instance + * @returns {Object.} JSON object + */ + GetGuestAttributesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetGuestAttributesResponse; + })(); + + return v2alpha1; + })(); + return tpu; })(); @@ -17140,6 +25873,209 @@ return Timestamp; })(); + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + 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]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.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.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FieldMask; + })(); + return protobuf; })(); diff --git a/packages/google-cloud-tpu/protos/protos.json b/packages/google-cloud-tpu/protos/protos.json index 5116963e319..db63670d013 100644 --- a/packages/google-cloud-tpu/protos/protos.json +++ b/packages/google-cloud-tpu/protos/protos.json @@ -769,6 +769,972 @@ } } } + }, + "v2alpha1": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/tpu/v2alpha1;tpu", + "java_multiple_files": true, + "java_outer_classname": "CloudTpuProto", + "java_package": "com.google.cloud.tpu.v2alpha1" + }, + "nested": { + "Tpu": { + "options": { + "(google.api.default_host)": "tpu.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListNodes": { + "requestType": "ListNodesRequest", + "responseType": "ListNodesResponse", + "options": { + "(google.api.http).get": "/v2alpha1/{parent=projects/*/locations/*}/nodes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha1/{parent=projects/*/locations/*}/nodes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetNode": { + "requestType": "GetNodeRequest", + "responseType": "Node", + "options": { + "(google.api.http).get": "/v2alpha1/{name=projects/*/locations/*/nodes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha1/{name=projects/*/locations/*/nodes/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateNode": { + "requestType": "CreateNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha1/{parent=projects/*/locations/*}/nodes", + "(google.api.http).body": "node", + "(google.api.method_signature)": "parent,node,node_id", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha1/{parent=projects/*/locations/*}/nodes", + "body": "node" + } + }, + { + "(google.api.method_signature)": "parent,node,node_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeleteNode": { + "requestType": "DeleteNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2alpha1/{name=projects/*/locations/*/nodes/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2alpha1/{name=projects/*/locations/*/nodes/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "StopNode": { + "requestType": "StopNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:stop", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:stop", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "StartNode": { + "requestType": "StartNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:start", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:start", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "UpdateNode": { + "requestType": "UpdateNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v2alpha1/{node.name=projects/*/locations/*/nodes/*}", + "(google.api.http).body": "node", + "(google.api.method_signature)": "node,update_mask", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha1/{node.name=projects/*/locations/*/nodes/*}", + "body": "node" + } + }, + { + "(google.api.method_signature)": "node,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "GenerateServiceIdentity": { + "requestType": "GenerateServiceIdentityRequest", + "responseType": "GenerateServiceIdentityResponse", + "options": { + "(google.api.http).post": "/v2alpha1/{parent=projects/*/locations/*}:generateServiceIdentity", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha1/{parent=projects/*/locations/*}:generateServiceIdentity", + "body": "*" + } + } + ] + }, + "ListAcceleratorTypes": { + "requestType": "ListAcceleratorTypesRequest", + "responseType": "ListAcceleratorTypesResponse", + "options": { + "(google.api.http).get": "/v2alpha1/{parent=projects/*/locations/*}/acceleratorTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha1/{parent=projects/*/locations/*}/acceleratorTypes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetAcceleratorType": { + "requestType": "GetAcceleratorTypeRequest", + "responseType": "AcceleratorType", + "options": { + "(google.api.http).get": "/v2alpha1/{name=projects/*/locations/*/acceleratorTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha1/{name=projects/*/locations/*/acceleratorTypes/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListRuntimeVersions": { + "requestType": "ListRuntimeVersionsRequest", + "responseType": "ListRuntimeVersionsResponse", + "options": { + "(google.api.http).get": "/v2alpha1/{parent=projects/*/locations/*}/runtimeVersions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha1/{parent=projects/*/locations/*}/runtimeVersions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetRuntimeVersion": { + "requestType": "GetRuntimeVersionRequest", + "responseType": "RuntimeVersion", + "options": { + "(google.api.http).get": "/v2alpha1/{name=projects/*/locations/*/runtimeVersions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha1/{name=projects/*/locations/*/runtimeVersions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetGuestAttributes": { + "requestType": "GetGuestAttributesRequest", + "responseType": "GetGuestAttributesResponse", + "options": { + "(google.api.http).post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:getGuestAttributes", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:getGuestAttributes", + "body": "*" + } + } + ] + } + } + }, + "GuestAttributes": { + "fields": { + "queryPath": { + "type": "string", + "id": 1 + }, + "queryValue": { + "type": "GuestAttributesValue", + "id": 2 + } + } + }, + "GuestAttributesValue": { + "fields": { + "items": { + "rule": "repeated", + "type": "GuestAttributesEntry", + "id": 1 + } + } + }, + "GuestAttributesEntry": { + "fields": { + "namespace": { + "type": "string", + "id": 1 + }, + "key": { + "type": "string", + "id": 2 + }, + "value": { + "type": "string", + "id": 3 + } + } + }, + "AttachedDisk": { + "fields": { + "sourceDisk": { + "type": "string", + "id": 3 + }, + "mode": { + "type": "DiskMode", + "id": 4 + } + }, + "nested": { + "DiskMode": { + "values": { + "DISK_MODE_UNSPECIFIED": 0, + "READ_WRITE": 1, + "READ_ONLY": 2 + } + } + } + }, + "SchedulingConfig": { + "fields": { + "preemptible": { + "type": "bool", + "id": 1 + }, + "reserved": { + "type": "bool", + "id": 2 + } + } + }, + "NetworkEndpoint": { + "fields": { + "ipAddress": { + "type": "string", + "id": 1 + }, + "port": { + "type": "int32", + "id": 2 + }, + "accessConfig": { + "type": "AccessConfig", + "id": 5 + } + } + }, + "AccessConfig": { + "fields": { + "externalIp": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "NetworkConfig": { + "fields": { + "network": { + "type": "string", + "id": 1 + }, + "subnetwork": { + "type": "string", + "id": 2 + }, + "enableExternalIps": { + "type": "bool", + "id": 3 + } + } + }, + "ServiceAccount": { + "fields": { + "email": { + "type": "string", + "id": 1 + }, + "scope": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "Node": { + "options": { + "(google.api.resource).type": "tpu.googleapis.com/Node", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/nodes/{node}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "description": { + "type": "string", + "id": 3 + }, + "acceleratorType": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "state": { + "type": "State", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "healthDescription": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "runtimeVersion": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "networkConfig": { + "type": "NetworkConfig", + "id": 36 + }, + "cidrBlock": { + "type": "string", + "id": 13 + }, + "serviceAccount": { + "type": "ServiceAccount", + "id": 37 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 16, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "schedulingConfig": { + "type": "SchedulingConfig", + "id": 17 + }, + "networkEndpoints": { + "rule": "repeated", + "type": "NetworkEndpoint", + "id": 21, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "health": { + "type": "Health", + "id": 22 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 24 + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 34 + }, + "tags": { + "rule": "repeated", + "type": "string", + "id": 40 + }, + "id": { + "type": "int64", + "id": 33, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dataDisks": { + "rule": "repeated", + "type": "AttachedDisk", + "id": 41 + }, + "apiVersion": { + "type": "ApiVersion", + "id": 38, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "symptoms": { + "rule": "repeated", + "type": "Symptom", + "id": 39, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "READY": 2, + "RESTARTING": 3, + "REIMAGING": 4, + "DELETING": 5, + "REPAIRING": 6, + "STOPPED": 8, + "STOPPING": 9, + "STARTING": 10, + "PREEMPTED": 11, + "TERMINATED": 12, + "HIDING": 13, + "HIDDEN": 14, + "UNHIDING": 15 + } + }, + "Health": { + "values": { + "HEALTH_UNSPECIFIED": 0, + "HEALTHY": 1, + "TIMEOUT": 3, + "UNHEALTHY_TENSORFLOW": 4, + "UNHEALTHY_MAINTENANCE": 5 + } + }, + "ApiVersion": { + "values": { + "API_VERSION_UNSPECIFIED": 0, + "V1_ALPHA1": 1, + "V1": 2, + "V2_ALPHA1": 3 + } + } + } + }, + "ListNodesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListNodesResponse": { + "fields": { + "nodes": { + "rule": "repeated", + "type": "Node", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetNodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + } + } + }, + "CreateNodeRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "nodeId": { + "type": "string", + "id": 2 + }, + "node": { + "type": "Node", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteNodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + } + } + }, + "StopNodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "StartNodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "UpdateNodeRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "node": { + "type": "Node", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ServiceIdentity": { + "fields": { + "email": { + "type": "string", + "id": 1 + } + } + }, + "GenerateServiceIdentityRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + } + } + }, + "GenerateServiceIdentityResponse": { + "fields": { + "identity": { + "type": "ServiceIdentity", + "id": 1 + } + } + }, + "AcceleratorType": { + "options": { + "(google.api.resource).type": "tpu.googleapis.com/AcceleratorType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + } + } + }, + "GetAcceleratorTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/AcceleratorType" + } + } + } + }, + "ListAcceleratorTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/AcceleratorType" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 5 + }, + "orderBy": { + "type": "string", + "id": 6 + } + } + }, + "ListAcceleratorTypesResponse": { + "fields": { + "acceleratorTypes": { + "rule": "repeated", + "type": "AcceleratorType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "OperationMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "target": { + "type": "string", + "id": 3 + }, + "verb": { + "type": "string", + "id": 4 + }, + "statusDetail": { + "type": "string", + "id": 5 + }, + "cancelRequested": { + "type": "bool", + "id": 6 + }, + "apiVersion": { + "type": "string", + "id": 7 + } + } + }, + "RuntimeVersion": { + "options": { + "(google.api.resource).type": "tpu.googleapis.com/RuntimeVersion", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/runtimeVersions/{runtime_version}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "version": { + "type": "string", + "id": 2 + } + } + }, + "GetRuntimeVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/RuntimeVersion" + } + } + } + }, + "ListRuntimeVersionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/RuntimeVersion" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 5 + }, + "orderBy": { + "type": "string", + "id": 6 + } + } + }, + "ListRuntimeVersionsResponse": { + "fields": { + "runtimeVersions": { + "rule": "repeated", + "type": "RuntimeVersion", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "Symptom": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "symptomType": { + "type": "SymptomType", + "id": 2 + }, + "details": { + "type": "string", + "id": 3 + }, + "workerId": { + "type": "string", + "id": 4 + } + }, + "nested": { + "SymptomType": { + "values": { + "SYMPTOM_TYPE_UNSPECIFIED": 0, + "LOW_MEMORY": 1, + "OUT_OF_MEMORY": 2, + "EXECUTE_TIMED_OUT": 3, + "MESH_BUILD_FAIL": 4, + "HBM_OUT_OF_MEMORY": 5, + "PROJECT_ABUSE": 6 + } + } + } + }, + "GetGuestAttributesRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + }, + "queryPath": { + "type": "string", + "id": 2 + }, + "workerIds": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetGuestAttributesResponse": { + "fields": { + "guestAttributes": { + "rule": "repeated", + "type": "GuestAttributes", + "id": 1 + } + } + } + } } } } @@ -1929,6 +2895,15 @@ "id": 2 } } + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } } } }, diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.create_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.create_node.js new file mode 100644 index 00000000000..eb31b9f0991 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.create_node.js @@ -0,0 +1,62 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(parent, node) { + // [START tpu_v1_generated_Tpu_CreateNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. + */ + // const parent = 'abc123' + /** + * The unqualified resource name. + */ + // const nodeId = 'abc123' + /** + * Required. The node. + */ + // const node = '' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function createNode() { + // Construct request + const request = { + parent, + node, + }; + + // Run request + const [operation] = await tpuClient.createNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + createNode(); + // [END tpu_v1_generated_Tpu_CreateNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.delete_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.delete_node.js new file mode 100644 index 00000000000..d7185b27897 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.delete_node.js @@ -0,0 +1,53 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(name) { + // [START tpu_v1_generated_Tpu_DeleteNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function deleteNode() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.deleteNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + deleteNode(); + // [END tpu_v1_generated_Tpu_DeleteNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.get_accelerator_type.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_accelerator_type.js new file mode 100644 index 00000000000..74a495dbfc1 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_accelerator_type.js @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(name) { + // [START tpu_v1_generated_Tpu_GetAcceleratorType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function getAcceleratorType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getAcceleratorType(request); + console.log(response); + } + + getAcceleratorType(); + // [END tpu_v1_generated_Tpu_GetAcceleratorType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.get_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_node.js new file mode 100644 index 00000000000..25769a1f20f --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_node.js @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(name) { + // [START tpu_v1_generated_Tpu_GetNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function getNode() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getNode(request); + console.log(response); + } + + getNode(); + // [END tpu_v1_generated_Tpu_GetNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.get_tensor_flow_version.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_tensor_flow_version.js new file mode 100644 index 00000000000..8ba7aeadf43 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_tensor_flow_version.js @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(name) { + // [START tpu_v1_generated_Tpu_GetTensorFlowVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function getTensorFlowVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getTensorFlowVersion(request); + console.log(response); + } + + getTensorFlowVersion(); + // [END tpu_v1_generated_Tpu_GetTensorFlowVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.list_accelerator_types.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_accelerator_types.js new file mode 100644 index 00000000000..5ba014171fd --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_accelerator_types.js @@ -0,0 +1,70 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(parent) { + // [START tpu_v1_generated_Tpu_ListAcceleratorTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function listAcceleratorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listAcceleratorTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listAcceleratorTypes(); + // [END tpu_v1_generated_Tpu_ListAcceleratorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.list_nodes.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_nodes.js new file mode 100644 index 00000000000..39e173fdd2c --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_nodes.js @@ -0,0 +1,62 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(parent) { + // [START tpu_v1_generated_Tpu_ListNodes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function listNodes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listNodesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listNodes(); + // [END tpu_v1_generated_Tpu_ListNodes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.list_tensor_flow_versions.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_tensor_flow_versions.js new file mode 100644 index 00000000000..ea1cae5fc05 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_tensor_flow_versions.js @@ -0,0 +1,70 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(parent) { + // [START tpu_v1_generated_Tpu_ListTensorFlowVersions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function listTensorFlowVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listTensorFlowVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listTensorFlowVersions(); + // [END tpu_v1_generated_Tpu_ListTensorFlowVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.reimage_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.reimage_node.js new file mode 100644 index 00000000000..5e9e2409394 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.reimage_node.js @@ -0,0 +1,55 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main() { + // [START tpu_v1_generated_Tpu_ReimageNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The resource name. + */ + // const name = 'abc123' + /** + * The version for reimage to create. + */ + // const tensorflowVersion = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function reimageNode() { + // Construct request + const request = {}; + + // Run request + const [operation] = await tpuClient.reimageNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + reimageNode(); + // [END tpu_v1_generated_Tpu_ReimageNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.start_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.start_node.js new file mode 100644 index 00000000000..beecd52a8d0 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.start_node.js @@ -0,0 +1,51 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main() { + // [START tpu_v1_generated_Tpu_StartNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function startNode() { + // Construct request + const request = {}; + + // Run request + const [operation] = await tpuClient.startNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + startNode(); + // [END tpu_v1_generated_Tpu_StartNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.stop_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.stop_node.js new file mode 100644 index 00000000000..963173ecf98 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.stop_node.js @@ -0,0 +1,51 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main() { + // [START tpu_v1_generated_Tpu_StopNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function stopNode() { + // Construct request + const request = {}; + + // Run request + const [operation] = await tpuClient.stopNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + stopNode(); + // [END tpu_v1_generated_Tpu_StopNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js new file mode 100644 index 00000000000..507b72e7c25 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js @@ -0,0 +1,62 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(parent, node) { + // [START tpu_v2alpha1_generated_Tpu_CreateNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. + */ + // const parent = 'abc123' + /** + * The unqualified resource name. + */ + // const nodeId = 'abc123' + /** + * Required. The node. + */ + // const node = '' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function createNode() { + // Construct request + const request = { + parent, + node, + }; + + // Run request + const [operation] = await tpuClient.createNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + createNode(); + // [END tpu_v2alpha1_generated_Tpu_CreateNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js new file mode 100644 index 00000000000..c5ac7c60c14 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js @@ -0,0 +1,53 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_DeleteNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function deleteNode() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.deleteNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + deleteNode(); + // [END tpu_v2alpha1_generated_Tpu_DeleteNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js new file mode 100644 index 00000000000..d9bba662d66 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. + */ + // const parent = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function generateServiceIdentity() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await tpuClient.generateServiceIdentity(request); + console.log(response); + } + + generateServiceIdentity(); + // [END tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_accelerator_type.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_accelerator_type.js new file mode 100644 index 00000000000..ee6a8d4d2a8 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_accelerator_type.js @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_GetAcceleratorType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function getAcceleratorType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getAcceleratorType(request); + console.log(response); + } + + getAcceleratorType(); + // [END tpu_v2alpha1_generated_Tpu_GetAcceleratorType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_guest_attributes.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_guest_attributes.js new file mode 100644 index 00000000000..1284d2787df --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_guest_attributes.js @@ -0,0 +1,61 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_GetGuestAttributes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + /** + * The guest attributes path to be queried. + */ + // const queryPath = 'abc123' + /** + * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + * returned. + */ + // const workerIds = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function getGuestAttributes() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getGuestAttributes(request); + console.log(response); + } + + getGuestAttributes(); + // [END tpu_v2alpha1_generated_Tpu_GetGuestAttributes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_node.js new file mode 100644 index 00000000000..0d8473c5c90 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_node.js @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_GetNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function getNode() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getNode(request); + console.log(response); + } + + getNode(); + // [END tpu_v2alpha1_generated_Tpu_GetNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js new file mode 100644 index 00000000000..9e698f1a7f0 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function getRuntimeVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getRuntimeVersion(request); + console.log(response); + } + + getRuntimeVersion(); + // [END tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js new file mode 100644 index 00000000000..030fccf59dd --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js @@ -0,0 +1,70 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function listAcceleratorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listAcceleratorTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listAcceleratorTypes(); + // [END tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js new file mode 100644 index 00000000000..f3da5c19533 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js @@ -0,0 +1,62 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_ListNodes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function listNodes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listNodesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listNodes(); + // [END tpu_v2alpha1_generated_Tpu_ListNodes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js new file mode 100644 index 00000000000..d4e013d5495 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js @@ -0,0 +1,70 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function listRuntimeVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listRuntimeVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listRuntimeVersions(); + // [END tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js new file mode 100644 index 00000000000..b5c8fe6bea9 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js @@ -0,0 +1,51 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main() { + // [START tpu_v2alpha1_generated_Tpu_StartNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function startNode() { + // Construct request + const request = {}; + + // Run request + const [operation] = await tpuClient.startNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + startNode(); + // [END tpu_v2alpha1_generated_Tpu_StartNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js new file mode 100644 index 00000000000..0d1994d9e26 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js @@ -0,0 +1,51 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main() { + // [START tpu_v2alpha1_generated_Tpu_StopNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function stopNode() { + // Construct request + const request = {}; + + // Run request + const [operation] = await tpuClient.stopNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + stopNode(); + // [END tpu_v2alpha1_generated_Tpu_StopNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js new file mode 100644 index 00000000000..698039baa16 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js @@ -0,0 +1,59 @@ +// Copyright 2021 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 +// +// http://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. + +'use strict'; + +function main(updateMask, node) { + // [START tpu_v2alpha1_generated_Tpu_UpdateNode_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Mask of fields from [Node][Tpu.Node] to update. + * Supported fields: None. + */ + // const updateMask = '' + /** + * Required. The node. Only fields specified in update_mask are updated. + */ + // const node = '' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function updateNode() { + // Construct request + const request = { + updateMask, + node, + }; + + // Run request + const [operation] = await tpuClient.updateNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + updateNode(); + // [END tpu_v2alpha1_generated_Tpu_UpdateNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-tpu/src/index.ts b/packages/google-cloud-tpu/src/index.ts index 388fbb203e2..0178790f2a9 100644 --- a/packages/google-cloud-tpu/src/index.ts +++ b/packages/google-cloud-tpu/src/index.ts @@ -17,11 +17,12 @@ // ** All changes to this file may be overwritten. ** import * as v1 from './v1'; +import * as v2alpha1 from './v2alpha1'; const TpuClient = v1.TpuClient; type TpuClient = v1.TpuClient; -export {v1, TpuClient}; -export default {v1, TpuClient}; +export {v1, v2alpha1, TpuClient}; +export default {v1, v2alpha1, TpuClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-tpu/src/v1/tpu_client.ts b/packages/google-cloud-tpu/src/v1/tpu_client.ts index 8b2a7e18e25..c16cace7a4d 100644 --- a/packages/google-cloud-tpu/src/v1/tpu_client.ts +++ b/packages/google-cloud-tpu/src/v1/tpu_client.ts @@ -1519,7 +1519,8 @@ export class TpuClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listNodes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listNodes.createStream( this.innerApiCalls.listNodes as gax.GaxCall, @@ -1569,7 +1570,8 @@ export class TpuClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listNodes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listNodes.asyncIterate( this.innerApiCalls['listNodes'] as GaxCall, @@ -1722,7 +1724,8 @@ export class TpuClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listTensorFlowVersions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listTensorFlowVersions.createStream( this.innerApiCalls.listTensorFlowVersions as gax.GaxCall, @@ -1776,7 +1779,8 @@ export class TpuClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listTensorFlowVersions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listTensorFlowVersions.asyncIterate( this.innerApiCalls['listTensorFlowVersions'] as GaxCall, @@ -1925,7 +1929,8 @@ export class TpuClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAcceleratorTypes.createStream( this.innerApiCalls.listAcceleratorTypes as gax.GaxCall, @@ -1979,7 +1984,8 @@ export class TpuClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAcceleratorTypes.asyncIterate( this.innerApiCalls['listAcceleratorTypes'] as GaxCall, diff --git a/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json b/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json new file mode 100644 index 00000000000..d4f743c1646 --- /dev/null +++ b/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json @@ -0,0 +1,165 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.tpu.v2alpha1", + "libraryPackage": "@google-cloud/tpu", + "services": { + "Tpu": { + "clients": { + "grpc": { + "libraryClient": "TpuClient", + "rpcs": { + "GetNode": { + "methods": [ + "getNode" + ] + }, + "GenerateServiceIdentity": { + "methods": [ + "generateServiceIdentity" + ] + }, + "GetAcceleratorType": { + "methods": [ + "getAcceleratorType" + ] + }, + "GetRuntimeVersion": { + "methods": [ + "getRuntimeVersion" + ] + }, + "GetGuestAttributes": { + "methods": [ + "getGuestAttributes" + ] + }, + "CreateNode": { + "methods": [ + "createNode" + ] + }, + "DeleteNode": { + "methods": [ + "deleteNode" + ] + }, + "StopNode": { + "methods": [ + "stopNode" + ] + }, + "StartNode": { + "methods": [ + "startNode" + ] + }, + "UpdateNode": { + "methods": [ + "updateNode" + ] + }, + "ListNodes": { + "methods": [ + "listNodes", + "listNodesStream", + "listNodesAsync" + ] + }, + "ListAcceleratorTypes": { + "methods": [ + "listAcceleratorTypes", + "listAcceleratorTypesStream", + "listAcceleratorTypesAsync" + ] + }, + "ListRuntimeVersions": { + "methods": [ + "listRuntimeVersions", + "listRuntimeVersionsStream", + "listRuntimeVersionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TpuClient", + "rpcs": { + "GetNode": { + "methods": [ + "getNode" + ] + }, + "GenerateServiceIdentity": { + "methods": [ + "generateServiceIdentity" + ] + }, + "GetAcceleratorType": { + "methods": [ + "getAcceleratorType" + ] + }, + "GetRuntimeVersion": { + "methods": [ + "getRuntimeVersion" + ] + }, + "GetGuestAttributes": { + "methods": [ + "getGuestAttributes" + ] + }, + "CreateNode": { + "methods": [ + "createNode" + ] + }, + "DeleteNode": { + "methods": [ + "deleteNode" + ] + }, + "StopNode": { + "methods": [ + "stopNode" + ] + }, + "StartNode": { + "methods": [ + "startNode" + ] + }, + "UpdateNode": { + "methods": [ + "updateNode" + ] + }, + "ListNodes": { + "methods": [ + "listNodes", + "listNodesStream", + "listNodesAsync" + ] + }, + "ListAcceleratorTypes": { + "methods": [ + "listAcceleratorTypes", + "listAcceleratorTypesStream", + "listAcceleratorTypesAsync" + ] + }, + "ListRuntimeVersions": { + "methods": [ + "listRuntimeVersions", + "listRuntimeVersionsStream", + "listRuntimeVersionsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-tpu/src/v2alpha1/index.ts b/packages/google-cloud-tpu/src/v2alpha1/index.ts new file mode 100644 index 00000000000..95996c1bc03 --- /dev/null +++ b/packages/google-cloud-tpu/src/v2alpha1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2021 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. ** + +export {TpuClient} from './tpu_client'; diff --git a/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts b/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts new file mode 100644 index 00000000000..de1649cfc1c --- /dev/null +++ b/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts @@ -0,0 +1,2421 @@ +// Copyright 2021 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. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2alpha1/tpu_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './tpu_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Manages TPU nodes and other resources + * + * TPU API v2alpha1 + * @class + * @memberof v2alpha1 + */ +export class TpuClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + tpuStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TpuClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof TpuClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + acceleratorTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + nodePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/nodes/{node}' + ), + runtimeVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/runtimeVersions/{runtime_version}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listNodes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'nodes' + ), + listAcceleratorTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'acceleratorTypes' + ), + listRuntimeVersions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'runtimeVersions' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const createNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node' + ) as gax.protobuf.Type; + const createNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; + const deleteNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node' + ) as gax.protobuf.Type; + const deleteNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; + const stopNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node' + ) as gax.protobuf.Type; + const stopNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; + const startNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node' + ) as gax.protobuf.Type; + const startNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; + const updateNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node' + ) as gax.protobuf.Type; + const updateNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createNodeResponse.decode.bind(createNodeResponse), + createNodeMetadata.decode.bind(createNodeMetadata) + ), + deleteNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteNodeResponse.decode.bind(deleteNodeResponse), + deleteNodeMetadata.decode.bind(deleteNodeMetadata) + ), + stopNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + stopNodeResponse.decode.bind(stopNodeResponse), + stopNodeMetadata.decode.bind(stopNodeMetadata) + ), + startNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + startNodeResponse.decode.bind(startNodeResponse), + startNodeMetadata.decode.bind(startNodeMetadata) + ), + updateNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateNodeResponse.decode.bind(updateNodeResponse), + updateNodeMetadata.decode.bind(updateNodeMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.tpu.v2alpha1.Tpu', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.tpuStub) { + return this.tpuStub; + } + + // Put together the "service stub" for + // google.cloud.tpu.v2alpha1.Tpu. + this.tpuStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.tpu.v2alpha1.Tpu' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.tpu.v2alpha1.Tpu, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const tpuStubMethods = [ + 'listNodes', + 'getNode', + 'createNode', + 'deleteNode', + 'stopNode', + 'startNode', + 'updateNode', + 'generateServiceIdentity', + 'listAcceleratorTypes', + 'getAcceleratorType', + 'listRuntimeVersions', + 'getRuntimeVersion', + 'getGuestAttributes', + ]; + for (const methodName of tpuStubMethods) { + const callPromise = this.tpuStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.tpuStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'tpu.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'tpu.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getNode( + request?: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest | undefined, + {} | undefined + ] + >; + getNode( + request: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest | null | undefined, + {} | null | undefined + > + ): void; + getNode( + request: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Gets the details of a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 an object representing [Node]{@link google.cloud.tpu.v2alpha1.Node}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getNode(request); + */ + getNode( + request?: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest | undefined, + {} | undefined + ] + > | 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({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getNode(request, options, callback); + } + generateServiceIdentity( + request?: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + ( + | protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest + | undefined + ), + {} | undefined + ] + >; + generateServiceIdentity( + request: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + | protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateServiceIdentity( + request: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + | protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Generates the Cloud TPU service identity for the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @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 an object representing [GenerateServiceIdentityResponse]{@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.generateServiceIdentity(request); + */ + generateServiceIdentity( + request?: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + | protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + | protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + ( + | protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest + | undefined + ), + {} | undefined + ] + > | 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.generateServiceIdentity( + request, + options, + callback + ); + } + getAcceleratorType( + request?: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest | undefined, + {} | undefined + ] + >; + getAcceleratorType( + request: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + | protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAcceleratorType( + request: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + | protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets AcceleratorType. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 an object representing [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getAcceleratorType(request); + */ + getAcceleratorType( + request?: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + | protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + | protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest | undefined, + {} | undefined + ] + > | 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({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getAcceleratorType(request, options, callback); + } + getRuntimeVersion( + request?: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest | undefined, + {} | undefined + ] + >; + getRuntimeVersion( + request: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + | protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getRuntimeVersion( + request: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + | protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a runtime version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 an object representing [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getRuntimeVersion(request); + */ + getRuntimeVersion( + request?: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + | protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + | protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest | undefined, + {} | undefined + ] + > | 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({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getRuntimeVersion(request, options, callback); + } + getGuestAttributes( + request?: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest | undefined, + {} | undefined + ] + >; + getGuestAttributes( + request: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + | protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getGuestAttributes( + request: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + | protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the guest attributes for the node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @param {string} request.queryPath + * The guest attributes path to be queried. + * @param {string[]} request.workerIds + * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + * returned. + * @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 an object representing [GetGuestAttributesResponse]{@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getGuestAttributes(request); + */ + getGuestAttributes( + request?: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + | protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + | protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest | undefined, + {} | undefined + ] + > | 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({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getGuestAttributes(request, options, callback); + } + + createNode( + request?: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createNode( + request: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createNode( + request: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {string} request.nodeId + * The unqualified resource name. + * @param {google.cloud.tpu.v2alpha1.Node} request.node + * Required. The node. + * @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 an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.createNode(request); + * const [response] = await operation.promise(); + */ + createNode( + request?: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | 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.createNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createNode()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkCreateNodeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkCreateNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createNode, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; + } + deleteNode( + request?: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteNode( + request: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteNode( + request: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.deleteNode(request); + * const [response] = await operation.promise(); + */ + deleteNode( + request?: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | 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({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteNode()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkDeleteNodeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkDeleteNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteNode, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; + } + stopNode( + request?: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + stopNode( + request: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + stopNode( + request: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Stops a node. This operation is only available with single TPU nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource name. + * @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 an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.stopNode(request); + * const [response] = await operation.promise(); + */ + stopNode( + request?: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | 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({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.stopNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `stopNode()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkStopNodeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkStopNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.stopNode, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; + } + startNode( + request?: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + startNode( + request: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + startNode( + request: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Starts a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource name. + * @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 an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.startNode(request); + * const [response] = await operation.promise(); + */ + startNode( + request?: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | 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({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.startNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `startNode()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkStartNodeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkStartNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.startNode, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; + } + updateNode( + request?: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateNode( + request: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateNode( + request: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the configurations of a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields from {@link Tpu.Node|Node} to update. + * Supported fields: None. + * @param {google.cloud.tpu.v2alpha1.Node} request.node + * Required. The node. Only fields specified in update_mask are updated. + * @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 an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.updateNode(request); + * const [response] = await operation.promise(); + */ + updateNode( + request?: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | 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({ + 'node.name': request.node!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateNode()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkUpdateNodeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkUpdateNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateNode, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; + } + listNodes( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.INode[], + protos.google.cloud.tpu.v2alpha1.IListNodesRequest | null, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse + ] + >; + listNodes( + request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2alpha1.INode + > + ): void; + listNodes( + request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2alpha1.INode + > + ): void; + /** + * Lists nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node}. + * 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 `listNodesAsync()` + * 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. + */ + listNodes( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + | protos.google.cloud.tpu.v2alpha1.IListNodesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.INode + >, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2alpha1.INode + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.INode[], + protos.google.cloud.tpu.v2alpha1.IListNodesRequest | null, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse + ] + > | 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.listNodes(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 parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node} 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 `listNodesAsync()` + * 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. + */ + listNodesStream( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.createStream( + this.innerApiCalls.listNodes as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listNodes`, 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 parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 + * [Node]{@link google.cloud.tpu.v2alpha1.Node}. 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 + * const iterable = client.listNodesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listNodesAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + 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 || '', + }); + options = options || {}; + const defaultCallSettings = this._defaults['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.asyncIterate( + this.innerApiCalls['listNodes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IAcceleratorType[], + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest | null, + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse + ] + >; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + | protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IAcceleratorType + > + ): void; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + | protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IAcceleratorType + > + ): void; + /** + * Lists accelerator types supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort results. + * @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 [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType}. + * 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + | protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IAcceleratorType + >, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + | protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IAcceleratorType + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IAcceleratorType[], + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest | null, + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse + ] + > | 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.listAcceleratorTypes(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 parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort results. + * @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 [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType} 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypesStream( + request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + 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['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.createStream( + this.innerApiCalls.listAcceleratorTypes as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listAcceleratorTypes`, 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 parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort results. + * @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 + * [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType}. 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 + * const iterable = client.listAcceleratorTypesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listAcceleratorTypesAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + 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 || '', + }); + options = options || {}; + const defaultCallSettings = this._defaults['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.asyncIterate( + this.innerApiCalls['listAcceleratorTypes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listRuntimeVersions( + request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[], + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest | null, + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse + ] + >; + listRuntimeVersions( + request: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + | protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion + > + ): void; + listRuntimeVersions( + request: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + | protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion + > + ): void; + /** + * Lists runtime versions supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort results. + * @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 [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion}. + * 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 `listRuntimeVersionsAsync()` + * 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. + */ + listRuntimeVersions( + request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + | protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion + >, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + | protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[], + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest | null, + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse + ] + > | 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.listRuntimeVersions(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 parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort results. + * @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 [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion} 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 `listRuntimeVersionsAsync()` + * 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. + */ + listRuntimeVersionsStream( + request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + 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['listRuntimeVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRuntimeVersions.createStream( + this.innerApiCalls.listRuntimeVersions as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listRuntimeVersions`, 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 parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort results. + * @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 + * [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion}. 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 + * const iterable = client.listRuntimeVersionsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listRuntimeVersionsAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + 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 || '', + }); + options = options || {}; + const defaultCallSettings = this._defaults['listRuntimeVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRuntimeVersions.asyncIterate( + this.innerApiCalls['listRuntimeVersions'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified acceleratorType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} accelerator_type + * @returns {string} Resource name string. + */ + acceleratorTypePath( + project: string, + location: string, + acceleratorType: string + ) { + return this.pathTemplates.acceleratorTypePathTemplate.render({ + project: project, + location: location, + accelerator_type: acceleratorType, + }); + } + + /** + * Parse the project from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match( + acceleratorTypeName + ).project; + } + + /** + * Parse the location from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match( + acceleratorTypeName + ).location; + } + + /** + * Parse the accelerator_type from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the accelerator_type. + */ + matchAcceleratorTypeFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match( + acceleratorTypeName + ).accelerator_type; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified node resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} node + * @returns {string} Resource name string. + */ + nodePath(project: string, location: string, node: string) { + return this.pathTemplates.nodePathTemplate.render({ + project: project, + location: location, + node: node, + }); + } + + /** + * Parse the project from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).project; + } + + /** + * Parse the location from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the location. + */ + matchLocationFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).location; + } + + /** + * Parse the node from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the node. + */ + matchNodeFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).node; + } + + /** + * Return a fully-qualified runtimeVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} runtime_version + * @returns {string} Resource name string. + */ + runtimeVersionPath( + project: string, + location: string, + runtimeVersion: string + ) { + return this.pathTemplates.runtimeVersionPathTemplate.render({ + project: project, + location: location, + runtime_version: runtimeVersion, + }); + } + + /** + * Parse the project from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match( + runtimeVersionName + ).project; + } + + /** + * Parse the location from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match( + runtimeVersionName + ).location; + } + + /** + * Parse the runtime_version from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the runtime_version. + */ + matchRuntimeVersionFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match( + runtimeVersionName + ).runtime_version; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.tpuStub!.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json b/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json new file mode 100644 index 00000000000..d268f63d19d --- /dev/null +++ b/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json @@ -0,0 +1,91 @@ +{ + "interfaces": { + "google.cloud.tpu.v2alpha1.Tpu": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListNodes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StopNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateServiceIdentity": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAcceleratorTypes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAcceleratorType": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimeVersions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetRuntimeVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetGuestAttributes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-tpu/src/v2alpha1/tpu_proto_list.json b/packages/google-cloud-tpu/src/v2alpha1/tpu_proto_list.json new file mode 100644 index 00000000000..17217f28408 --- /dev/null +++ b/packages/google-cloud-tpu/src/v2alpha1/tpu_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto" +] diff --git a/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts b/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts new file mode 100644 index 00000000000..b5b4daaf638 --- /dev/null +++ b/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts @@ -0,0 +1,2870 @@ +// Copyright 2021 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as tpuModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2alpha1.TpuClient', () => { + it('has servicePath', () => { + const servicePath = tpuModule.v2alpha1.TpuClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tpuModule.v2alpha1.TpuClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tpuModule.v2alpha1.TpuClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new tpuModule.v2alpha1.TpuClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new tpuModule.v2alpha1.TpuClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + await client.initialize(); + assert(client.tpuStub); + }); + + it('has close method', () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getNode', () => { + it('invokes getNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.Node() + ); + client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); + const [response] = await client.getNode(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.Node() + ); + client.innerApiCalls.getNode = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNode( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.INode | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getNode with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNode(request), expectedError); + assert( + (client.innerApiCalls.getNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('generateServiceIdentity', () => { + it('invokes generateServiceIdentity without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse() + ); + client.innerApiCalls.generateServiceIdentity = + stubSimpleCall(expectedResponse); + const [response] = await client.generateServiceIdentity(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateServiceIdentity without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse() + ); + client.innerApiCalls.generateServiceIdentity = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateServiceIdentity( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes generateServiceIdentity with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateServiceIdentity = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.generateServiceIdentity(request), + expectedError + ); + assert( + (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getAcceleratorType', () => { + it('invokes getAcceleratorType without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = + stubSimpleCall(expectedResponse); + const [response] = await client.getAcceleratorType(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getAcceleratorType without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAcceleratorType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getAcceleratorType with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAcceleratorType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getAcceleratorType(request), expectedError); + assert( + (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getRuntimeVersion', () => { + it('invokes getRuntimeVersion without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ); + client.innerApiCalls.getRuntimeVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getRuntimeVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getRuntimeVersion without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ); + client.innerApiCalls.getRuntimeVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRuntimeVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getRuntimeVersion with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getRuntimeVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getRuntimeVersion(request), expectedError); + assert( + (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getGuestAttributes', () => { + it('invokes getGuestAttributes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse() + ); + client.innerApiCalls.getGuestAttributes = + stubSimpleCall(expectedResponse); + const [response] = await client.getGuestAttributes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getGuestAttributes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse() + ); + client.innerApiCalls.getGuestAttributes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGuestAttributes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getGuestAttributes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getGuestAttributes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getGuestAttributes(request), expectedError); + assert( + (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createNode', () => { + it('invokes createNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.createNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createNode(request), expectedError); + assert( + (client.innerApiCalls.createNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createNode(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkCreateNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteNode', () => { + it('invokes deleteNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteNode(request), expectedError); + assert( + (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteNode(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkDeleteNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('stopNode', () => { + it('invokes stopNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.stopNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.stopNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes stopNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.stopNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes stopNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.stopNode(request), expectedError); + assert( + (client.innerApiCalls.stopNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes stopNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.stopNode(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.stopNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkStopNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkStopNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStopNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkStopNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('startNode', () => { + it('invokes startNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.startNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.startNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes startNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.startNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes startNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.startNode(request), expectedError); + assert( + (client.innerApiCalls.startNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes startNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.startNode(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.startNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkStartNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkStartNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStartNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkStartNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateNode', () => { + it('invokes updateNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() + ); + request.node = {}; + request.node.name = ''; + const expectedHeaderRequestParams = 'node.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() + ); + request.node = {}; + request.node.name = ''; + const expectedHeaderRequestParams = 'node.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() + ); + request.node = {}; + request.node.name = ''; + const expectedHeaderRequestParams = 'node.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateNode(request), expectedError); + assert( + (client.innerApiCalls.updateNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() + ); + request.node = {}; + request.node.name = ''; + const expectedHeaderRequestParams = 'node.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateNode(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateNode as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkUpdateNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listNodes', () => { + it('invokes listNodes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listNodes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listNodes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.innerApiCalls.listNodes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.INode[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listNodes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listNodes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodes(request), expectedError); + assert( + (client.innerApiCalls.listNodes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listNodesStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.descriptors.page.listNodes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { + 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.listNodes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodes, request) + ); + assert.strictEqual( + (client.descriptors.page.listNodes.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listNodesStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodes, request) + ); + assert.strictEqual( + (client.descriptors.page.listNodes.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNodes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.descriptors.page.listNodes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; + const iterable = client.listNodesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNodes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listNodesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listAcceleratorTypes', () => { + it('invokes listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.innerApiCalls.listAcceleratorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listAcceleratorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listAcceleratorTypes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.innerApiCalls.listAcceleratorTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAcceleratorTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listAcceleratorTypes(request), expectedError); + assert( + (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listAcceleratorTypesStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.descriptors.page.listAcceleratorTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + 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.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listAcceleratorTypes.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAcceleratorTypesStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listAcceleratorTypes.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.descriptors.page.listAcceleratorTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = []; + const iterable = client.listAcceleratorTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAcceleratorTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listRuntimeVersions', () => { + it('invokes listRuntimeVersions without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + ]; + client.innerApiCalls.listRuntimeVersions = + stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimeVersions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimeVersions without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + ]; + client.innerApiCalls.listRuntimeVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimeVersions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listRuntimeVersions with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimeVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listRuntimeVersions(request), expectedError); + assert( + (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimeVersionsStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + ]; + client.descriptors.page.listRuntimeVersions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listRuntimeVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { + 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.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listRuntimeVersions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listRuntimeVersions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listRuntimeVersionsStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listRuntimeVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listRuntimeVersions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listRuntimeVersions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listRuntimeVersions without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + ]; + client.descriptors.page.listRuntimeVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; + const iterable = client.listRuntimeVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listRuntimeVersions with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRuntimeVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('acceleratorType', () => { + const fakePath = '/rendered/path/acceleratorType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + accelerator_type: 'acceleratorTypeValue', + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.acceleratorTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.acceleratorTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('acceleratorTypePath', () => { + const result = client.acceleratorTypePath( + 'projectValue', + 'locationValue', + 'acceleratorTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.acceleratorTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAcceleratorTypeName', () => { + const result = client.matchProjectFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAcceleratorTypeName', () => { + const result = client.matchLocationFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAcceleratorTypeFromAcceleratorTypeName', () => { + const result = + client.matchAcceleratorTypeFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, 'acceleratorTypeValue'); + assert( + (client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('node', () => { + const fakePath = '/rendered/path/node'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + node: 'nodeValue', + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.nodePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('nodePath', () => { + const result = client.nodePath( + 'projectValue', + 'locationValue', + 'nodeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.nodePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromNodeName', () => { + const result = client.matchProjectFromNodeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromNodeName', () => { + const result = client.matchLocationFromNodeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNodeFromNodeName', () => { + const result = client.matchNodeFromNodeName(fakePath); + assert.strictEqual(result, 'nodeValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('runtimeVersion', () => { + const fakePath = '/rendered/path/runtimeVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + runtime_version: 'runtimeVersionValue', + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.runtimeVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.runtimeVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('runtimeVersionPath', () => { + const result = client.runtimeVersionPath( + 'projectValue', + 'locationValue', + 'runtimeVersionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.runtimeVersionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromRuntimeVersionName', () => { + const result = client.matchProjectFromRuntimeVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromRuntimeVersionName', () => { + const result = client.matchLocationFromRuntimeVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRuntimeVersionFromRuntimeVersionName', () => { + const result = + client.matchRuntimeVersionFromRuntimeVersionName(fakePath); + assert.strictEqual(result, 'runtimeVersionValue'); + assert( + (client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +});