google-apis-tpu_v2 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,726 @@
1
+ # Copyright 2020 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
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module TpuV2
23
+ # Cloud TPU API
24
+ #
25
+ # TPU API provides customers with access to Google TPU technology.
26
+ #
27
+ # @example
28
+ # require 'google/apis/tpu_v2'
29
+ #
30
+ # Tpu = Google::Apis::TpuV2 # Alias the module
31
+ # service = Tpu::TPUService.new
32
+ #
33
+ # @see https://cloud.google.com/tpu/
34
+ class TPUService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://tpu.googleapis.com/', '',
47
+ client_name: 'google-apis-tpu_v2',
48
+ client_version: Google::Apis::TpuV2::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Generates the Cloud TPU service identity for the project.
53
+ # @param [String] parent
54
+ # Required. The parent resource name.
55
+ # @param [Google::Apis::TpuV2::GenerateServiceIdentityRequest] generate_service_identity_request_object
56
+ # @param [String] fields
57
+ # Selector specifying which fields to include in a partial response.
58
+ # @param [String] quota_user
59
+ # Available to use for quota purposes for server-side applications. Can be any
60
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
61
+ # @param [Google::Apis::RequestOptions] options
62
+ # Request-specific options
63
+ #
64
+ # @yield [result, err] Result & error if block supplied
65
+ # @yieldparam result [Google::Apis::TpuV2::GenerateServiceIdentityResponse] parsed result object
66
+ # @yieldparam err [StandardError] error object if request failed
67
+ #
68
+ # @return [Google::Apis::TpuV2::GenerateServiceIdentityResponse]
69
+ #
70
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
71
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
72
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
73
+ def generate_location_service_identity(parent, generate_service_identity_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
74
+ command = make_simple_command(:post, 'v2/{+parent}:generateServiceIdentity', options)
75
+ command.request_representation = Google::Apis::TpuV2::GenerateServiceIdentityRequest::Representation
76
+ command.request_object = generate_service_identity_request_object
77
+ command.response_representation = Google::Apis::TpuV2::GenerateServiceIdentityResponse::Representation
78
+ command.response_class = Google::Apis::TpuV2::GenerateServiceIdentityResponse
79
+ command.params['parent'] = parent unless parent.nil?
80
+ command.query['fields'] = fields unless fields.nil?
81
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
82
+ execute_or_queue_command(command, &block)
83
+ end
84
+
85
+ # Gets information about a location.
86
+ # @param [String] name
87
+ # Resource name for the location.
88
+ # @param [String] fields
89
+ # Selector specifying which fields to include in a partial response.
90
+ # @param [String] quota_user
91
+ # Available to use for quota purposes for server-side applications. Can be any
92
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
93
+ # @param [Google::Apis::RequestOptions] options
94
+ # Request-specific options
95
+ #
96
+ # @yield [result, err] Result & error if block supplied
97
+ # @yieldparam result [Google::Apis::TpuV2::Location] parsed result object
98
+ # @yieldparam err [StandardError] error object if request failed
99
+ #
100
+ # @return [Google::Apis::TpuV2::Location]
101
+ #
102
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
103
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
104
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
105
+ def get_project_location(name, fields: nil, quota_user: nil, options: nil, &block)
106
+ command = make_simple_command(:get, 'v2/{+name}', options)
107
+ command.response_representation = Google::Apis::TpuV2::Location::Representation
108
+ command.response_class = Google::Apis::TpuV2::Location
109
+ command.params['name'] = name unless name.nil?
110
+ command.query['fields'] = fields unless fields.nil?
111
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
112
+ execute_or_queue_command(command, &block)
113
+ end
114
+
115
+ # Lists information about the supported locations for this service.
116
+ # @param [String] name
117
+ # The resource that owns the locations collection, if applicable.
118
+ # @param [String] filter
119
+ # A filter to narrow down results to a preferred subset. The filtering language
120
+ # accepts strings like `"displayName=tokyo"`, and is documented in more detail
121
+ # in [AIP-160](https://google.aip.dev/160).
122
+ # @param [Fixnum] page_size
123
+ # The maximum number of results to return. If not set, the service selects a
124
+ # default.
125
+ # @param [String] page_token
126
+ # A page token received from the `next_page_token` field in the response. Send
127
+ # that page token to receive the subsequent page.
128
+ # @param [String] fields
129
+ # Selector specifying which fields to include in a partial response.
130
+ # @param [String] quota_user
131
+ # Available to use for quota purposes for server-side applications. Can be any
132
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
133
+ # @param [Google::Apis::RequestOptions] options
134
+ # Request-specific options
135
+ #
136
+ # @yield [result, err] Result & error if block supplied
137
+ # @yieldparam result [Google::Apis::TpuV2::ListLocationsResponse] parsed result object
138
+ # @yieldparam err [StandardError] error object if request failed
139
+ #
140
+ # @return [Google::Apis::TpuV2::ListLocationsResponse]
141
+ #
142
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
143
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
144
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
145
+ def list_project_locations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
146
+ command = make_simple_command(:get, 'v2/{+name}/locations', options)
147
+ command.response_representation = Google::Apis::TpuV2::ListLocationsResponse::Representation
148
+ command.response_class = Google::Apis::TpuV2::ListLocationsResponse
149
+ command.params['name'] = name unless name.nil?
150
+ command.query['filter'] = filter unless filter.nil?
151
+ command.query['pageSize'] = page_size unless page_size.nil?
152
+ command.query['pageToken'] = page_token unless page_token.nil?
153
+ command.query['fields'] = fields unless fields.nil?
154
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
155
+ execute_or_queue_command(command, &block)
156
+ end
157
+
158
+ # Gets AcceleratorType.
159
+ # @param [String] name
160
+ # Required. The resource name.
161
+ # @param [String] fields
162
+ # Selector specifying which fields to include in a partial response.
163
+ # @param [String] quota_user
164
+ # Available to use for quota purposes for server-side applications. Can be any
165
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
166
+ # @param [Google::Apis::RequestOptions] options
167
+ # Request-specific options
168
+ #
169
+ # @yield [result, err] Result & error if block supplied
170
+ # @yieldparam result [Google::Apis::TpuV2::AcceleratorType] parsed result object
171
+ # @yieldparam err [StandardError] error object if request failed
172
+ #
173
+ # @return [Google::Apis::TpuV2::AcceleratorType]
174
+ #
175
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
176
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
177
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
178
+ def get_project_location_accelerator_type(name, fields: nil, quota_user: nil, options: nil, &block)
179
+ command = make_simple_command(:get, 'v2/{+name}', options)
180
+ command.response_representation = Google::Apis::TpuV2::AcceleratorType::Representation
181
+ command.response_class = Google::Apis::TpuV2::AcceleratorType
182
+ command.params['name'] = name unless name.nil?
183
+ command.query['fields'] = fields unless fields.nil?
184
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
185
+ execute_or_queue_command(command, &block)
186
+ end
187
+
188
+ # Lists accelerator types supported by this API.
189
+ # @param [String] parent
190
+ # Required. The parent resource name.
191
+ # @param [String] filter
192
+ # List filter.
193
+ # @param [String] order_by
194
+ # Sort results.
195
+ # @param [Fixnum] page_size
196
+ # The maximum number of items to return.
197
+ # @param [String] page_token
198
+ # The next_page_token value returned from a previous List request, if any.
199
+ # @param [String] fields
200
+ # Selector specifying which fields to include in a partial response.
201
+ # @param [String] quota_user
202
+ # Available to use for quota purposes for server-side applications. Can be any
203
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
204
+ # @param [Google::Apis::RequestOptions] options
205
+ # Request-specific options
206
+ #
207
+ # @yield [result, err] Result & error if block supplied
208
+ # @yieldparam result [Google::Apis::TpuV2::ListAcceleratorTypesResponse] parsed result object
209
+ # @yieldparam err [StandardError] error object if request failed
210
+ #
211
+ # @return [Google::Apis::TpuV2::ListAcceleratorTypesResponse]
212
+ #
213
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
214
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
215
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
216
+ def list_project_location_accelerator_types(parent, filter: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
217
+ command = make_simple_command(:get, 'v2/{+parent}/acceleratorTypes', options)
218
+ command.response_representation = Google::Apis::TpuV2::ListAcceleratorTypesResponse::Representation
219
+ command.response_class = Google::Apis::TpuV2::ListAcceleratorTypesResponse
220
+ command.params['parent'] = parent unless parent.nil?
221
+ command.query['filter'] = filter unless filter.nil?
222
+ command.query['orderBy'] = order_by unless order_by.nil?
223
+ command.query['pageSize'] = page_size unless page_size.nil?
224
+ command.query['pageToken'] = page_token unless page_token.nil?
225
+ command.query['fields'] = fields unless fields.nil?
226
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
227
+ execute_or_queue_command(command, &block)
228
+ end
229
+
230
+ # Creates a node.
231
+ # @param [String] parent
232
+ # Required. The parent resource name.
233
+ # @param [Google::Apis::TpuV2::Node] node_object
234
+ # @param [String] node_id
235
+ # The unqualified resource name.
236
+ # @param [String] fields
237
+ # Selector specifying which fields to include in a partial response.
238
+ # @param [String] quota_user
239
+ # Available to use for quota purposes for server-side applications. Can be any
240
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
241
+ # @param [Google::Apis::RequestOptions] options
242
+ # Request-specific options
243
+ #
244
+ # @yield [result, err] Result & error if block supplied
245
+ # @yieldparam result [Google::Apis::TpuV2::Operation] parsed result object
246
+ # @yieldparam err [StandardError] error object if request failed
247
+ #
248
+ # @return [Google::Apis::TpuV2::Operation]
249
+ #
250
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
251
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
252
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
253
+ def create_project_location_node(parent, node_object = nil, node_id: nil, fields: nil, quota_user: nil, options: nil, &block)
254
+ command = make_simple_command(:post, 'v2/{+parent}/nodes', options)
255
+ command.request_representation = Google::Apis::TpuV2::Node::Representation
256
+ command.request_object = node_object
257
+ command.response_representation = Google::Apis::TpuV2::Operation::Representation
258
+ command.response_class = Google::Apis::TpuV2::Operation
259
+ command.params['parent'] = parent unless parent.nil?
260
+ command.query['nodeId'] = node_id unless node_id.nil?
261
+ command.query['fields'] = fields unless fields.nil?
262
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
263
+ execute_or_queue_command(command, &block)
264
+ end
265
+
266
+ # Deletes a node.
267
+ # @param [String] name
268
+ # Required. The resource name.
269
+ # @param [String] fields
270
+ # Selector specifying which fields to include in a partial response.
271
+ # @param [String] quota_user
272
+ # Available to use for quota purposes for server-side applications. Can be any
273
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
274
+ # @param [Google::Apis::RequestOptions] options
275
+ # Request-specific options
276
+ #
277
+ # @yield [result, err] Result & error if block supplied
278
+ # @yieldparam result [Google::Apis::TpuV2::Operation] parsed result object
279
+ # @yieldparam err [StandardError] error object if request failed
280
+ #
281
+ # @return [Google::Apis::TpuV2::Operation]
282
+ #
283
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
284
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
285
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
286
+ def delete_project_location_node(name, fields: nil, quota_user: nil, options: nil, &block)
287
+ command = make_simple_command(:delete, 'v2/{+name}', options)
288
+ command.response_representation = Google::Apis::TpuV2::Operation::Representation
289
+ command.response_class = Google::Apis::TpuV2::Operation
290
+ command.params['name'] = name unless name.nil?
291
+ command.query['fields'] = fields unless fields.nil?
292
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
293
+ execute_or_queue_command(command, &block)
294
+ end
295
+
296
+ # Gets the details of a node.
297
+ # @param [String] name
298
+ # Required. The resource name.
299
+ # @param [String] fields
300
+ # Selector specifying which fields to include in a partial response.
301
+ # @param [String] quota_user
302
+ # Available to use for quota purposes for server-side applications. Can be any
303
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
304
+ # @param [Google::Apis::RequestOptions] options
305
+ # Request-specific options
306
+ #
307
+ # @yield [result, err] Result & error if block supplied
308
+ # @yieldparam result [Google::Apis::TpuV2::Node] parsed result object
309
+ # @yieldparam err [StandardError] error object if request failed
310
+ #
311
+ # @return [Google::Apis::TpuV2::Node]
312
+ #
313
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
314
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
315
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
316
+ def get_project_location_node(name, fields: nil, quota_user: nil, options: nil, &block)
317
+ command = make_simple_command(:get, 'v2/{+name}', options)
318
+ command.response_representation = Google::Apis::TpuV2::Node::Representation
319
+ command.response_class = Google::Apis::TpuV2::Node
320
+ command.params['name'] = name unless name.nil?
321
+ command.query['fields'] = fields unless fields.nil?
322
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
323
+ execute_or_queue_command(command, &block)
324
+ end
325
+
326
+ # Retrieves the guest attributes for the node.
327
+ # @param [String] name
328
+ # Required. The resource name.
329
+ # @param [Google::Apis::TpuV2::GetGuestAttributesRequest] get_guest_attributes_request_object
330
+ # @param [String] fields
331
+ # Selector specifying which fields to include in a partial response.
332
+ # @param [String] quota_user
333
+ # Available to use for quota purposes for server-side applications. Can be any
334
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
335
+ # @param [Google::Apis::RequestOptions] options
336
+ # Request-specific options
337
+ #
338
+ # @yield [result, err] Result & error if block supplied
339
+ # @yieldparam result [Google::Apis::TpuV2::GetGuestAttributesResponse] parsed result object
340
+ # @yieldparam err [StandardError] error object if request failed
341
+ #
342
+ # @return [Google::Apis::TpuV2::GetGuestAttributesResponse]
343
+ #
344
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
345
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
346
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
347
+ def get_node_guest_attributes(name, get_guest_attributes_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
348
+ command = make_simple_command(:post, 'v2/{+name}:getGuestAttributes', options)
349
+ command.request_representation = Google::Apis::TpuV2::GetGuestAttributesRequest::Representation
350
+ command.request_object = get_guest_attributes_request_object
351
+ command.response_representation = Google::Apis::TpuV2::GetGuestAttributesResponse::Representation
352
+ command.response_class = Google::Apis::TpuV2::GetGuestAttributesResponse
353
+ command.params['name'] = name unless name.nil?
354
+ command.query['fields'] = fields unless fields.nil?
355
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
356
+ execute_or_queue_command(command, &block)
357
+ end
358
+
359
+ # Lists nodes.
360
+ # @param [String] parent
361
+ # Required. The parent resource name.
362
+ # @param [Fixnum] page_size
363
+ # The maximum number of items to return.
364
+ # @param [String] page_token
365
+ # The next_page_token value returned from a previous List request, if any.
366
+ # @param [String] fields
367
+ # Selector specifying which fields to include in a partial response.
368
+ # @param [String] quota_user
369
+ # Available to use for quota purposes for server-side applications. Can be any
370
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
371
+ # @param [Google::Apis::RequestOptions] options
372
+ # Request-specific options
373
+ #
374
+ # @yield [result, err] Result & error if block supplied
375
+ # @yieldparam result [Google::Apis::TpuV2::ListNodesResponse] parsed result object
376
+ # @yieldparam err [StandardError] error object if request failed
377
+ #
378
+ # @return [Google::Apis::TpuV2::ListNodesResponse]
379
+ #
380
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
381
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
382
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
383
+ def list_project_location_nodes(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
384
+ command = make_simple_command(:get, 'v2/{+parent}/nodes', options)
385
+ command.response_representation = Google::Apis::TpuV2::ListNodesResponse::Representation
386
+ command.response_class = Google::Apis::TpuV2::ListNodesResponse
387
+ command.params['parent'] = parent unless parent.nil?
388
+ command.query['pageSize'] = page_size unless page_size.nil?
389
+ command.query['pageToken'] = page_token unless page_token.nil?
390
+ command.query['fields'] = fields unless fields.nil?
391
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
392
+ execute_or_queue_command(command, &block)
393
+ end
394
+
395
+ # Updates the configurations of a node.
396
+ # @param [String] name
397
+ # Output only. Immutable. The name of the TPU.
398
+ # @param [Google::Apis::TpuV2::Node] node_object
399
+ # @param [String] update_mask
400
+ # Required. Mask of fields from Node to update. Supported fields: [description,
401
+ # tags, labels, metadata, network_config.enable_external_ips].
402
+ # @param [String] fields
403
+ # Selector specifying which fields to include in a partial response.
404
+ # @param [String] quota_user
405
+ # Available to use for quota purposes for server-side applications. Can be any
406
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
407
+ # @param [Google::Apis::RequestOptions] options
408
+ # Request-specific options
409
+ #
410
+ # @yield [result, err] Result & error if block supplied
411
+ # @yieldparam result [Google::Apis::TpuV2::Operation] parsed result object
412
+ # @yieldparam err [StandardError] error object if request failed
413
+ #
414
+ # @return [Google::Apis::TpuV2::Operation]
415
+ #
416
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
417
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
418
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
419
+ def patch_project_location_node(name, node_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
420
+ command = make_simple_command(:patch, 'v2/{+name}', options)
421
+ command.request_representation = Google::Apis::TpuV2::Node::Representation
422
+ command.request_object = node_object
423
+ command.response_representation = Google::Apis::TpuV2::Operation::Representation
424
+ command.response_class = Google::Apis::TpuV2::Operation
425
+ command.params['name'] = name unless name.nil?
426
+ command.query['updateMask'] = update_mask unless update_mask.nil?
427
+ command.query['fields'] = fields unless fields.nil?
428
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
429
+ execute_or_queue_command(command, &block)
430
+ end
431
+
432
+ # Starts a node.
433
+ # @param [String] name
434
+ # The resource name.
435
+ # @param [Google::Apis::TpuV2::StartNodeRequest] start_node_request_object
436
+ # @param [String] fields
437
+ # Selector specifying which fields to include in a partial response.
438
+ # @param [String] quota_user
439
+ # Available to use for quota purposes for server-side applications. Can be any
440
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
441
+ # @param [Google::Apis::RequestOptions] options
442
+ # Request-specific options
443
+ #
444
+ # @yield [result, err] Result & error if block supplied
445
+ # @yieldparam result [Google::Apis::TpuV2::Operation] parsed result object
446
+ # @yieldparam err [StandardError] error object if request failed
447
+ #
448
+ # @return [Google::Apis::TpuV2::Operation]
449
+ #
450
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
451
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
452
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
453
+ def start_node(name, start_node_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
454
+ command = make_simple_command(:post, 'v2/{+name}:start', options)
455
+ command.request_representation = Google::Apis::TpuV2::StartNodeRequest::Representation
456
+ command.request_object = start_node_request_object
457
+ command.response_representation = Google::Apis::TpuV2::Operation::Representation
458
+ command.response_class = Google::Apis::TpuV2::Operation
459
+ command.params['name'] = name unless name.nil?
460
+ command.query['fields'] = fields unless fields.nil?
461
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
462
+ execute_or_queue_command(command, &block)
463
+ end
464
+
465
+ # Stops a node. This operation is only available with single TPU nodes.
466
+ # @param [String] name
467
+ # The resource name.
468
+ # @param [Google::Apis::TpuV2::StopNodeRequest] stop_node_request_object
469
+ # @param [String] fields
470
+ # Selector specifying which fields to include in a partial response.
471
+ # @param [String] quota_user
472
+ # Available to use for quota purposes for server-side applications. Can be any
473
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
474
+ # @param [Google::Apis::RequestOptions] options
475
+ # Request-specific options
476
+ #
477
+ # @yield [result, err] Result & error if block supplied
478
+ # @yieldparam result [Google::Apis::TpuV2::Operation] parsed result object
479
+ # @yieldparam err [StandardError] error object if request failed
480
+ #
481
+ # @return [Google::Apis::TpuV2::Operation]
482
+ #
483
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
484
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
485
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
486
+ def stop_node(name, stop_node_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
487
+ command = make_simple_command(:post, 'v2/{+name}:stop', options)
488
+ command.request_representation = Google::Apis::TpuV2::StopNodeRequest::Representation
489
+ command.request_object = stop_node_request_object
490
+ command.response_representation = Google::Apis::TpuV2::Operation::Representation
491
+ command.response_class = Google::Apis::TpuV2::Operation
492
+ command.params['name'] = name unless name.nil?
493
+ command.query['fields'] = fields unless fields.nil?
494
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
495
+ execute_or_queue_command(command, &block)
496
+ end
497
+
498
+ # Starts asynchronous cancellation on a long-running operation. The server makes
499
+ # a best effort to cancel the operation, but success is not guaranteed. If the
500
+ # server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
501
+ # Clients can use Operations.GetOperation or other methods to check whether the
502
+ # cancellation succeeded or whether the operation completed despite cancellation.
503
+ # On successful cancellation, the operation is not deleted; instead, it becomes
504
+ # an operation with an Operation.error value with a google.rpc.Status.code of 1,
505
+ # corresponding to `Code.CANCELLED`.
506
+ # @param [String] name
507
+ # The name of the operation resource to be cancelled.
508
+ # @param [String] fields
509
+ # Selector specifying which fields to include in a partial response.
510
+ # @param [String] quota_user
511
+ # Available to use for quota purposes for server-side applications. Can be any
512
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
513
+ # @param [Google::Apis::RequestOptions] options
514
+ # Request-specific options
515
+ #
516
+ # @yield [result, err] Result & error if block supplied
517
+ # @yieldparam result [Google::Apis::TpuV2::Empty] parsed result object
518
+ # @yieldparam err [StandardError] error object if request failed
519
+ #
520
+ # @return [Google::Apis::TpuV2::Empty]
521
+ #
522
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
523
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
524
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
525
+ def cancel_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
526
+ command = make_simple_command(:post, 'v2/{+name}:cancel', options)
527
+ command.response_representation = Google::Apis::TpuV2::Empty::Representation
528
+ command.response_class = Google::Apis::TpuV2::Empty
529
+ command.params['name'] = name unless name.nil?
530
+ command.query['fields'] = fields unless fields.nil?
531
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
532
+ execute_or_queue_command(command, &block)
533
+ end
534
+
535
+ # Deletes a long-running operation. This method indicates that the client is no
536
+ # longer interested in the operation result. It does not cancel the operation.
537
+ # If the server doesn't support this method, it returns `google.rpc.Code.
538
+ # UNIMPLEMENTED`.
539
+ # @param [String] name
540
+ # The name of the operation resource to be deleted.
541
+ # @param [String] fields
542
+ # Selector specifying which fields to include in a partial response.
543
+ # @param [String] quota_user
544
+ # Available to use for quota purposes for server-side applications. Can be any
545
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
546
+ # @param [Google::Apis::RequestOptions] options
547
+ # Request-specific options
548
+ #
549
+ # @yield [result, err] Result & error if block supplied
550
+ # @yieldparam result [Google::Apis::TpuV2::Empty] parsed result object
551
+ # @yieldparam err [StandardError] error object if request failed
552
+ #
553
+ # @return [Google::Apis::TpuV2::Empty]
554
+ #
555
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
556
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
557
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
558
+ def delete_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
559
+ command = make_simple_command(:delete, 'v2/{+name}', options)
560
+ command.response_representation = Google::Apis::TpuV2::Empty::Representation
561
+ command.response_class = Google::Apis::TpuV2::Empty
562
+ command.params['name'] = name unless name.nil?
563
+ command.query['fields'] = fields unless fields.nil?
564
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
565
+ execute_or_queue_command(command, &block)
566
+ end
567
+
568
+ # Gets the latest state of a long-running operation. Clients can use this method
569
+ # to poll the operation result at intervals as recommended by the API service.
570
+ # @param [String] name
571
+ # The name of the operation resource.
572
+ # @param [String] fields
573
+ # Selector specifying which fields to include in a partial response.
574
+ # @param [String] quota_user
575
+ # Available to use for quota purposes for server-side applications. Can be any
576
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
577
+ # @param [Google::Apis::RequestOptions] options
578
+ # Request-specific options
579
+ #
580
+ # @yield [result, err] Result & error if block supplied
581
+ # @yieldparam result [Google::Apis::TpuV2::Operation] parsed result object
582
+ # @yieldparam err [StandardError] error object if request failed
583
+ #
584
+ # @return [Google::Apis::TpuV2::Operation]
585
+ #
586
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
587
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
588
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
589
+ def get_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
590
+ command = make_simple_command(:get, 'v2/{+name}', options)
591
+ command.response_representation = Google::Apis::TpuV2::Operation::Representation
592
+ command.response_class = Google::Apis::TpuV2::Operation
593
+ command.params['name'] = name unless name.nil?
594
+ command.query['fields'] = fields unless fields.nil?
595
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
596
+ execute_or_queue_command(command, &block)
597
+ end
598
+
599
+ # Lists operations that match the specified filter in the request. If the server
600
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
601
+ # binding allows API services to override the binding to use different resource
602
+ # name schemes, such as `users/*/operations`. To override the binding, API
603
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
604
+ # service configuration. For backwards compatibility, the default name includes
605
+ # the operations collection id, however overriding users must ensure the name
606
+ # binding is the parent resource, without the operations collection id.
607
+ # @param [String] name
608
+ # The name of the operation's parent resource.
609
+ # @param [String] filter
610
+ # The standard list filter.
611
+ # @param [Fixnum] page_size
612
+ # The standard list page size.
613
+ # @param [String] page_token
614
+ # The standard list page token.
615
+ # @param [String] fields
616
+ # Selector specifying which fields to include in a partial response.
617
+ # @param [String] quota_user
618
+ # Available to use for quota purposes for server-side applications. Can be any
619
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
620
+ # @param [Google::Apis::RequestOptions] options
621
+ # Request-specific options
622
+ #
623
+ # @yield [result, err] Result & error if block supplied
624
+ # @yieldparam result [Google::Apis::TpuV2::ListOperationsResponse] parsed result object
625
+ # @yieldparam err [StandardError] error object if request failed
626
+ #
627
+ # @return [Google::Apis::TpuV2::ListOperationsResponse]
628
+ #
629
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
630
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
631
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
632
+ def list_project_location_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
633
+ command = make_simple_command(:get, 'v2/{+name}/operations', options)
634
+ command.response_representation = Google::Apis::TpuV2::ListOperationsResponse::Representation
635
+ command.response_class = Google::Apis::TpuV2::ListOperationsResponse
636
+ command.params['name'] = name unless name.nil?
637
+ command.query['filter'] = filter unless filter.nil?
638
+ command.query['pageSize'] = page_size unless page_size.nil?
639
+ command.query['pageToken'] = page_token unless page_token.nil?
640
+ command.query['fields'] = fields unless fields.nil?
641
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
642
+ execute_or_queue_command(command, &block)
643
+ end
644
+
645
+ # Gets a runtime version.
646
+ # @param [String] name
647
+ # Required. The resource name.
648
+ # @param [String] fields
649
+ # Selector specifying which fields to include in a partial response.
650
+ # @param [String] quota_user
651
+ # Available to use for quota purposes for server-side applications. Can be any
652
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
653
+ # @param [Google::Apis::RequestOptions] options
654
+ # Request-specific options
655
+ #
656
+ # @yield [result, err] Result & error if block supplied
657
+ # @yieldparam result [Google::Apis::TpuV2::RuntimeVersion] parsed result object
658
+ # @yieldparam err [StandardError] error object if request failed
659
+ #
660
+ # @return [Google::Apis::TpuV2::RuntimeVersion]
661
+ #
662
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
663
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
664
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
665
+ def get_project_location_runtime_version(name, fields: nil, quota_user: nil, options: nil, &block)
666
+ command = make_simple_command(:get, 'v2/{+name}', options)
667
+ command.response_representation = Google::Apis::TpuV2::RuntimeVersion::Representation
668
+ command.response_class = Google::Apis::TpuV2::RuntimeVersion
669
+ command.params['name'] = name unless name.nil?
670
+ command.query['fields'] = fields unless fields.nil?
671
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
672
+ execute_or_queue_command(command, &block)
673
+ end
674
+
675
+ # Lists runtime versions supported by this API.
676
+ # @param [String] parent
677
+ # Required. The parent resource name.
678
+ # @param [String] filter
679
+ # List filter.
680
+ # @param [String] order_by
681
+ # Sort results.
682
+ # @param [Fixnum] page_size
683
+ # The maximum number of items to return.
684
+ # @param [String] page_token
685
+ # The next_page_token value returned from a previous List request, if any.
686
+ # @param [String] fields
687
+ # Selector specifying which fields to include in a partial response.
688
+ # @param [String] quota_user
689
+ # Available to use for quota purposes for server-side applications. Can be any
690
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
691
+ # @param [Google::Apis::RequestOptions] options
692
+ # Request-specific options
693
+ #
694
+ # @yield [result, err] Result & error if block supplied
695
+ # @yieldparam result [Google::Apis::TpuV2::ListRuntimeVersionsResponse] parsed result object
696
+ # @yieldparam err [StandardError] error object if request failed
697
+ #
698
+ # @return [Google::Apis::TpuV2::ListRuntimeVersionsResponse]
699
+ #
700
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
701
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
702
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
703
+ def list_project_location_runtime_versions(parent, filter: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
704
+ command = make_simple_command(:get, 'v2/{+parent}/runtimeVersions', options)
705
+ command.response_representation = Google::Apis::TpuV2::ListRuntimeVersionsResponse::Representation
706
+ command.response_class = Google::Apis::TpuV2::ListRuntimeVersionsResponse
707
+ command.params['parent'] = parent unless parent.nil?
708
+ command.query['filter'] = filter unless filter.nil?
709
+ command.query['orderBy'] = order_by unless order_by.nil?
710
+ command.query['pageSize'] = page_size unless page_size.nil?
711
+ command.query['pageToken'] = page_token unless page_token.nil?
712
+ command.query['fields'] = fields unless fields.nil?
713
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
714
+ execute_or_queue_command(command, &block)
715
+ end
716
+
717
+ protected
718
+
719
+ def apply_command_defaults(command)
720
+ command.query['key'] = key unless key.nil?
721
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
722
+ end
723
+ end
724
+ end
725
+ end
726
+ end