Skip to content

Commit 1230a6b

Browse files
Google APIscopybara-github
authored andcommitted
fix: proper http bindings for v2 API
chore: reformat protos PiperOrigin-RevId: 504361887
1 parent 44f176c commit 1230a6b

2 files changed

Lines changed: 44 additions & 65 deletions

File tree

google/cloud/tpu/v2/cloud_tpu.proto

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ option java_package = "com.google.cloud.tpu.v2";
3434
// TPU API v2
3535
service Tpu {
3636
option (google.api.default_host) = "tpu.googleapis.com";
37-
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
37+
option (google.api.oauth_scopes) =
38+
"https://www.googleapis.com/auth/cloud-platform";
3839

3940
// Lists nodes.
4041
rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) {
@@ -115,15 +116,17 @@ service Tpu {
115116
}
116117

117118
// Generates the Cloud TPU service identity for the project.
118-
rpc GenerateServiceIdentity(GenerateServiceIdentityRequest) returns (GenerateServiceIdentityResponse) {
119+
rpc GenerateServiceIdentity(GenerateServiceIdentityRequest)
120+
returns (GenerateServiceIdentityResponse) {
119121
option (google.api.http) = {
120122
post: "/v2/{parent=projects/*/locations/*}:generateServiceIdentity"
121123
body: "*"
122124
};
123125
}
124126

125127
// Lists accelerator types supported by this API.
126-
rpc ListAcceleratorTypes(ListAcceleratorTypesRequest) returns (ListAcceleratorTypesResponse) {
128+
rpc ListAcceleratorTypes(ListAcceleratorTypesRequest)
129+
returns (ListAcceleratorTypesResponse) {
127130
option (google.api.http) = {
128131
get: "/v2/{parent=projects/*/locations/*}/acceleratorTypes"
129132
};
@@ -139,7 +142,8 @@ service Tpu {
139142
}
140143

141144
// Lists runtime versions supported by this API.
142-
rpc ListRuntimeVersions(ListRuntimeVersionsRequest) returns (ListRuntimeVersionsResponse) {
145+
rpc ListRuntimeVersions(ListRuntimeVersionsRequest)
146+
returns (ListRuntimeVersionsResponse) {
143147
option (google.api.http) = {
144148
get: "/v2/{parent=projects/*/locations/*}/runtimeVersions"
145149
};
@@ -155,7 +159,8 @@ service Tpu {
155159
}
156160

157161
// Retrieves the guest attributes for the node.
158-
rpc GetGuestAttributes(GetGuestAttributesRequest) returns (GetGuestAttributesResponse) {
162+
rpc GetGuestAttributes(GetGuestAttributesRequest)
163+
returns (GetGuestAttributesResponse) {
159164
option (google.api.http) = {
160165
post: "/v2/{name=projects/*/locations/*/nodes/*}:getGuestAttributes"
161166
body: "*"
@@ -389,8 +394,8 @@ message Node {
389394
// Output only. The current state for the TPU Node.
390395
State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
391396

392-
// Output only. If this field is populated, it contains a description of why the TPU Node
393-
// is unhealthy.
397+
// Output only. If this field is populated, it contains a description of why
398+
// the TPU Node is unhealthy.
394399
string health_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
395400

396401
// Required. The runtime version running in the Node.
@@ -414,15 +419,17 @@ message Node {
414419
ServiceAccount service_account = 37;
415420

416421
// Output only. The time when the node was created.
417-
google.protobuf.Timestamp create_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
422+
google.protobuf.Timestamp create_time = 16
423+
[(google.api.field_behavior) = OUTPUT_ONLY];
418424

419425
// The scheduling options for this node.
420426
SchedulingConfig scheduling_config = 17;
421427

422428
// Output only. The network endpoints where TPU workers can be accessed and
423429
// sent work. It is recommended that runtime clients of the node reach out
424430
// to the 0th entry in this map first.
425-
repeated NetworkEndpoint network_endpoints = 21 [(google.api.field_behavior) = OUTPUT_ONLY];
431+
repeated NetworkEndpoint network_endpoints = 21
432+
[(google.api.field_behavior) = OUTPUT_ONLY];
426433

427434
// The health status of the TPU node.
428435
Health health = 22;
@@ -459,9 +466,7 @@ message ListNodesRequest {
459466
// Required. The parent resource name.
460467
string parent = 1 [
461468
(google.api.field_behavior) = REQUIRED,
462-
(google.api.resource_reference) = {
463-
child_type: "tpu.googleapis.com/Node"
464-
}
469+
(google.api.resource_reference) = { child_type: "tpu.googleapis.com/Node" }
465470
];
466471

467472
// The maximum number of items to return.
@@ -488,9 +493,7 @@ message GetNodeRequest {
488493
// Required. The resource name.
489494
string name = 1 [
490495
(google.api.field_behavior) = REQUIRED,
491-
(google.api.resource_reference) = {
492-
type: "tpu.googleapis.com/Node"
493-
}
496+
(google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
494497
];
495498
}
496499

@@ -516,9 +519,7 @@ message DeleteNodeRequest {
516519
// Required. The resource name.
517520
string name = 1 [
518521
(google.api.field_behavior) = REQUIRED,
519-
(google.api.resource_reference) = {
520-
type: "tpu.googleapis.com/Node"
521-
}
522+
(google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
522523
];
523524
}
524525

@@ -527,9 +528,7 @@ message StopNodeRequest {
527528
// Required. The resource name.
528529
string name = 1 [
529530
(google.api.field_behavior) = REQUIRED,
530-
(google.api.resource_reference) = {
531-
type: "tpu.googleapis.com/Node"
532-
}
531+
(google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
533532
];
534533
}
535534

@@ -538,9 +537,7 @@ message StartNodeRequest {
538537
// Required. The resource name.
539538
string name = 1 [
540539
(google.api.field_behavior) = REQUIRED,
541-
(google.api.resource_reference) = {
542-
type: "tpu.googleapis.com/Node"
543-
}
540+
(google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
544541
];
545542
}
546543

@@ -549,7 +546,8 @@ message UpdateNodeRequest {
549546
// Required. Mask of fields from [Node][Tpu.Node] to update.
550547
// Supported fields: [description, tags, labels, metadata,
551548
// network_config.enable_external_ips].
552-
google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED];
549+
google.protobuf.FieldMask update_mask = 1
550+
[(google.api.field_behavior) = REQUIRED];
553551

554552
// Required. The node. Only fields specified in update_mask are updated.
555553
Node node = 2 [(google.api.field_behavior) = REQUIRED];
@@ -561,7 +559,8 @@ message ServiceIdentity {
561559
string email = 1;
562560
}
563561

564-
// Request for [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity].
562+
// Request for
563+
// [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity].
565564
message GenerateServiceIdentityRequest {
566565
// Required. The parent resource name.
567566
string parent = 1 [
@@ -572,7 +571,8 @@ message GenerateServiceIdentityRequest {
572571
];
573572
}
574573

575-
// Response for [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity].
574+
// Response for
575+
// [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity].
576576
message GenerateServiceIdentityResponse {
577577
// ServiceIdentity that was created or retrieved.
578578
ServiceIdentity identity = 1;
@@ -603,7 +603,8 @@ message GetAcceleratorTypeRequest {
603603
];
604604
}
605605

606-
// Request for [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes].
606+
// Request for
607+
// [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes].
607608
message ListAcceleratorTypesRequest {
608609
// Required. The parent resource name.
609610
string parent = 1 [
@@ -626,7 +627,8 @@ message ListAcceleratorTypesRequest {
626627
string order_by = 6;
627628
}
628629

629-
// Response for [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes].
630+
// Response for
631+
// [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes].
630632
message ListAcceleratorTypesResponse {
631633
// The listed nodes.
632634
repeated AcceleratorType accelerator_types = 1;
@@ -663,7 +665,8 @@ message GetRuntimeVersionRequest {
663665
];
664666
}
665667

666-
// Request for [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions].
668+
// Request for
669+
// [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions].
667670
message ListRuntimeVersionsRequest {
668671
// Required. The parent resource name.
669672
string parent = 1 [
@@ -686,7 +689,8 @@ message ListRuntimeVersionsRequest {
686689
string order_by = 6;
687690
}
688691

689-
// Response for [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions].
692+
// Response for
693+
// [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions].
690694
message ListRuntimeVersionsResponse {
691695
// The listed nodes.
692696
repeated RuntimeVersion runtime_versions = 1;
@@ -769,9 +773,7 @@ message GetGuestAttributesRequest {
769773
// Required. The resource name.
770774
string name = 1 [
771775
(google.api.field_behavior) = REQUIRED,
772-
(google.api.resource_reference) = {
773-
type: "tpu.googleapis.com/Node"
774-
}
776+
(google.api.resource_reference) = { type: "tpu.googleapis.com/Node" }
775777
];
776778

777779
// The guest attributes path to be queried.
@@ -782,7 +784,8 @@ message GetGuestAttributesRequest {
782784
repeated string worker_ids = 3;
783785
}
784786

785-
// Response for [GetGuestAttributes][google.cloud.tpu.v2.Tpu.GetGuestAttributes].
787+
// Response for
788+
// [GetGuestAttributes][google.cloud.tpu.v2.Tpu.GetGuestAttributes].
786789
message GetGuestAttributesResponse {
787790
// The guest attributes for the TPU workers.
788791
repeated GuestAttributes guest_attributes = 1;

google/cloud/tpu/v2/tpu_v2.yaml

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,41 +34,17 @@ backend:
3434
http:
3535
rules:
3636
- selector: google.cloud.location.Locations.GetLocation
37-
get: '/v1alpha1/{name=projects/*/locations/*}'
38-
additional_bindings:
39-
- get: '/v1/{name=projects/*/locations/*}'
40-
- get: '/v2alpha1/{name=projects/*/locations/*}'
41-
- get: '/v2/{name=projects/*/locations/*}'
37+
get: '/v2/{name=projects/*/locations/*}'
4238
- selector: google.cloud.location.Locations.ListLocations
43-
get: '/v1alpha1/{name=projects/*}/locations'
44-
additional_bindings:
45-
- get: '/v1/{name=projects/*}/locations'
46-
- get: '/v2alpha1/{name=projects/*}/locations'
47-
- get: '/v2/{name=projects/*}/locations'
39+
get: '/v2/{name=projects/*}/locations'
4840
- selector: google.longrunning.Operations.CancelOperation
49-
post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel'
50-
additional_bindings:
51-
- post: '/v1/{name=projects/*/locations/*/operations/*}:cancel'
52-
- post: '/v2alpha1/{name=projects/*/locations/*/operations/*}:cancel'
53-
- post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'
41+
post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'
5442
- selector: google.longrunning.Operations.DeleteOperation
55-
delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}'
56-
additional_bindings:
57-
- delete: '/v1/{name=projects/*/locations/*/operations/*}'
58-
- delete: '/v2alpha1/{name=projects/*/locations/*/operations/*}'
59-
- delete: '/v2/{name=projects/*/locations/*/operations/*}'
43+
delete: '/v2/{name=projects/*/locations/*/operations/*}'
6044
- selector: google.longrunning.Operations.GetOperation
61-
get: '/v1alpha1/{name=projects/*/locations/*/operations/*}'
62-
additional_bindings:
63-
- get: '/v1/{name=projects/*/locations/*/operations/*}'
64-
- get: '/v2alpha1/{name=projects/*/locations/*/operations/*}'
65-
- get: '/v2/{name=projects/*/locations/*/operations/*}'
45+
get: '/v2/{name=projects/*/locations/*/operations/*}'
6646
- selector: google.longrunning.Operations.ListOperations
67-
get: '/v1alpha1/{name=projects/*/locations/*}/operations'
68-
additional_bindings:
69-
- get: '/v1/{name=projects/*/locations/*}/operations'
70-
- get: '/v2alpha1/{name=projects/*/locations/*}/operations'
71-
- get: '/v2/{name=projects/*/locations/*}/operations'
47+
get: '/v2/{name=projects/*/locations/*}/operations'
7248

7349
authentication:
7450
rules:

0 commit comments

Comments
 (0)