1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.tpu.v2alpha1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/longrunning/operations.proto";
24import "google/protobuf/duration.proto";
25import "google/protobuf/empty.proto";
26import "google/protobuf/field_mask.proto";
27import "google/protobuf/timestamp.proto";
28import "google/rpc/status.proto";
29import "google/type/interval.proto";
30
31option go_package = "cloud.google.com/go/tpu/apiv2alpha1/tpupb;tpupb";
32option java_multiple_files = true;
33option java_outer_classname = "CloudTpuProto";
34option java_package = "com.google.cloud.tpu.v2alpha1";
35
36// Manages TPU nodes and other resources
37//
38// TPU API v2alpha1
39service Tpu {
40  option (google.api.default_host) = "tpu.googleapis.com";
41  option (google.api.oauth_scopes) =
42      "https://www.googleapis.com/auth/cloud-platform";
43
44  // Lists nodes.
45  rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) {
46    option (google.api.http) = {
47      get: "/v2alpha1/{parent=projects/*/locations/*}/nodes"
48    };
49    option (google.api.method_signature) = "parent";
50  }
51
52  // Gets the details of a node.
53  rpc GetNode(GetNodeRequest) returns (Node) {
54    option (google.api.http) = {
55      get: "/v2alpha1/{name=projects/*/locations/*/nodes/*}"
56    };
57    option (google.api.method_signature) = "name";
58  }
59
60  // Creates a node.
61  rpc CreateNode(CreateNodeRequest) returns (google.longrunning.Operation) {
62    option (google.api.http) = {
63      post: "/v2alpha1/{parent=projects/*/locations/*}/nodes"
64      body: "node"
65    };
66    option (google.api.method_signature) = "parent,node,node_id";
67    option (google.longrunning.operation_info) = {
68      response_type: "Node"
69      metadata_type: "OperationMetadata"
70    };
71  }
72
73  // Deletes a node.
74  rpc DeleteNode(DeleteNodeRequest) returns (google.longrunning.Operation) {
75    option (google.api.http) = {
76      delete: "/v2alpha1/{name=projects/*/locations/*/nodes/*}"
77    };
78    option (google.api.method_signature) = "name";
79    option (google.longrunning.operation_info) = {
80      response_type: "google.protobuf.Empty"
81      metadata_type: "OperationMetadata"
82    };
83  }
84
85  // Stops a node. This operation is only available with single TPU nodes.
86  rpc StopNode(StopNodeRequest) returns (google.longrunning.Operation) {
87    option (google.api.http) = {
88      post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:stop"
89      body: "*"
90    };
91    option (google.longrunning.operation_info) = {
92      response_type: "Node"
93      metadata_type: "OperationMetadata"
94    };
95  }
96
97  // Starts a node.
98  rpc StartNode(StartNodeRequest) returns (google.longrunning.Operation) {
99    option (google.api.http) = {
100      post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:start"
101      body: "*"
102    };
103    option (google.longrunning.operation_info) = {
104      response_type: "Node"
105      metadata_type: "OperationMetadata"
106    };
107  }
108
109  // Updates the configurations of a node.
110  rpc UpdateNode(UpdateNodeRequest) returns (google.longrunning.Operation) {
111    option (google.api.http) = {
112      patch: "/v2alpha1/{node.name=projects/*/locations/*/nodes/*}"
113      body: "node"
114    };
115    option (google.api.method_signature) = "node,update_mask";
116    option (google.longrunning.operation_info) = {
117      response_type: "Node"
118      metadata_type: "OperationMetadata"
119    };
120  }
121
122  // Lists queued resources.
123  rpc ListQueuedResources(ListQueuedResourcesRequest)
124      returns (ListQueuedResourcesResponse) {
125    option (google.api.http) = {
126      get: "/v2alpha1/{parent=projects/*/locations/*}/queuedResources"
127    };
128    option (google.api.method_signature) = "parent";
129  }
130
131  // Gets details of a queued resource.
132  rpc GetQueuedResource(GetQueuedResourceRequest) returns (QueuedResource) {
133    option (google.api.http) = {
134      get: "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}"
135    };
136    option (google.api.method_signature) = "name";
137  }
138
139  // Creates a QueuedResource TPU instance.
140  rpc CreateQueuedResource(CreateQueuedResourceRequest)
141      returns (google.longrunning.Operation) {
142    option (google.api.http) = {
143      post: "/v2alpha1/{parent=projects/*/locations/*}/queuedResources"
144      body: "queued_resource"
145    };
146    option (google.api.method_signature) =
147        "parent,queued_resource,queued_resource_id";
148    option (google.longrunning.operation_info) = {
149      response_type: "QueuedResource"
150      metadata_type: "OperationMetadata"
151    };
152  }
153
154  // Deletes a QueuedResource TPU instance.
155  rpc DeleteQueuedResource(DeleteQueuedResourceRequest)
156      returns (google.longrunning.Operation) {
157    option (google.api.http) = {
158      delete: "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}"
159    };
160    option (google.api.method_signature) = "name";
161    option (google.longrunning.operation_info) = {
162      response_type: "QueuedResource"
163      metadata_type: "OperationMetadata"
164    };
165  }
166
167  // Generates the Cloud TPU service identity for the project.
168  rpc GenerateServiceIdentity(GenerateServiceIdentityRequest)
169      returns (GenerateServiceIdentityResponse) {
170    option (google.api.http) = {
171      post: "/v2alpha1/{parent=projects/*/locations/*}:generateServiceIdentity"
172      body: "*"
173    };
174  }
175
176  // Lists accelerator types supported by this API.
177  rpc ListAcceleratorTypes(ListAcceleratorTypesRequest)
178      returns (ListAcceleratorTypesResponse) {
179    option (google.api.http) = {
180      get: "/v2alpha1/{parent=projects/*/locations/*}/acceleratorTypes"
181    };
182    option (google.api.method_signature) = "parent";
183  }
184
185  // Gets AcceleratorType.
186  rpc GetAcceleratorType(GetAcceleratorTypeRequest) returns (AcceleratorType) {
187    option (google.api.http) = {
188      get: "/v2alpha1/{name=projects/*/locations/*/acceleratorTypes/*}"
189    };
190    option (google.api.method_signature) = "name";
191  }
192
193  // Lists runtime versions supported by this API.
194  rpc ListRuntimeVersions(ListRuntimeVersionsRequest)
195      returns (ListRuntimeVersionsResponse) {
196    option (google.api.http) = {
197      get: "/v2alpha1/{parent=projects/*/locations/*}/runtimeVersions"
198    };
199    option (google.api.method_signature) = "parent";
200  }
201
202  // Gets a runtime version.
203  rpc GetRuntimeVersion(GetRuntimeVersionRequest) returns (RuntimeVersion) {
204    option (google.api.http) = {
205      get: "/v2alpha1/{name=projects/*/locations/*/runtimeVersions/*}"
206    };
207    option (google.api.method_signature) = "name";
208  }
209
210  // Retrieves the guest attributes for the node.
211  rpc GetGuestAttributes(GetGuestAttributesRequest)
212      returns (GetGuestAttributesResponse) {
213    option (google.api.http) = {
214      post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:getGuestAttributes"
215      body: "*"
216    };
217  }
218
219  // Simulates a maintenance event.
220  rpc SimulateMaintenanceEvent(SimulateMaintenanceEventRequest)
221      returns (google.longrunning.Operation) {
222    option (google.api.http) = {
223      post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:simulateMaintenanceEvent"
224      body: "*"
225    };
226    option (google.longrunning.operation_info) = {
227      response_type: "Node"
228      metadata_type: "OperationMetadata"
229    };
230  }
231}
232
233// A guest attributes.
234message GuestAttributes {
235  // The path to be queried. This can be the default namespace ('/') or a
236  // nested namespace ('/\<namespace\>/') or a specified key
237  // ('/\<namespace\>/\<key\>')
238  string query_path = 1;
239
240  // The value of the requested queried path.
241  GuestAttributesValue query_value = 2;
242}
243
244// Array of guest attribute namespace/key/value tuples.
245message GuestAttributesValue {
246  // The list of guest attributes entries.
247  repeated GuestAttributesEntry items = 1;
248}
249
250// A guest attributes namespace/key/value entry.
251message GuestAttributesEntry {
252  // Namespace for the guest attribute entry.
253  string namespace = 1;
254
255  // Key for the guest attribute entry.
256  string key = 2;
257
258  // Value for the guest attribute entry.
259  string value = 3;
260}
261
262// A node-attached disk resource.
263// Next ID: 8;
264message AttachedDisk {
265  // The different mode of the attached disk.
266  enum DiskMode {
267    // The disk mode is not known/set.
268    DISK_MODE_UNSPECIFIED = 0;
269
270    // Attaches the disk in read-write mode. Only one TPU node can attach a disk
271    // in read-write mode at a time.
272    READ_WRITE = 1;
273
274    // Attaches the disk in read-only mode. Multiple TPU nodes can attach
275    // a disk in read-only mode at a time.
276    READ_ONLY = 2;
277  }
278
279  // Specifies the full path to an existing disk.
280  // For example: "projects/my-project/zones/us-central1-c/disks/my-disk".
281  string source_disk = 3;
282
283  // The mode in which to attach this disk.
284  // If not specified, the default is READ_WRITE mode.
285  // Only applicable to data_disks.
286  DiskMode mode = 4;
287}
288
289// Sets the scheduling options for this node.
290message SchedulingConfig {
291  // Defines whether the node is preemptible.
292  bool preemptible = 1;
293
294  // Whether the node is created under a reservation.
295  bool reserved = 2;
296}
297
298// A network endpoint over which a TPU worker can be reached.
299message NetworkEndpoint {
300  // The internal IP address of this network endpoint.
301  string ip_address = 1;
302
303  // The port of this network endpoint.
304  int32 port = 2;
305
306  // The access config for the TPU worker.
307  AccessConfig access_config = 5;
308}
309
310// An access config attached to the TPU worker.
311message AccessConfig {
312  // Output only. An external IP address associated with the TPU worker.
313  string external_ip = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
314}
315
316// Network related configurations.
317message NetworkConfig {
318  // The name of the network for the TPU node. It must be a preexisting Google
319  // Compute Engine network. If none is provided, "default" will be used.
320  string network = 1;
321
322  // The name of the subnetwork for the TPU node. It must be a preexisting
323  // Google Compute Engine subnetwork. If none is provided, "default" will be
324  // used.
325  string subnetwork = 2;
326
327  // Indicates that external IP addresses would be associated with the TPU
328  // workers. If set to false, the specified subnetwork or network should have
329  // Private Google Access enabled.
330  bool enable_external_ips = 3;
331
332  // Allows the TPU node to send and receive packets with non-matching
333  // destination or source IPs. This is required if you plan to use the TPU
334  // workers to forward routes.
335  bool can_ip_forward = 4;
336}
337
338// A service account.
339message ServiceAccount {
340  // Email address of the service account. If empty, default Compute service
341  // account will be used.
342  string email = 1;
343
344  // The list of scopes to be made available for this service account. If empty,
345  // access to all Cloud APIs will be allowed.
346  repeated string scope = 2;
347}
348
349// A TPU instance.
350message Node {
351  option (google.api.resource) = {
352    type: "tpu.googleapis.com/Node"
353    pattern: "projects/{project}/locations/{location}/nodes/{node}"
354  };
355
356  // Represents the different states of a TPU node during its lifecycle.
357  enum State {
358    // TPU node state is not known/set.
359    STATE_UNSPECIFIED = 0;
360
361    // TPU node is being created.
362    CREATING = 1;
363
364    // TPU node has been created.
365    READY = 2;
366
367    // TPU node is restarting.
368    RESTARTING = 3;
369
370    // TPU node is undergoing reimaging.
371    REIMAGING = 4;
372
373    // TPU node is being deleted.
374    DELETING = 5;
375
376    // TPU node is being repaired and may be unusable. Details can be
377    // found in the 'help_description' field.
378    REPAIRING = 6;
379
380    // TPU node is stopped.
381    STOPPED = 8;
382
383    // TPU node is currently stopping.
384    STOPPING = 9;
385
386    // TPU node is currently starting.
387    STARTING = 10;
388
389    // TPU node has been preempted. Only applies to Preemptible TPU Nodes.
390    PREEMPTED = 11;
391
392    // TPU node has been terminated due to maintenance or has reached the end of
393    // its life cycle (for preemptible nodes).
394    TERMINATED = 12;
395
396    // TPU node is currently hiding.
397    HIDING = 13;
398
399    // TPU node has been hidden.
400    HIDDEN = 14;
401
402    // TPU node is currently unhiding.
403    UNHIDING = 15;
404  }
405
406  // Health defines the status of a TPU node as reported by
407  // Health Monitor.
408  enum Health {
409    // Health status is unknown: not initialized or failed to retrieve.
410    HEALTH_UNSPECIFIED = 0;
411
412    // The resource is healthy.
413    HEALTHY = 1;
414
415    // The resource is unresponsive.
416    TIMEOUT = 3;
417
418    // The in-guest ML stack is unhealthy.
419    UNHEALTHY_TENSORFLOW = 4;
420
421    // The node is under maintenance/priority boost caused rescheduling and
422    // will resume running once rescheduled.
423    UNHEALTHY_MAINTENANCE = 5;
424  }
425
426  // TPU API Version.
427  enum ApiVersion {
428    // API version is unknown.
429    API_VERSION_UNSPECIFIED = 0;
430
431    // TPU API V1Alpha1 version.
432    V1_ALPHA1 = 1;
433
434    // TPU API V1 version.
435    V1 = 2;
436
437    // TPU API V2Alpha1 version.
438    V2_ALPHA1 = 3;
439  }
440
441  // Output only. Immutable. The name of the TPU.
442  string name = 1 [
443    (google.api.field_behavior) = OUTPUT_ONLY,
444    (google.api.field_behavior) = IMMUTABLE
445  ];
446
447  // The user-supplied description of the TPU. Maximum of 512 characters.
448  string description = 3;
449
450  // The type of hardware accelerators associated with this node.
451  string accelerator_type = 5;
452
453  // Output only. The current state for the TPU Node.
454  State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
455
456  // Output only. If this field is populated, it contains a description of why
457  // the TPU Node is unhealthy.
458  string health_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
459
460  // Required. The runtime version running in the Node.
461  string runtime_version = 11 [(google.api.field_behavior) = REQUIRED];
462
463  // Network configurations for the TPU node.
464  NetworkConfig network_config = 36;
465
466  // The CIDR block that the TPU node will use when selecting an IP address.
467  // This CIDR block must be a /29 block; the Compute Engine networks API
468  // forbids a smaller block, and using a larger block would be wasteful (a
469  // node can only consume one IP address). Errors will occur if the CIDR block
470  // has already been used for a currently existing TPU node, the CIDR block
471  // conflicts with any subnetworks in the user's provided network, or the
472  // provided network is peered with another network that is using that CIDR
473  // block.
474  string cidr_block = 13;
475
476  // The Google Cloud Platform Service Account to be used by the TPU node VMs.
477  // If None is specified, the default compute service account will be used.
478  ServiceAccount service_account = 37;
479
480  // Output only. The time when the node was created.
481  google.protobuf.Timestamp create_time = 16
482      [(google.api.field_behavior) = OUTPUT_ONLY];
483
484  // The scheduling options for this node.
485  SchedulingConfig scheduling_config = 17;
486
487  // Output only. The network endpoints where TPU workers can be accessed and
488  // sent work. It is recommended that runtime clients of the node reach out
489  // to the 0th entry in this map first.
490  repeated NetworkEndpoint network_endpoints = 21
491      [(google.api.field_behavior) = OUTPUT_ONLY];
492
493  // The health status of the TPU node.
494  Health health = 22;
495
496  // Resource labels to represent user-provided metadata.
497  map<string, string> labels = 24;
498
499  // Custom metadata to apply to the TPU Node.
500  // Can set startup-script and shutdown-script
501  map<string, string> metadata = 34;
502
503  // Tags to apply to the TPU Node. Tags are used to identify valid sources or
504  // targets for network firewalls.
505  repeated string tags = 40;
506
507  // Output only. The unique identifier for the TPU Node.
508  int64 id = 33 [(google.api.field_behavior) = OUTPUT_ONLY];
509
510  // The additional data disks for the Node.
511  repeated AttachedDisk data_disks = 41;
512
513  // Output only. The API version that created this Node.
514  ApiVersion api_version = 38 [(google.api.field_behavior) = OUTPUT_ONLY];
515
516  // Output only. The Symptoms that have occurred to the TPU Node.
517  repeated Symptom symptoms = 39 [(google.api.field_behavior) = OUTPUT_ONLY];
518
519  // Output only. The qualified name of the QueuedResource that requested this
520  // Node.
521  string queued_resource = 43 [(google.api.field_behavior) = OUTPUT_ONLY];
522
523  // The AccleratorConfig for the TPU Node.
524  AcceleratorConfig accelerator_config = 44;
525
526  // Shielded Instance options.
527  ShieldedInstanceConfig shielded_instance_config = 45;
528}
529
530// A QueuedResource represents a request for resources that will be placed
531// in a queue and fulfilled when the necessary resources are available.
532message QueuedResource {
533  option (google.api.resource) = {
534    type: "tpu.googleapis.com/QueuedResource"
535    pattern: "projects/{project}/locations/{location}/queuedResources/{queued_resource}"
536  };
537
538  // Details of the TPU resource(s) being requested.
539  message Tpu {
540    // Details of the TPU node(s) being requested. Users can request either a
541    // single node or multiple nodes.
542    // NodeSpec provides the specification for node(s) to be created.
543    message NodeSpec {
544      // Required. The parent resource name.
545      string parent = 1 [
546        (google.api.field_behavior) = REQUIRED,
547        (google.api.resource_reference) = {
548          type: "locations.googleapis.com/Location"
549        }
550      ];
551
552      // The unqualified resource name. Should follow the `^[A-Za-z0-9_.~+%-]+$`
553      // regex format. This is only specified when requesting a single node.
554      // In case of multi-node requests, multi_node_params must be populated
555      // instead. It's an error to specify both node_id and multi_node_params.
556      string node_id = 2;
557
558      // Required. The node.
559      Node node = 3 [(google.api.field_behavior) = REQUIRED];
560    }
561
562    // The TPU node(s) being requested.
563    repeated NodeSpec node_spec = 1;
564  }
565
566  // BestEffort tier definition.
567  message BestEffort {}
568
569  // Guaranteed tier definition.
570  message Guaranteed {
571    // Optional. Defines the minimum duration of the guarantee. If specified,
572    // the requested resources will only be provisioned if they can be
573    // allocated for at least the given duration.
574    google.protobuf.Duration min_duration = 1
575        [(google.api.field_behavior) = OPTIONAL];
576
577    // Optional. Specifies the request should be scheduled on reserved capacity.
578    bool reserved = 2 [(google.api.field_behavior) = OPTIONAL];
579  }
580
581  // Defines the policy of the QueuedRequest.
582  message QueueingPolicy {
583    // Time flexibility specification.
584    oneof start_timing_constraints {
585      // A relative time after which resources should not be created.
586      // If the request cannot be fulfilled by this time the request will be
587      // failed.
588      google.protobuf.Duration valid_until_duration = 1;
589
590      // An absolute time after which resources should not be created.
591      // If the request cannot be fulfilled by this time the request will be
592      // failed.
593      google.protobuf.Timestamp valid_until_time = 2;
594
595      // A relative time after which resources may be created.
596      google.protobuf.Duration valid_after_duration = 3;
597
598      // An absolute time at which resources may be created.
599      google.protobuf.Timestamp valid_after_time = 4;
600
601      // An absolute time interval within which resources may be created.
602      google.type.Interval valid_interval = 5;
603    }
604  }
605
606  // Output only. Immutable. The name of the QueuedResource.
607  string name = 1 [
608    (google.api.field_behavior) = OUTPUT_ONLY,
609    (google.api.field_behavior) = IMMUTABLE
610  ];
611
612  // Resource specification.
613  oneof resource {
614    // Defines a TPU resource.
615    Tpu tpu = 2;
616  }
617
618  // Tier specifies the required tier.
619  oneof tier {
620    // The BestEffort tier.
621    BestEffort best_effort = 3;
622
623    // The Guaranteed tier
624    Guaranteed guaranteed = 4;
625  }
626
627  // The queueing policy of the QueuedRequest.
628  QueueingPolicy queueing_policy = 5;
629
630  // Output only. State of the QueuedResource request.
631  QueuedResourceState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
632
633  // Name of the reservation in which the resource should be provisioned.
634  // Format: projects/{project}/locations/{zone}/reservations/{reservation}
635  string reservation_name = 8;
636}
637
638// QueuedResourceState defines the details of the QueuedResource request.
639message QueuedResourceState {
640  // Output only state of the request
641  enum State {
642    // State of the QueuedResource request is not known/set.
643    STATE_UNSPECIFIED = 0;
644
645    // The QueuedResource request has been received. We're still working on
646    // determining if we will be able to honor this request.
647    CREATING = 1;
648
649    // The QueuedResource request has passed initial validation/admission
650    // control and has been persisted in the queue.
651    ACCEPTED = 2;
652
653    // The QueuedResource request has been selected. The
654    // associated resources are currently being provisioned (or very soon
655    // will begin provisioning).
656    PROVISIONING = 3;
657
658    // The request could not be completed. This may be due to some
659    // late-discovered problem with the request itself, or due to
660    // unavailability of resources within the constraints of the request
661    // (e.g., the 'valid until' start timing constraint expired).
662    FAILED = 4;
663
664    // The QueuedResource is being deleted.
665    DELETING = 5;
666
667    // The resources specified in the QueuedResource request have been
668    // provisioned and are ready for use by the end-user/consumer.
669    ACTIVE = 6;
670
671    // The resources specified in the QueuedResource request are being
672    // deleted. This may have been initiated by the user, or
673    // the Cloud TPU service. Inspect the state data for more details.
674    SUSPENDING = 7;
675
676    // The resources specified in the QueuedResource request have been
677    // deleted.
678    SUSPENDED = 8;
679  }
680
681  // Further data for the creating state.
682  message CreatingData {}
683
684  // Further data for the accepted state.
685  message AcceptedData {}
686
687  // Further data for the provisioning state.
688  message ProvisioningData {}
689
690  // Further data for the failed state.
691  message FailedData {
692    // The error that caused the queued resource to enter the FAILED state.
693    google.rpc.Status error = 1;
694  }
695
696  // Further data for the deleting state.
697  message DeletingData {}
698
699  // Further data for the active state.
700  message ActiveData {}
701
702  // Further data for the suspending state.
703  message SuspendingData {}
704
705  // Further data for the suspended state.
706  message SuspendedData {}
707
708  // State of the QueuedResource request.
709  State state = 1;
710
711  // Further data for the state.
712  oneof state_data {
713    // Further data for the creating state.
714    CreatingData creating_data = 2;
715
716    // Further data for the accepted state.
717    AcceptedData accepted_data = 3;
718
719    // Further data for the provisioning state.
720    ProvisioningData provisioning_data = 4;
721
722    // Further data for the failed state.
723    FailedData failed_data = 5;
724
725    // Further data for the deleting state.
726    DeletingData deleting_data = 6;
727
728    // Further data for the active state.
729    ActiveData active_data = 7;
730
731    // Further data for the suspending state.
732    SuspendingData suspending_data = 8;
733
734    // Further data for the suspended state.
735    SuspendedData suspended_data = 9;
736  }
737}
738
739// Request for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes].
740message ListNodesRequest {
741  // Required. The parent resource name.
742  string parent = 1 [
743    (google.api.field_behavior) = REQUIRED,
744    (google.api.resource_reference) = { child_type: "tpu.googleapis.com/Node" }
745  ];
746
747  // The maximum number of items to return.
748  int32 page_size = 2;
749
750  // The next_page_token value returned from a previous List request, if any.
751  string page_token = 3;
752}
753
754// Response for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes].
755message ListNodesResponse {
756  // The listed nodes.
757  repeated Node nodes = 1;
758
759  // The next page token or empty if none.
760  string next_page_token = 2;
761
762  // Locations that could not be reached.
763  repeated string unreachable = 3;
764}
765
766// Request for [GetNode][google.cloud.tpu.v2alpha1.Tpu.GetNode].
767message GetNodeRequest {
768  // Required. The resource name.
769  string name = 1 [
770    (google.api.field_behavior) = REQUIRED,
771    (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
772  ];
773}
774
775// Request for [CreateNode][google.cloud.tpu.v2alpha1.Tpu.CreateNode].
776message CreateNodeRequest {
777  // Required. The parent resource name.
778  string parent = 1 [
779    (google.api.field_behavior) = REQUIRED,
780    (google.api.resource_reference) = {
781      type: "locations.googleapis.com/Location"
782    }
783  ];
784
785  // The unqualified resource name.
786  string node_id = 2;
787
788  // Required. The node.
789  Node node = 3 [(google.api.field_behavior) = REQUIRED];
790
791  // Idempotent request UUID.
792  string request_id = 6;
793}
794
795// Request for [DeleteNode][google.cloud.tpu.v2alpha1.Tpu.DeleteNode].
796message DeleteNodeRequest {
797  // Required. The resource name.
798  string name = 1 [
799    (google.api.field_behavior) = REQUIRED,
800    (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
801  ];
802
803  // Idempotent request UUID.
804  string request_id = 3;
805}
806
807// Request for [StopNode][google.cloud.tpu.v2alpha1.Tpu.StopNode].
808message StopNodeRequest {
809  // Required. The resource name.
810  string name = 1 [
811    (google.api.field_behavior) = REQUIRED,
812    (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
813  ];
814}
815
816// Request for [StartNode][google.cloud.tpu.v2alpha1.Tpu.StartNode].
817message StartNodeRequest {
818  // Required. The resource name.
819  string name = 1 [
820    (google.api.field_behavior) = REQUIRED,
821    (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
822  ];
823}
824
825// Request for [UpdateNode][google.cloud.tpu.v2alpha1.Tpu.UpdateNode].
826message UpdateNodeRequest {
827  // Required. Mask of fields from [Node][Tpu.Node] to update.
828  // Supported fields: [description, tags, labels, metadata,
829  // network_config.enable_external_ips].
830  google.protobuf.FieldMask update_mask = 1
831      [(google.api.field_behavior) = REQUIRED];
832
833  // Required. The node. Only fields specified in update_mask are updated.
834  Node node = 2 [(google.api.field_behavior) = REQUIRED];
835}
836
837// Request for
838// [ListQueuedResources][google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources].
839message ListQueuedResourcesRequest {
840  // Required. The parent resource name.
841  string parent = 1 [
842    (google.api.field_behavior) = REQUIRED,
843    (google.api.resource_reference) = {
844      child_type: "tpu.googleapis.com/QueuedResource"
845    }
846  ];
847
848  // The maximum number of items to return.
849  int32 page_size = 2;
850
851  // The next_page_token value returned from a previous List request, if any.
852  string page_token = 3;
853}
854
855// Response for
856// [ListQueuedResources][google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources].
857message ListQueuedResourcesResponse {
858  // The listed queued resources.
859  repeated QueuedResource queued_resources = 1;
860
861  // The next page token or empty if none.
862  string next_page_token = 2;
863
864  // Locations that could not be reached.
865  repeated string unreachable = 3;
866}
867
868// Request for
869// [GetQueuedResource][google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource]
870message GetQueuedResourceRequest {
871  // Required. The resource name.
872  string name = 1 [
873    (google.api.field_behavior) = REQUIRED,
874    (google.api.resource_reference) = {
875      type: "tpu.googleapis.com/QueuedResource"
876    }
877  ];
878}
879
880// Request for
881// [CreateQueuedResource][google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource].
882message CreateQueuedResourceRequest {
883  // Required. The parent resource name.
884  string parent = 1 [
885    (google.api.field_behavior) = REQUIRED,
886    (google.api.resource_reference) = {
887      type: "locations.googleapis.com/Location"
888    }
889  ];
890
891  // The unqualified resource name. Should follow the `^[A-Za-z0-9_.~+%-]+$`
892  // regex format.
893  string queued_resource_id = 2;
894
895  // Required. The queued resource.
896  QueuedResource queued_resource = 3 [(google.api.field_behavior) = REQUIRED];
897
898  // Idempotent request UUID.
899  string request_id = 4;
900}
901
902// Request for
903// [DeleteQueuedResource][google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource].
904message DeleteQueuedResourceRequest {
905  // Required. The resource name.
906  string name = 1 [
907    (google.api.field_behavior) = REQUIRED,
908    (google.api.resource_reference) = {
909      type: "tpu.googleapis.com/QueuedResource"
910    }
911  ];
912
913  // Idempotent request UUID.
914  string request_id = 2;
915}
916
917// The per-product per-project service identity for Cloud TPU service.
918message ServiceIdentity {
919  // The email address of the service identity.
920  string email = 1;
921}
922
923// Request for
924// [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity].
925message GenerateServiceIdentityRequest {
926  // Required. The parent resource name.
927  string parent = 1 [
928    (google.api.field_behavior) = REQUIRED,
929    (google.api.resource_reference) = {
930      type: "locations.googleapis.com/Location"
931    }
932  ];
933}
934
935// Response for
936// [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity].
937message GenerateServiceIdentityResponse {
938  // ServiceIdentity that was created or retrieved.
939  ServiceIdentity identity = 1;
940}
941
942// A accelerator type that a Node can be configured with.
943message AcceleratorType {
944  option (google.api.resource) = {
945    type: "tpu.googleapis.com/AcceleratorType"
946    pattern: "projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}"
947  };
948
949  // The resource name.
950  string name = 1;
951
952  // The accelerator type.
953  string type = 2;
954
955  // The accelerator config.
956  repeated AcceleratorConfig accelerator_configs = 3;
957}
958
959// Request for
960// [GetAcceleratorType][google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType].
961message GetAcceleratorTypeRequest {
962  // Required. The resource name.
963  string name = 1 [
964    (google.api.field_behavior) = REQUIRED,
965    (google.api.resource_reference) = {
966      type: "tpu.googleapis.com/AcceleratorType"
967    }
968  ];
969}
970
971// Request for
972// [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes].
973message ListAcceleratorTypesRequest {
974  // Required. The parent resource name.
975  string parent = 1 [
976    (google.api.field_behavior) = REQUIRED,
977    (google.api.resource_reference) = {
978      child_type: "tpu.googleapis.com/AcceleratorType"
979    }
980  ];
981
982  // The maximum number of items to return.
983  int32 page_size = 2;
984
985  // The next_page_token value returned from a previous List request, if any.
986  string page_token = 3;
987
988  // List filter.
989  string filter = 5;
990
991  // Sort results.
992  string order_by = 6;
993}
994
995// Response for
996// [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes].
997message ListAcceleratorTypesResponse {
998  // The listed nodes.
999  repeated AcceleratorType accelerator_types = 1;
1000
1001  // The next page token or empty if none.
1002  string next_page_token = 2;
1003
1004  // Locations that could not be reached.
1005  repeated string unreachable = 3;
1006}
1007
1008// A runtime version that a Node can be configured with.
1009message RuntimeVersion {
1010  option (google.api.resource) = {
1011    type: "tpu.googleapis.com/RuntimeVersion"
1012    pattern: "projects/{project}/locations/{location}/runtimeVersions/{runtime_version}"
1013  };
1014
1015  // The resource name.
1016  string name = 1;
1017
1018  // The runtime version.
1019  string version = 2;
1020}
1021
1022// Request for
1023// [GetRuntimeVersion][google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion].
1024message GetRuntimeVersionRequest {
1025  // Required. The resource name.
1026  string name = 1 [
1027    (google.api.field_behavior) = REQUIRED,
1028    (google.api.resource_reference) = {
1029      type: "tpu.googleapis.com/RuntimeVersion"
1030    }
1031  ];
1032}
1033
1034// Request for
1035// [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions].
1036message ListRuntimeVersionsRequest {
1037  // Required. The parent resource name.
1038  string parent = 1 [
1039    (google.api.field_behavior) = REQUIRED,
1040    (google.api.resource_reference) = {
1041      child_type: "tpu.googleapis.com/RuntimeVersion"
1042    }
1043  ];
1044
1045  // The maximum number of items to return.
1046  int32 page_size = 2;
1047
1048  // The next_page_token value returned from a previous List request, if any.
1049  string page_token = 3;
1050
1051  // List filter.
1052  string filter = 5;
1053
1054  // Sort results.
1055  string order_by = 6;
1056}
1057
1058// Response for
1059// [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions].
1060message ListRuntimeVersionsResponse {
1061  // The listed nodes.
1062  repeated RuntimeVersion runtime_versions = 1;
1063
1064  // The next page token or empty if none.
1065  string next_page_token = 2;
1066
1067  // Locations that could not be reached.
1068  repeated string unreachable = 3;
1069}
1070
1071// Metadata describing an [Operation][google.longrunning.Operation]
1072message OperationMetadata {
1073  // The time the operation was created.
1074  google.protobuf.Timestamp create_time = 1;
1075
1076  // The time the operation finished running.
1077  google.protobuf.Timestamp end_time = 2;
1078
1079  // Target of the operation - for example
1080  // projects/project-1/connectivityTests/test-1
1081  string target = 3;
1082
1083  // Name of the verb executed by the operation.
1084  string verb = 4;
1085
1086  // Human-readable status of the operation, if any.
1087  string status_detail = 5;
1088
1089  // Specifies if cancellation was requested for the operation.
1090  bool cancel_requested = 6;
1091
1092  // API version.
1093  string api_version = 7;
1094}
1095
1096// A Symptom instance.
1097message Symptom {
1098  // SymptomType represents the different types of Symptoms that a TPU can be
1099  // at.
1100  enum SymptomType {
1101    // Unspecified symptom.
1102    SYMPTOM_TYPE_UNSPECIFIED = 0;
1103
1104    // TPU VM memory is low.
1105    LOW_MEMORY = 1;
1106
1107    // TPU runtime is out of memory.
1108    OUT_OF_MEMORY = 2;
1109
1110    // TPU runtime execution has timed out.
1111    EXECUTE_TIMED_OUT = 3;
1112
1113    // TPU runtime fails to construct a mesh that recognizes each TPU device's
1114    // neighbors.
1115    MESH_BUILD_FAIL = 4;
1116
1117    // TPU HBM is out of memory.
1118    HBM_OUT_OF_MEMORY = 5;
1119
1120    // Abusive behaviors have been identified on the current project.
1121    PROJECT_ABUSE = 6;
1122  }
1123
1124  // Timestamp when the Symptom is created.
1125  google.protobuf.Timestamp create_time = 1;
1126
1127  // Type of the Symptom.
1128  SymptomType symptom_type = 2;
1129
1130  // Detailed information of the current Symptom.
1131  string details = 3;
1132
1133  // A string used to uniquely distinguish a worker within a TPU node.
1134  string worker_id = 4;
1135}
1136
1137// Request for
1138// [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes].
1139message GetGuestAttributesRequest {
1140  // Required. The resource name.
1141  string name = 1 [
1142    (google.api.field_behavior) = REQUIRED,
1143    (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
1144  ];
1145
1146  // The guest attributes path to be queried.
1147  string query_path = 2;
1148
1149  // The 0-based worker ID. If it is empty, all workers' GuestAttributes will be
1150  // returned.
1151  repeated string worker_ids = 3;
1152}
1153
1154// Response for
1155// [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes].
1156message GetGuestAttributesResponse {
1157  // The guest attributes for the TPU workers.
1158  repeated GuestAttributes guest_attributes = 1;
1159}
1160
1161// Request for
1162// [SimulateMaintenanceEvent][google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent].
1163message SimulateMaintenanceEventRequest {
1164  // Required. The resource name.
1165  string name = 1 [
1166    (google.api.field_behavior) = REQUIRED,
1167    (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
1168  ];
1169
1170  // The 0-based worker ID. If it is empty, worker ID 0 will be selected for
1171  // maintenance event simulation. A maintenance event will only be fired on the
1172  // first specified worker ID. Future implementations may support firing on
1173  // multiple workers.
1174  repeated string worker_ids = 2;
1175}
1176
1177// A TPU accelerator configuration.
1178message AcceleratorConfig {
1179  // TPU type.
1180  enum Type {
1181    // Unspecified version.
1182    TYPE_UNSPECIFIED = 0;
1183
1184    // TPU v2.
1185    V2 = 2;
1186
1187    // TPU v3.
1188    V3 = 4;
1189
1190    // TPU v4.
1191    V4 = 7;
1192  }
1193
1194  // Required. Type of TPU.
1195  Type type = 1 [(google.api.field_behavior) = REQUIRED];
1196
1197  // Required. Topology of TPU in chips.
1198  string topology = 2 [(google.api.field_behavior) = REQUIRED];
1199}
1200
1201// A set of Shielded Instance options.
1202message ShieldedInstanceConfig {
1203  // Defines whether the instance has Secure Boot enabled.
1204  bool enable_secure_boot = 1;
1205}
1206