google-cloud-tpu-v1 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,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/tpu/v1"
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/tpu/v1/tpu"
20
+ require "google/cloud/tpu/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Tpu
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/tpu/v1"
29
+ # client = ::Google::Cloud::Tpu::V1::Tpu::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
38
+ require "google/cloud/tpu/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,202 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/tpu/v1/cloud_tpu.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/annotations_pb'
7
+ require 'google/api/client_pb'
8
+ require 'google/api/field_behavior_pb'
9
+ require 'google/api/resource_pb'
10
+ require 'google/longrunning/operations_pb'
11
+ require 'google/protobuf/timestamp_pb'
12
+ Google::Protobuf::DescriptorPool.generated_pool.build do
13
+ add_file("google/cloud/tpu/v1/cloud_tpu.proto", :syntax => :proto3) do
14
+ add_message "google.cloud.tpu.v1.SchedulingConfig" do
15
+ optional :preemptible, :bool, 1
16
+ optional :reserved, :bool, 2
17
+ end
18
+ add_message "google.cloud.tpu.v1.NetworkEndpoint" do
19
+ optional :ip_address, :string, 1
20
+ optional :port, :int32, 2
21
+ end
22
+ add_message "google.cloud.tpu.v1.Node" do
23
+ optional :name, :string, 1
24
+ optional :description, :string, 3
25
+ optional :accelerator_type, :string, 5
26
+ optional :ip_address, :string, 8
27
+ optional :port, :string, 14
28
+ optional :state, :enum, 9, "google.cloud.tpu.v1.Node.State"
29
+ optional :health_description, :string, 10
30
+ optional :tensorflow_version, :string, 11
31
+ optional :network, :string, 12
32
+ optional :cidr_block, :string, 13
33
+ optional :service_account, :string, 15
34
+ optional :create_time, :message, 16, "google.protobuf.Timestamp"
35
+ optional :scheduling_config, :message, 17, "google.cloud.tpu.v1.SchedulingConfig"
36
+ repeated :network_endpoints, :message, 21, "google.cloud.tpu.v1.NetworkEndpoint"
37
+ optional :health, :enum, 22, "google.cloud.tpu.v1.Node.Health"
38
+ map :labels, :string, :string, 24
39
+ optional :use_service_networking, :bool, 27
40
+ optional :api_version, :enum, 38, "google.cloud.tpu.v1.Node.ApiVersion"
41
+ repeated :symptoms, :message, 39, "google.cloud.tpu.v1.Symptom"
42
+ end
43
+ add_enum "google.cloud.tpu.v1.Node.State" do
44
+ value :STATE_UNSPECIFIED, 0
45
+ value :CREATING, 1
46
+ value :READY, 2
47
+ value :RESTARTING, 3
48
+ value :REIMAGING, 4
49
+ value :DELETING, 5
50
+ value :REPAIRING, 6
51
+ value :STOPPED, 8
52
+ value :STOPPING, 9
53
+ value :STARTING, 10
54
+ value :PREEMPTED, 11
55
+ value :TERMINATED, 12
56
+ value :HIDING, 13
57
+ value :HIDDEN, 14
58
+ value :UNHIDING, 15
59
+ end
60
+ add_enum "google.cloud.tpu.v1.Node.Health" do
61
+ value :HEALTH_UNSPECIFIED, 0
62
+ value :HEALTHY, 1
63
+ value :DEPRECATED_UNHEALTHY, 2
64
+ value :TIMEOUT, 3
65
+ value :UNHEALTHY_TENSORFLOW, 4
66
+ value :UNHEALTHY_MAINTENANCE, 5
67
+ end
68
+ add_enum "google.cloud.tpu.v1.Node.ApiVersion" do
69
+ value :API_VERSION_UNSPECIFIED, 0
70
+ value :V1_ALPHA1, 1
71
+ value :V1, 2
72
+ value :V2_ALPHA1, 3
73
+ end
74
+ add_message "google.cloud.tpu.v1.ListNodesRequest" do
75
+ optional :parent, :string, 1
76
+ optional :page_size, :int32, 2
77
+ optional :page_token, :string, 3
78
+ end
79
+ add_message "google.cloud.tpu.v1.ListNodesResponse" do
80
+ repeated :nodes, :message, 1, "google.cloud.tpu.v1.Node"
81
+ optional :next_page_token, :string, 2
82
+ repeated :unreachable, :string, 3
83
+ end
84
+ add_message "google.cloud.tpu.v1.GetNodeRequest" do
85
+ optional :name, :string, 1
86
+ end
87
+ add_message "google.cloud.tpu.v1.CreateNodeRequest" do
88
+ optional :parent, :string, 1
89
+ optional :node_id, :string, 2
90
+ optional :node, :message, 3, "google.cloud.tpu.v1.Node"
91
+ end
92
+ add_message "google.cloud.tpu.v1.DeleteNodeRequest" do
93
+ optional :name, :string, 1
94
+ end
95
+ add_message "google.cloud.tpu.v1.ReimageNodeRequest" do
96
+ optional :name, :string, 1
97
+ optional :tensorflow_version, :string, 2
98
+ end
99
+ add_message "google.cloud.tpu.v1.StopNodeRequest" do
100
+ optional :name, :string, 1
101
+ end
102
+ add_message "google.cloud.tpu.v1.StartNodeRequest" do
103
+ optional :name, :string, 1
104
+ end
105
+ add_message "google.cloud.tpu.v1.TensorFlowVersion" do
106
+ optional :name, :string, 1
107
+ optional :version, :string, 2
108
+ end
109
+ add_message "google.cloud.tpu.v1.GetTensorFlowVersionRequest" do
110
+ optional :name, :string, 1
111
+ end
112
+ add_message "google.cloud.tpu.v1.ListTensorFlowVersionsRequest" do
113
+ optional :parent, :string, 1
114
+ optional :page_size, :int32, 2
115
+ optional :page_token, :string, 3
116
+ optional :filter, :string, 5
117
+ optional :order_by, :string, 6
118
+ end
119
+ add_message "google.cloud.tpu.v1.ListTensorFlowVersionsResponse" do
120
+ repeated :tensorflow_versions, :message, 1, "google.cloud.tpu.v1.TensorFlowVersion"
121
+ optional :next_page_token, :string, 2
122
+ repeated :unreachable, :string, 3
123
+ end
124
+ add_message "google.cloud.tpu.v1.AcceleratorType" do
125
+ optional :name, :string, 1
126
+ optional :type, :string, 2
127
+ end
128
+ add_message "google.cloud.tpu.v1.GetAcceleratorTypeRequest" do
129
+ optional :name, :string, 1
130
+ end
131
+ add_message "google.cloud.tpu.v1.ListAcceleratorTypesRequest" do
132
+ optional :parent, :string, 1
133
+ optional :page_size, :int32, 2
134
+ optional :page_token, :string, 3
135
+ optional :filter, :string, 5
136
+ optional :order_by, :string, 6
137
+ end
138
+ add_message "google.cloud.tpu.v1.ListAcceleratorTypesResponse" do
139
+ repeated :accelerator_types, :message, 1, "google.cloud.tpu.v1.AcceleratorType"
140
+ optional :next_page_token, :string, 2
141
+ repeated :unreachable, :string, 3
142
+ end
143
+ add_message "google.cloud.tpu.v1.OperationMetadata" do
144
+ optional :create_time, :message, 1, "google.protobuf.Timestamp"
145
+ optional :end_time, :message, 2, "google.protobuf.Timestamp"
146
+ optional :target, :string, 3
147
+ optional :verb, :string, 4
148
+ optional :status_detail, :string, 5
149
+ optional :cancel_requested, :bool, 6
150
+ optional :api_version, :string, 7
151
+ end
152
+ add_message "google.cloud.tpu.v1.Symptom" do
153
+ optional :create_time, :message, 1, "google.protobuf.Timestamp"
154
+ optional :symptom_type, :enum, 2, "google.cloud.tpu.v1.Symptom.SymptomType"
155
+ optional :details, :string, 3
156
+ optional :worker_id, :string, 4
157
+ end
158
+ add_enum "google.cloud.tpu.v1.Symptom.SymptomType" do
159
+ value :SYMPTOM_TYPE_UNSPECIFIED, 0
160
+ value :LOW_MEMORY, 1
161
+ value :OUT_OF_MEMORY, 2
162
+ value :EXECUTE_TIMED_OUT, 3
163
+ value :MESH_BUILD_FAIL, 4
164
+ value :HBM_OUT_OF_MEMORY, 5
165
+ value :PROJECT_ABUSE, 6
166
+ end
167
+ end
168
+ end
169
+
170
+ module Google
171
+ module Cloud
172
+ module Tpu
173
+ module V1
174
+ SchedulingConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.SchedulingConfig").msgclass
175
+ NetworkEndpoint = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.NetworkEndpoint").msgclass
176
+ Node = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.Node").msgclass
177
+ Node::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.Node.State").enummodule
178
+ Node::Health = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.Node.Health").enummodule
179
+ Node::ApiVersion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.Node.ApiVersion").enummodule
180
+ ListNodesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.ListNodesRequest").msgclass
181
+ ListNodesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.ListNodesResponse").msgclass
182
+ GetNodeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.GetNodeRequest").msgclass
183
+ CreateNodeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.CreateNodeRequest").msgclass
184
+ DeleteNodeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.DeleteNodeRequest").msgclass
185
+ ReimageNodeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.ReimageNodeRequest").msgclass
186
+ StopNodeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.StopNodeRequest").msgclass
187
+ StartNodeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.StartNodeRequest").msgclass
188
+ TensorFlowVersion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.TensorFlowVersion").msgclass
189
+ GetTensorFlowVersionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.GetTensorFlowVersionRequest").msgclass
190
+ ListTensorFlowVersionsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.ListTensorFlowVersionsRequest").msgclass
191
+ ListTensorFlowVersionsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.ListTensorFlowVersionsResponse").msgclass
192
+ AcceleratorType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.AcceleratorType").msgclass
193
+ GetAcceleratorTypeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.GetAcceleratorTypeRequest").msgclass
194
+ ListAcceleratorTypesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.ListAcceleratorTypesRequest").msgclass
195
+ ListAcceleratorTypesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.ListAcceleratorTypesResponse").msgclass
196
+ OperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.OperationMetadata").msgclass
197
+ Symptom = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.Symptom").msgclass
198
+ Symptom::SymptomType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tpu.v1.Symptom.SymptomType").enummodule
199
+ end
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,67 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/tpu/v1/cloud_tpu.proto for package 'google.cloud.tpu.v1'
3
+ # Original file comments:
4
+ # Copyright 2021 Google LLC
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/cloud/tpu/v1/cloud_tpu_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Tpu
25
+ module V1
26
+ module Tpu
27
+ # Manages TPU nodes and other resources
28
+ #
29
+ # TPU API v1
30
+ class Service
31
+
32
+ include GRPC::GenericService
33
+
34
+ self.marshal_class_method = :encode
35
+ self.unmarshal_class_method = :decode
36
+ self.service_name = 'google.cloud.tpu.v1.Tpu'
37
+
38
+ # Lists nodes.
39
+ rpc :ListNodes, ::Google::Cloud::Tpu::V1::ListNodesRequest, ::Google::Cloud::Tpu::V1::ListNodesResponse
40
+ # Gets the details of a node.
41
+ rpc :GetNode, ::Google::Cloud::Tpu::V1::GetNodeRequest, ::Google::Cloud::Tpu::V1::Node
42
+ # Creates a node.
43
+ rpc :CreateNode, ::Google::Cloud::Tpu::V1::CreateNodeRequest, ::Google::Longrunning::Operation
44
+ # Deletes a node.
45
+ rpc :DeleteNode, ::Google::Cloud::Tpu::V1::DeleteNodeRequest, ::Google::Longrunning::Operation
46
+ # Reimages a node's OS.
47
+ rpc :ReimageNode, ::Google::Cloud::Tpu::V1::ReimageNodeRequest, ::Google::Longrunning::Operation
48
+ # Stops a node.
49
+ rpc :StopNode, ::Google::Cloud::Tpu::V1::StopNodeRequest, ::Google::Longrunning::Operation
50
+ # Starts a node.
51
+ rpc :StartNode, ::Google::Cloud::Tpu::V1::StartNodeRequest, ::Google::Longrunning::Operation
52
+ # List TensorFlow versions supported by this API.
53
+ rpc :ListTensorFlowVersions, ::Google::Cloud::Tpu::V1::ListTensorFlowVersionsRequest, ::Google::Cloud::Tpu::V1::ListTensorFlowVersionsResponse
54
+ # Gets TensorFlow Version.
55
+ rpc :GetTensorFlowVersion, ::Google::Cloud::Tpu::V1::GetTensorFlowVersionRequest, ::Google::Cloud::Tpu::V1::TensorFlowVersion
56
+ # Lists accelerator types supported by this API.
57
+ rpc :ListAcceleratorTypes, ::Google::Cloud::Tpu::V1::ListAcceleratorTypesRequest, ::Google::Cloud::Tpu::V1::ListAcceleratorTypesResponse
58
+ # Gets AcceleratorType.
59
+ rpc :GetAcceleratorType, ::Google::Cloud::Tpu::V1::GetAcceleratorTypeRequest, ::Google::Cloud::Tpu::V1::AcceleratorType
60
+ end
61
+
62
+ Stub = Service.rpc_stub_class
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/tpu/v1/version"
24
+
25
+ require "google/cloud/tpu/v1/tpu/credentials"
26
+ require "google/cloud/tpu/v1/tpu/paths"
27
+ require "google/cloud/tpu/v1/tpu/operations"
28
+ require "google/cloud/tpu/v1/tpu/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Tpu
33
+ module V1
34
+ ##
35
+ # Manages TPU nodes and other resources
36
+ #
37
+ # TPU API v1
38
+ #
39
+ # To load this service and instantiate a client:
40
+ #
41
+ # require "google/cloud/tpu/v1/tpu"
42
+ # client = ::Google::Cloud::Tpu::V1::Tpu::Client.new
43
+ #
44
+ module Tpu
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ helper_path = ::File.join __dir__, "tpu", "helpers.rb"
52
+ require "google/cloud/tpu/v1/tpu/helpers" if ::File.file? helper_path
@@ -0,0 +1,1155 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/tpu/v1/cloud_tpu_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Tpu
25
+ module V1
26
+ module Tpu
27
+ ##
28
+ # Client for the Tpu service.
29
+ #
30
+ # Manages TPU nodes and other resources
31
+ #
32
+ # TPU API v1
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :tpu_stub
39
+
40
+ ##
41
+ # Configure the Tpu Client class.
42
+ #
43
+ # See {::Google::Cloud::Tpu::V1::Tpu::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # ## Example
47
+ #
48
+ # To modify the configuration for all Tpu clients:
49
+ #
50
+ # ::Google::Cloud::Tpu::V1::Tpu::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Tpu", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 60.0
71
+
72
+ default_config
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the Tpu Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::Tpu::V1::Tpu::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # Create a new Tpu client object.
100
+ #
101
+ # ## Examples
102
+ #
103
+ # To create a new Tpu client with the default
104
+ # configuration:
105
+ #
106
+ # client = ::Google::Cloud::Tpu::V1::Tpu::Client.new
107
+ #
108
+ # To create a new Tpu client with a custom
109
+ # configuration:
110
+ #
111
+ # client = ::Google::Cloud::Tpu::V1::Tpu::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the Tpu client.
116
+ # @yieldparam config [Client::Configuration]
117
+ #
118
+ def initialize
119
+ # These require statements are intentionally placed here to initialize
120
+ # the gRPC module only when it's required.
121
+ # See https://github.com/googleapis/toolkit/issues/446
122
+ require "gapic/grpc"
123
+ require "google/cloud/tpu/v1/cloud_tpu_services_pb"
124
+
125
+ # Create the configuration object
126
+ @config = Configuration.new Client.configure
127
+
128
+ # Yield the configuration if needed
129
+ yield @config if block_given?
130
+
131
+ # Create credentials
132
+ credentials = @config.credentials
133
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
134
+ # but only if the default endpoint does not have a region prefix.
135
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
136
+ @config.endpoint == Client.configure.endpoint &&
137
+ !@config.endpoint.split(".").first.include?("-")
138
+ credentials ||= Credentials.default scope: @config.scope,
139
+ enable_self_signed_jwt: enable_self_signed_jwt
140
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
141
+ credentials = Credentials.new credentials, scope: @config.scope
142
+ end
143
+ @quota_project_id = @config.quota_project
144
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
145
+
146
+ @operations_client = Operations.new do |config|
147
+ config.credentials = credentials
148
+ config.endpoint = @config.endpoint
149
+ end
150
+
151
+ @tpu_stub = ::Gapic::ServiceStub.new(
152
+ ::Google::Cloud::Tpu::V1::Tpu::Stub,
153
+ credentials: credentials,
154
+ endpoint: @config.endpoint,
155
+ channel_args: @config.channel_args,
156
+ interceptors: @config.interceptors
157
+ )
158
+ end
159
+
160
+ ##
161
+ # Get the associated client for long-running operations.
162
+ #
163
+ # @return [::Google::Cloud::Tpu::V1::Tpu::Operations]
164
+ #
165
+ attr_reader :operations_client
166
+
167
+ # Service calls
168
+
169
+ ##
170
+ # Lists nodes.
171
+ #
172
+ # @overload list_nodes(request, options = nil)
173
+ # Pass arguments to `list_nodes` via a request object, either of type
174
+ # {::Google::Cloud::Tpu::V1::ListNodesRequest} or an equivalent Hash.
175
+ #
176
+ # @param request [::Google::Cloud::Tpu::V1::ListNodesRequest, ::Hash]
177
+ # A request object representing the call parameters. Required. To specify no
178
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
179
+ # @param options [::Gapic::CallOptions, ::Hash]
180
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
181
+ #
182
+ # @overload list_nodes(parent: nil, page_size: nil, page_token: nil)
183
+ # Pass arguments to `list_nodes` via keyword arguments. Note that at
184
+ # least one keyword argument is required. To specify no parameters, or to keep all
185
+ # the default parameter values, pass an empty Hash as a request object (see above).
186
+ #
187
+ # @param parent [::String]
188
+ # Required. The parent resource name.
189
+ # @param page_size [::Integer]
190
+ # The maximum number of items to return.
191
+ # @param page_token [::String]
192
+ # The next_page_token value returned from a previous List request, if any.
193
+ #
194
+ # @yield [response, operation] Access the result along with the RPC operation
195
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::Node>]
196
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
197
+ #
198
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::Node>]
199
+ #
200
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
201
+ #
202
+ def list_nodes request, options = nil
203
+ raise ::ArgumentError, "request must be provided" if request.nil?
204
+
205
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::ListNodesRequest
206
+
207
+ # Converts hash and nil to an options object
208
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
209
+
210
+ # Customize the options with defaults
211
+ metadata = @config.rpcs.list_nodes.metadata.to_h
212
+
213
+ # Set x-goog-api-client and x-goog-user-project headers
214
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
215
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
216
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
217
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
218
+
219
+ header_params = {
220
+ "parent" => request.parent
221
+ }
222
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
223
+ metadata[:"x-goog-request-params"] ||= request_params_header
224
+
225
+ options.apply_defaults timeout: @config.rpcs.list_nodes.timeout,
226
+ metadata: metadata,
227
+ retry_policy: @config.rpcs.list_nodes.retry_policy
228
+ options.apply_defaults metadata: @config.metadata,
229
+ retry_policy: @config.retry_policy
230
+
231
+ @tpu_stub.call_rpc :list_nodes, request, options: options do |response, operation|
232
+ response = ::Gapic::PagedEnumerable.new @tpu_stub, :list_nodes, request, response, operation, options
233
+ yield response, operation if block_given?
234
+ return response
235
+ end
236
+ rescue ::GRPC::BadStatus => e
237
+ raise ::Google::Cloud::Error.from_error(e)
238
+ end
239
+
240
+ ##
241
+ # Gets the details of a node.
242
+ #
243
+ # @overload get_node(request, options = nil)
244
+ # Pass arguments to `get_node` via a request object, either of type
245
+ # {::Google::Cloud::Tpu::V1::GetNodeRequest} or an equivalent Hash.
246
+ #
247
+ # @param request [::Google::Cloud::Tpu::V1::GetNodeRequest, ::Hash]
248
+ # A request object representing the call parameters. Required. To specify no
249
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
250
+ # @param options [::Gapic::CallOptions, ::Hash]
251
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
252
+ #
253
+ # @overload get_node(name: nil)
254
+ # Pass arguments to `get_node` via keyword arguments. Note that at
255
+ # least one keyword argument is required. To specify no parameters, or to keep all
256
+ # the default parameter values, pass an empty Hash as a request object (see above).
257
+ #
258
+ # @param name [::String]
259
+ # Required. The resource name.
260
+ #
261
+ # @yield [response, operation] Access the result along with the RPC operation
262
+ # @yieldparam response [::Google::Cloud::Tpu::V1::Node]
263
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
264
+ #
265
+ # @return [::Google::Cloud::Tpu::V1::Node]
266
+ #
267
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
268
+ #
269
+ def get_node request, options = nil
270
+ raise ::ArgumentError, "request must be provided" if request.nil?
271
+
272
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::GetNodeRequest
273
+
274
+ # Converts hash and nil to an options object
275
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
276
+
277
+ # Customize the options with defaults
278
+ metadata = @config.rpcs.get_node.metadata.to_h
279
+
280
+ # Set x-goog-api-client and x-goog-user-project headers
281
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
282
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
283
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
284
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
285
+
286
+ header_params = {
287
+ "name" => request.name
288
+ }
289
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
290
+ metadata[:"x-goog-request-params"] ||= request_params_header
291
+
292
+ options.apply_defaults timeout: @config.rpcs.get_node.timeout,
293
+ metadata: metadata,
294
+ retry_policy: @config.rpcs.get_node.retry_policy
295
+ options.apply_defaults metadata: @config.metadata,
296
+ retry_policy: @config.retry_policy
297
+
298
+ @tpu_stub.call_rpc :get_node, request, options: options do |response, operation|
299
+ yield response, operation if block_given?
300
+ return response
301
+ end
302
+ rescue ::GRPC::BadStatus => e
303
+ raise ::Google::Cloud::Error.from_error(e)
304
+ end
305
+
306
+ ##
307
+ # Creates a node.
308
+ #
309
+ # @overload create_node(request, options = nil)
310
+ # Pass arguments to `create_node` via a request object, either of type
311
+ # {::Google::Cloud::Tpu::V1::CreateNodeRequest} or an equivalent Hash.
312
+ #
313
+ # @param request [::Google::Cloud::Tpu::V1::CreateNodeRequest, ::Hash]
314
+ # A request object representing the call parameters. Required. To specify no
315
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
316
+ # @param options [::Gapic::CallOptions, ::Hash]
317
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
318
+ #
319
+ # @overload create_node(parent: nil, node_id: nil, node: nil)
320
+ # Pass arguments to `create_node` via keyword arguments. Note that at
321
+ # least one keyword argument is required. To specify no parameters, or to keep all
322
+ # the default parameter values, pass an empty Hash as a request object (see above).
323
+ #
324
+ # @param parent [::String]
325
+ # Required. The parent resource name.
326
+ # @param node_id [::String]
327
+ # The unqualified resource name.
328
+ # @param node [::Google::Cloud::Tpu::V1::Node, ::Hash]
329
+ # Required. The node.
330
+ #
331
+ # @yield [response, operation] Access the result along with the RPC operation
332
+ # @yieldparam response [::Gapic::Operation]
333
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
334
+ #
335
+ # @return [::Gapic::Operation]
336
+ #
337
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
338
+ #
339
+ def create_node request, options = nil
340
+ raise ::ArgumentError, "request must be provided" if request.nil?
341
+
342
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::CreateNodeRequest
343
+
344
+ # Converts hash and nil to an options object
345
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
346
+
347
+ # Customize the options with defaults
348
+ metadata = @config.rpcs.create_node.metadata.to_h
349
+
350
+ # Set x-goog-api-client and x-goog-user-project headers
351
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
352
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
353
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
354
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
355
+
356
+ header_params = {
357
+ "parent" => request.parent
358
+ }
359
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
360
+ metadata[:"x-goog-request-params"] ||= request_params_header
361
+
362
+ options.apply_defaults timeout: @config.rpcs.create_node.timeout,
363
+ metadata: metadata,
364
+ retry_policy: @config.rpcs.create_node.retry_policy
365
+ options.apply_defaults metadata: @config.metadata,
366
+ retry_policy: @config.retry_policy
367
+
368
+ @tpu_stub.call_rpc :create_node, request, options: options do |response, operation|
369
+ response = ::Gapic::Operation.new response, @operations_client, options: options
370
+ yield response, operation if block_given?
371
+ return response
372
+ end
373
+ rescue ::GRPC::BadStatus => e
374
+ raise ::Google::Cloud::Error.from_error(e)
375
+ end
376
+
377
+ ##
378
+ # Deletes a node.
379
+ #
380
+ # @overload delete_node(request, options = nil)
381
+ # Pass arguments to `delete_node` via a request object, either of type
382
+ # {::Google::Cloud::Tpu::V1::DeleteNodeRequest} or an equivalent Hash.
383
+ #
384
+ # @param request [::Google::Cloud::Tpu::V1::DeleteNodeRequest, ::Hash]
385
+ # A request object representing the call parameters. Required. To specify no
386
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
387
+ # @param options [::Gapic::CallOptions, ::Hash]
388
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
389
+ #
390
+ # @overload delete_node(name: nil)
391
+ # Pass arguments to `delete_node` via keyword arguments. Note that at
392
+ # least one keyword argument is required. To specify no parameters, or to keep all
393
+ # the default parameter values, pass an empty Hash as a request object (see above).
394
+ #
395
+ # @param name [::String]
396
+ # Required. The resource name.
397
+ #
398
+ # @yield [response, operation] Access the result along with the RPC operation
399
+ # @yieldparam response [::Gapic::Operation]
400
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
401
+ #
402
+ # @return [::Gapic::Operation]
403
+ #
404
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
405
+ #
406
+ def delete_node request, options = nil
407
+ raise ::ArgumentError, "request must be provided" if request.nil?
408
+
409
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::DeleteNodeRequest
410
+
411
+ # Converts hash and nil to an options object
412
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
413
+
414
+ # Customize the options with defaults
415
+ metadata = @config.rpcs.delete_node.metadata.to_h
416
+
417
+ # Set x-goog-api-client and x-goog-user-project headers
418
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
419
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
420
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
421
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
422
+
423
+ header_params = {
424
+ "name" => request.name
425
+ }
426
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
427
+ metadata[:"x-goog-request-params"] ||= request_params_header
428
+
429
+ options.apply_defaults timeout: @config.rpcs.delete_node.timeout,
430
+ metadata: metadata,
431
+ retry_policy: @config.rpcs.delete_node.retry_policy
432
+ options.apply_defaults metadata: @config.metadata,
433
+ retry_policy: @config.retry_policy
434
+
435
+ @tpu_stub.call_rpc :delete_node, request, options: options do |response, operation|
436
+ response = ::Gapic::Operation.new response, @operations_client, options: options
437
+ yield response, operation if block_given?
438
+ return response
439
+ end
440
+ rescue ::GRPC::BadStatus => e
441
+ raise ::Google::Cloud::Error.from_error(e)
442
+ end
443
+
444
+ ##
445
+ # Reimages a node's OS.
446
+ #
447
+ # @overload reimage_node(request, options = nil)
448
+ # Pass arguments to `reimage_node` via a request object, either of type
449
+ # {::Google::Cloud::Tpu::V1::ReimageNodeRequest} or an equivalent Hash.
450
+ #
451
+ # @param request [::Google::Cloud::Tpu::V1::ReimageNodeRequest, ::Hash]
452
+ # A request object representing the call parameters. Required. To specify no
453
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
454
+ # @param options [::Gapic::CallOptions, ::Hash]
455
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
456
+ #
457
+ # @overload reimage_node(name: nil, tensorflow_version: nil)
458
+ # Pass arguments to `reimage_node` via keyword arguments. Note that at
459
+ # least one keyword argument is required. To specify no parameters, or to keep all
460
+ # the default parameter values, pass an empty Hash as a request object (see above).
461
+ #
462
+ # @param name [::String]
463
+ # The resource name.
464
+ # @param tensorflow_version [::String]
465
+ # The version for reimage to create.
466
+ #
467
+ # @yield [response, operation] Access the result along with the RPC operation
468
+ # @yieldparam response [::Gapic::Operation]
469
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
470
+ #
471
+ # @return [::Gapic::Operation]
472
+ #
473
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
474
+ #
475
+ def reimage_node request, options = nil
476
+ raise ::ArgumentError, "request must be provided" if request.nil?
477
+
478
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::ReimageNodeRequest
479
+
480
+ # Converts hash and nil to an options object
481
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
482
+
483
+ # Customize the options with defaults
484
+ metadata = @config.rpcs.reimage_node.metadata.to_h
485
+
486
+ # Set x-goog-api-client and x-goog-user-project headers
487
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
488
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
489
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
490
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
491
+
492
+ header_params = {
493
+ "name" => request.name
494
+ }
495
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
496
+ metadata[:"x-goog-request-params"] ||= request_params_header
497
+
498
+ options.apply_defaults timeout: @config.rpcs.reimage_node.timeout,
499
+ metadata: metadata,
500
+ retry_policy: @config.rpcs.reimage_node.retry_policy
501
+ options.apply_defaults metadata: @config.metadata,
502
+ retry_policy: @config.retry_policy
503
+
504
+ @tpu_stub.call_rpc :reimage_node, request, options: options do |response, operation|
505
+ response = ::Gapic::Operation.new response, @operations_client, options: options
506
+ yield response, operation if block_given?
507
+ return response
508
+ end
509
+ rescue ::GRPC::BadStatus => e
510
+ raise ::Google::Cloud::Error.from_error(e)
511
+ end
512
+
513
+ ##
514
+ # Stops a node.
515
+ #
516
+ # @overload stop_node(request, options = nil)
517
+ # Pass arguments to `stop_node` via a request object, either of type
518
+ # {::Google::Cloud::Tpu::V1::StopNodeRequest} or an equivalent Hash.
519
+ #
520
+ # @param request [::Google::Cloud::Tpu::V1::StopNodeRequest, ::Hash]
521
+ # A request object representing the call parameters. Required. To specify no
522
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
523
+ # @param options [::Gapic::CallOptions, ::Hash]
524
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
525
+ #
526
+ # @overload stop_node(name: nil)
527
+ # Pass arguments to `stop_node` via keyword arguments. Note that at
528
+ # least one keyword argument is required. To specify no parameters, or to keep all
529
+ # the default parameter values, pass an empty Hash as a request object (see above).
530
+ #
531
+ # @param name [::String]
532
+ # The resource name.
533
+ #
534
+ # @yield [response, operation] Access the result along with the RPC operation
535
+ # @yieldparam response [::Gapic::Operation]
536
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
537
+ #
538
+ # @return [::Gapic::Operation]
539
+ #
540
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
541
+ #
542
+ def stop_node request, options = nil
543
+ raise ::ArgumentError, "request must be provided" if request.nil?
544
+
545
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::StopNodeRequest
546
+
547
+ # Converts hash and nil to an options object
548
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
549
+
550
+ # Customize the options with defaults
551
+ metadata = @config.rpcs.stop_node.metadata.to_h
552
+
553
+ # Set x-goog-api-client and x-goog-user-project headers
554
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
555
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
556
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
557
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
558
+
559
+ header_params = {
560
+ "name" => request.name
561
+ }
562
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
563
+ metadata[:"x-goog-request-params"] ||= request_params_header
564
+
565
+ options.apply_defaults timeout: @config.rpcs.stop_node.timeout,
566
+ metadata: metadata,
567
+ retry_policy: @config.rpcs.stop_node.retry_policy
568
+ options.apply_defaults metadata: @config.metadata,
569
+ retry_policy: @config.retry_policy
570
+
571
+ @tpu_stub.call_rpc :stop_node, request, options: options do |response, operation|
572
+ response = ::Gapic::Operation.new response, @operations_client, options: options
573
+ yield response, operation if block_given?
574
+ return response
575
+ end
576
+ rescue ::GRPC::BadStatus => e
577
+ raise ::Google::Cloud::Error.from_error(e)
578
+ end
579
+
580
+ ##
581
+ # Starts a node.
582
+ #
583
+ # @overload start_node(request, options = nil)
584
+ # Pass arguments to `start_node` via a request object, either of type
585
+ # {::Google::Cloud::Tpu::V1::StartNodeRequest} or an equivalent Hash.
586
+ #
587
+ # @param request [::Google::Cloud::Tpu::V1::StartNodeRequest, ::Hash]
588
+ # A request object representing the call parameters. Required. To specify no
589
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
590
+ # @param options [::Gapic::CallOptions, ::Hash]
591
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
592
+ #
593
+ # @overload start_node(name: nil)
594
+ # Pass arguments to `start_node` via keyword arguments. Note that at
595
+ # least one keyword argument is required. To specify no parameters, or to keep all
596
+ # the default parameter values, pass an empty Hash as a request object (see above).
597
+ #
598
+ # @param name [::String]
599
+ # The resource name.
600
+ #
601
+ # @yield [response, operation] Access the result along with the RPC operation
602
+ # @yieldparam response [::Gapic::Operation]
603
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
604
+ #
605
+ # @return [::Gapic::Operation]
606
+ #
607
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
608
+ #
609
+ def start_node request, options = nil
610
+ raise ::ArgumentError, "request must be provided" if request.nil?
611
+
612
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::StartNodeRequest
613
+
614
+ # Converts hash and nil to an options object
615
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
616
+
617
+ # Customize the options with defaults
618
+ metadata = @config.rpcs.start_node.metadata.to_h
619
+
620
+ # Set x-goog-api-client and x-goog-user-project headers
621
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
622
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
623
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
624
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
625
+
626
+ header_params = {
627
+ "name" => request.name
628
+ }
629
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
630
+ metadata[:"x-goog-request-params"] ||= request_params_header
631
+
632
+ options.apply_defaults timeout: @config.rpcs.start_node.timeout,
633
+ metadata: metadata,
634
+ retry_policy: @config.rpcs.start_node.retry_policy
635
+ options.apply_defaults metadata: @config.metadata,
636
+ retry_policy: @config.retry_policy
637
+
638
+ @tpu_stub.call_rpc :start_node, request, options: options do |response, operation|
639
+ response = ::Gapic::Operation.new response, @operations_client, options: options
640
+ yield response, operation if block_given?
641
+ return response
642
+ end
643
+ rescue ::GRPC::BadStatus => e
644
+ raise ::Google::Cloud::Error.from_error(e)
645
+ end
646
+
647
+ ##
648
+ # List TensorFlow versions supported by this API.
649
+ #
650
+ # @overload list_tensor_flow_versions(request, options = nil)
651
+ # Pass arguments to `list_tensor_flow_versions` via a request object, either of type
652
+ # {::Google::Cloud::Tpu::V1::ListTensorFlowVersionsRequest} or an equivalent Hash.
653
+ #
654
+ # @param request [::Google::Cloud::Tpu::V1::ListTensorFlowVersionsRequest, ::Hash]
655
+ # A request object representing the call parameters. Required. To specify no
656
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
657
+ # @param options [::Gapic::CallOptions, ::Hash]
658
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
659
+ #
660
+ # @overload list_tensor_flow_versions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
661
+ # Pass arguments to `list_tensor_flow_versions` via keyword arguments. Note that at
662
+ # least one keyword argument is required. To specify no parameters, or to keep all
663
+ # the default parameter values, pass an empty Hash as a request object (see above).
664
+ #
665
+ # @param parent [::String]
666
+ # Required. The parent resource name.
667
+ # @param page_size [::Integer]
668
+ # The maximum number of items to return.
669
+ # @param page_token [::String]
670
+ # The next_page_token value returned from a previous List request, if any.
671
+ # @param filter [::String]
672
+ # List filter.
673
+ # @param order_by [::String]
674
+ # Sort results.
675
+ #
676
+ # @yield [response, operation] Access the result along with the RPC operation
677
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::TensorFlowVersion>]
678
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
679
+ #
680
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::TensorFlowVersion>]
681
+ #
682
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
683
+ #
684
+ def list_tensor_flow_versions request, options = nil
685
+ raise ::ArgumentError, "request must be provided" if request.nil?
686
+
687
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::ListTensorFlowVersionsRequest
688
+
689
+ # Converts hash and nil to an options object
690
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
691
+
692
+ # Customize the options with defaults
693
+ metadata = @config.rpcs.list_tensor_flow_versions.metadata.to_h
694
+
695
+ # Set x-goog-api-client and x-goog-user-project headers
696
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
697
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
698
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
699
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
700
+
701
+ header_params = {
702
+ "parent" => request.parent
703
+ }
704
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
705
+ metadata[:"x-goog-request-params"] ||= request_params_header
706
+
707
+ options.apply_defaults timeout: @config.rpcs.list_tensor_flow_versions.timeout,
708
+ metadata: metadata,
709
+ retry_policy: @config.rpcs.list_tensor_flow_versions.retry_policy
710
+ options.apply_defaults metadata: @config.metadata,
711
+ retry_policy: @config.retry_policy
712
+
713
+ @tpu_stub.call_rpc :list_tensor_flow_versions, request, options: options do |response, operation|
714
+ response = ::Gapic::PagedEnumerable.new @tpu_stub, :list_tensor_flow_versions, request, response, operation, options
715
+ yield response, operation if block_given?
716
+ return response
717
+ end
718
+ rescue ::GRPC::BadStatus => e
719
+ raise ::Google::Cloud::Error.from_error(e)
720
+ end
721
+
722
+ ##
723
+ # Gets TensorFlow Version.
724
+ #
725
+ # @overload get_tensor_flow_version(request, options = nil)
726
+ # Pass arguments to `get_tensor_flow_version` via a request object, either of type
727
+ # {::Google::Cloud::Tpu::V1::GetTensorFlowVersionRequest} or an equivalent Hash.
728
+ #
729
+ # @param request [::Google::Cloud::Tpu::V1::GetTensorFlowVersionRequest, ::Hash]
730
+ # A request object representing the call parameters. Required. To specify no
731
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
732
+ # @param options [::Gapic::CallOptions, ::Hash]
733
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
734
+ #
735
+ # @overload get_tensor_flow_version(name: nil)
736
+ # Pass arguments to `get_tensor_flow_version` via keyword arguments. Note that at
737
+ # least one keyword argument is required. To specify no parameters, or to keep all
738
+ # the default parameter values, pass an empty Hash as a request object (see above).
739
+ #
740
+ # @param name [::String]
741
+ # Required. The resource name.
742
+ #
743
+ # @yield [response, operation] Access the result along with the RPC operation
744
+ # @yieldparam response [::Google::Cloud::Tpu::V1::TensorFlowVersion]
745
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
746
+ #
747
+ # @return [::Google::Cloud::Tpu::V1::TensorFlowVersion]
748
+ #
749
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
750
+ #
751
+ def get_tensor_flow_version request, options = nil
752
+ raise ::ArgumentError, "request must be provided" if request.nil?
753
+
754
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::GetTensorFlowVersionRequest
755
+
756
+ # Converts hash and nil to an options object
757
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
758
+
759
+ # Customize the options with defaults
760
+ metadata = @config.rpcs.get_tensor_flow_version.metadata.to_h
761
+
762
+ # Set x-goog-api-client and x-goog-user-project headers
763
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
764
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
765
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
766
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
767
+
768
+ header_params = {
769
+ "name" => request.name
770
+ }
771
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
772
+ metadata[:"x-goog-request-params"] ||= request_params_header
773
+
774
+ options.apply_defaults timeout: @config.rpcs.get_tensor_flow_version.timeout,
775
+ metadata: metadata,
776
+ retry_policy: @config.rpcs.get_tensor_flow_version.retry_policy
777
+ options.apply_defaults metadata: @config.metadata,
778
+ retry_policy: @config.retry_policy
779
+
780
+ @tpu_stub.call_rpc :get_tensor_flow_version, request, options: options do |response, operation|
781
+ yield response, operation if block_given?
782
+ return response
783
+ end
784
+ rescue ::GRPC::BadStatus => e
785
+ raise ::Google::Cloud::Error.from_error(e)
786
+ end
787
+
788
+ ##
789
+ # Lists accelerator types supported by this API.
790
+ #
791
+ # @overload list_accelerator_types(request, options = nil)
792
+ # Pass arguments to `list_accelerator_types` via a request object, either of type
793
+ # {::Google::Cloud::Tpu::V1::ListAcceleratorTypesRequest} or an equivalent Hash.
794
+ #
795
+ # @param request [::Google::Cloud::Tpu::V1::ListAcceleratorTypesRequest, ::Hash]
796
+ # A request object representing the call parameters. Required. To specify no
797
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
798
+ # @param options [::Gapic::CallOptions, ::Hash]
799
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
800
+ #
801
+ # @overload list_accelerator_types(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
802
+ # Pass arguments to `list_accelerator_types` via keyword arguments. Note that at
803
+ # least one keyword argument is required. To specify no parameters, or to keep all
804
+ # the default parameter values, pass an empty Hash as a request object (see above).
805
+ #
806
+ # @param parent [::String]
807
+ # Required. The parent resource name.
808
+ # @param page_size [::Integer]
809
+ # The maximum number of items to return.
810
+ # @param page_token [::String]
811
+ # The next_page_token value returned from a previous List request, if any.
812
+ # @param filter [::String]
813
+ # List filter.
814
+ # @param order_by [::String]
815
+ # Sort results.
816
+ #
817
+ # @yield [response, operation] Access the result along with the RPC operation
818
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::AcceleratorType>]
819
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
820
+ #
821
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::AcceleratorType>]
822
+ #
823
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
824
+ #
825
+ def list_accelerator_types request, options = nil
826
+ raise ::ArgumentError, "request must be provided" if request.nil?
827
+
828
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::ListAcceleratorTypesRequest
829
+
830
+ # Converts hash and nil to an options object
831
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
832
+
833
+ # Customize the options with defaults
834
+ metadata = @config.rpcs.list_accelerator_types.metadata.to_h
835
+
836
+ # Set x-goog-api-client and x-goog-user-project headers
837
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
838
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
839
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
840
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
841
+
842
+ header_params = {
843
+ "parent" => request.parent
844
+ }
845
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
846
+ metadata[:"x-goog-request-params"] ||= request_params_header
847
+
848
+ options.apply_defaults timeout: @config.rpcs.list_accelerator_types.timeout,
849
+ metadata: metadata,
850
+ retry_policy: @config.rpcs.list_accelerator_types.retry_policy
851
+ options.apply_defaults metadata: @config.metadata,
852
+ retry_policy: @config.retry_policy
853
+
854
+ @tpu_stub.call_rpc :list_accelerator_types, request, options: options do |response, operation|
855
+ response = ::Gapic::PagedEnumerable.new @tpu_stub, :list_accelerator_types, request, response, operation, options
856
+ yield response, operation if block_given?
857
+ return response
858
+ end
859
+ rescue ::GRPC::BadStatus => e
860
+ raise ::Google::Cloud::Error.from_error(e)
861
+ end
862
+
863
+ ##
864
+ # Gets AcceleratorType.
865
+ #
866
+ # @overload get_accelerator_type(request, options = nil)
867
+ # Pass arguments to `get_accelerator_type` via a request object, either of type
868
+ # {::Google::Cloud::Tpu::V1::GetAcceleratorTypeRequest} or an equivalent Hash.
869
+ #
870
+ # @param request [::Google::Cloud::Tpu::V1::GetAcceleratorTypeRequest, ::Hash]
871
+ # A request object representing the call parameters. Required. To specify no
872
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
873
+ # @param options [::Gapic::CallOptions, ::Hash]
874
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
875
+ #
876
+ # @overload get_accelerator_type(name: nil)
877
+ # Pass arguments to `get_accelerator_type` via keyword arguments. Note that at
878
+ # least one keyword argument is required. To specify no parameters, or to keep all
879
+ # the default parameter values, pass an empty Hash as a request object (see above).
880
+ #
881
+ # @param name [::String]
882
+ # Required. The resource name.
883
+ #
884
+ # @yield [response, operation] Access the result along with the RPC operation
885
+ # @yieldparam response [::Google::Cloud::Tpu::V1::AcceleratorType]
886
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
887
+ #
888
+ # @return [::Google::Cloud::Tpu::V1::AcceleratorType]
889
+ #
890
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
891
+ #
892
+ def get_accelerator_type request, options = nil
893
+ raise ::ArgumentError, "request must be provided" if request.nil?
894
+
895
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tpu::V1::GetAcceleratorTypeRequest
896
+
897
+ # Converts hash and nil to an options object
898
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
899
+
900
+ # Customize the options with defaults
901
+ metadata = @config.rpcs.get_accelerator_type.metadata.to_h
902
+
903
+ # Set x-goog-api-client and x-goog-user-project headers
904
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
905
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
906
+ gapic_version: ::Google::Cloud::Tpu::V1::VERSION
907
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
908
+
909
+ header_params = {
910
+ "name" => request.name
911
+ }
912
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
913
+ metadata[:"x-goog-request-params"] ||= request_params_header
914
+
915
+ options.apply_defaults timeout: @config.rpcs.get_accelerator_type.timeout,
916
+ metadata: metadata,
917
+ retry_policy: @config.rpcs.get_accelerator_type.retry_policy
918
+ options.apply_defaults metadata: @config.metadata,
919
+ retry_policy: @config.retry_policy
920
+
921
+ @tpu_stub.call_rpc :get_accelerator_type, request, options: options do |response, operation|
922
+ yield response, operation if block_given?
923
+ return response
924
+ end
925
+ rescue ::GRPC::BadStatus => e
926
+ raise ::Google::Cloud::Error.from_error(e)
927
+ end
928
+
929
+ ##
930
+ # Configuration class for the Tpu API.
931
+ #
932
+ # This class represents the configuration for Tpu,
933
+ # providing control over timeouts, retry behavior, logging, transport
934
+ # parameters, and other low-level controls. Certain parameters can also be
935
+ # applied individually to specific RPCs. See
936
+ # {::Google::Cloud::Tpu::V1::Tpu::Client::Configuration::Rpcs}
937
+ # for a list of RPCs that can be configured independently.
938
+ #
939
+ # Configuration can be applied globally to all clients, or to a single client
940
+ # on construction.
941
+ #
942
+ # # Examples
943
+ #
944
+ # To modify the global config, setting the timeout for list_nodes
945
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
946
+ #
947
+ # ::Google::Cloud::Tpu::V1::Tpu::Client.configure do |config|
948
+ # config.timeout = 10.0
949
+ # config.rpcs.list_nodes.timeout = 20.0
950
+ # end
951
+ #
952
+ # To apply the above configuration only to a new client:
953
+ #
954
+ # client = ::Google::Cloud::Tpu::V1::Tpu::Client.new do |config|
955
+ # config.timeout = 10.0
956
+ # config.rpcs.list_nodes.timeout = 20.0
957
+ # end
958
+ #
959
+ # @!attribute [rw] endpoint
960
+ # The hostname or hostname:port of the service endpoint.
961
+ # Defaults to `"tpu.googleapis.com"`.
962
+ # @return [::String]
963
+ # @!attribute [rw] credentials
964
+ # Credentials to send with calls. You may provide any of the following types:
965
+ # * (`String`) The path to a service account key file in JSON format
966
+ # * (`Hash`) A service account key as a Hash
967
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
968
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
969
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
970
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
971
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
972
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
973
+ # * (`nil`) indicating no credentials
974
+ # @return [::Object]
975
+ # @!attribute [rw] scope
976
+ # The OAuth scopes
977
+ # @return [::Array<::String>]
978
+ # @!attribute [rw] lib_name
979
+ # The library name as recorded in instrumentation and logging
980
+ # @return [::String]
981
+ # @!attribute [rw] lib_version
982
+ # The library version as recorded in instrumentation and logging
983
+ # @return [::String]
984
+ # @!attribute [rw] channel_args
985
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
986
+ # `GRPC::Core::Channel` object is provided as the credential.
987
+ # @return [::Hash]
988
+ # @!attribute [rw] interceptors
989
+ # An array of interceptors that are run before calls are executed.
990
+ # @return [::Array<::GRPC::ClientInterceptor>]
991
+ # @!attribute [rw] timeout
992
+ # The call timeout in seconds.
993
+ # @return [::Numeric]
994
+ # @!attribute [rw] metadata
995
+ # Additional gRPC headers to be sent with the call.
996
+ # @return [::Hash{::Symbol=>::String}]
997
+ # @!attribute [rw] retry_policy
998
+ # The retry policy. The value is a hash with the following keys:
999
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1000
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1001
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1002
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1003
+ # trigger a retry.
1004
+ # @return [::Hash]
1005
+ # @!attribute [rw] quota_project
1006
+ # A separate project against which to charge quota.
1007
+ # @return [::String]
1008
+ #
1009
+ class Configuration
1010
+ extend ::Gapic::Config
1011
+
1012
+ config_attr :endpoint, "tpu.googleapis.com", ::String
1013
+ config_attr :credentials, nil do |value|
1014
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1015
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1016
+ allowed.any? { |klass| klass === value }
1017
+ end
1018
+ config_attr :scope, nil, ::String, ::Array, nil
1019
+ config_attr :lib_name, nil, ::String, nil
1020
+ config_attr :lib_version, nil, ::String, nil
1021
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1022
+ config_attr :interceptors, nil, ::Array, nil
1023
+ config_attr :timeout, nil, ::Numeric, nil
1024
+ config_attr :metadata, nil, ::Hash, nil
1025
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1026
+ config_attr :quota_project, nil, ::String, nil
1027
+
1028
+ # @private
1029
+ def initialize parent_config = nil
1030
+ @parent_config = parent_config unless parent_config.nil?
1031
+
1032
+ yield self if block_given?
1033
+ end
1034
+
1035
+ ##
1036
+ # Configurations for individual RPCs
1037
+ # @return [Rpcs]
1038
+ #
1039
+ def rpcs
1040
+ @rpcs ||= begin
1041
+ parent_rpcs = nil
1042
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1043
+ Rpcs.new parent_rpcs
1044
+ end
1045
+ end
1046
+
1047
+ ##
1048
+ # Configuration RPC class for the Tpu API.
1049
+ #
1050
+ # Includes fields providing the configuration for each RPC in this service.
1051
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1052
+ # the following configuration fields:
1053
+ #
1054
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1055
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1056
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1057
+ # include the following keys:
1058
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1059
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1060
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1061
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1062
+ # trigger a retry.
1063
+ #
1064
+ class Rpcs
1065
+ ##
1066
+ # RPC-specific configuration for `list_nodes`
1067
+ # @return [::Gapic::Config::Method]
1068
+ #
1069
+ attr_reader :list_nodes
1070
+ ##
1071
+ # RPC-specific configuration for `get_node`
1072
+ # @return [::Gapic::Config::Method]
1073
+ #
1074
+ attr_reader :get_node
1075
+ ##
1076
+ # RPC-specific configuration for `create_node`
1077
+ # @return [::Gapic::Config::Method]
1078
+ #
1079
+ attr_reader :create_node
1080
+ ##
1081
+ # RPC-specific configuration for `delete_node`
1082
+ # @return [::Gapic::Config::Method]
1083
+ #
1084
+ attr_reader :delete_node
1085
+ ##
1086
+ # RPC-specific configuration for `reimage_node`
1087
+ # @return [::Gapic::Config::Method]
1088
+ #
1089
+ attr_reader :reimage_node
1090
+ ##
1091
+ # RPC-specific configuration for `stop_node`
1092
+ # @return [::Gapic::Config::Method]
1093
+ #
1094
+ attr_reader :stop_node
1095
+ ##
1096
+ # RPC-specific configuration for `start_node`
1097
+ # @return [::Gapic::Config::Method]
1098
+ #
1099
+ attr_reader :start_node
1100
+ ##
1101
+ # RPC-specific configuration for `list_tensor_flow_versions`
1102
+ # @return [::Gapic::Config::Method]
1103
+ #
1104
+ attr_reader :list_tensor_flow_versions
1105
+ ##
1106
+ # RPC-specific configuration for `get_tensor_flow_version`
1107
+ # @return [::Gapic::Config::Method]
1108
+ #
1109
+ attr_reader :get_tensor_flow_version
1110
+ ##
1111
+ # RPC-specific configuration for `list_accelerator_types`
1112
+ # @return [::Gapic::Config::Method]
1113
+ #
1114
+ attr_reader :list_accelerator_types
1115
+ ##
1116
+ # RPC-specific configuration for `get_accelerator_type`
1117
+ # @return [::Gapic::Config::Method]
1118
+ #
1119
+ attr_reader :get_accelerator_type
1120
+
1121
+ # @private
1122
+ def initialize parent_rpcs = nil
1123
+ list_nodes_config = parent_rpcs.list_nodes if parent_rpcs.respond_to? :list_nodes
1124
+ @list_nodes = ::Gapic::Config::Method.new list_nodes_config
1125
+ get_node_config = parent_rpcs.get_node if parent_rpcs.respond_to? :get_node
1126
+ @get_node = ::Gapic::Config::Method.new get_node_config
1127
+ create_node_config = parent_rpcs.create_node if parent_rpcs.respond_to? :create_node
1128
+ @create_node = ::Gapic::Config::Method.new create_node_config
1129
+ delete_node_config = parent_rpcs.delete_node if parent_rpcs.respond_to? :delete_node
1130
+ @delete_node = ::Gapic::Config::Method.new delete_node_config
1131
+ reimage_node_config = parent_rpcs.reimage_node if parent_rpcs.respond_to? :reimage_node
1132
+ @reimage_node = ::Gapic::Config::Method.new reimage_node_config
1133
+ stop_node_config = parent_rpcs.stop_node if parent_rpcs.respond_to? :stop_node
1134
+ @stop_node = ::Gapic::Config::Method.new stop_node_config
1135
+ start_node_config = parent_rpcs.start_node if parent_rpcs.respond_to? :start_node
1136
+ @start_node = ::Gapic::Config::Method.new start_node_config
1137
+ list_tensor_flow_versions_config = parent_rpcs.list_tensor_flow_versions if parent_rpcs.respond_to? :list_tensor_flow_versions
1138
+ @list_tensor_flow_versions = ::Gapic::Config::Method.new list_tensor_flow_versions_config
1139
+ get_tensor_flow_version_config = parent_rpcs.get_tensor_flow_version if parent_rpcs.respond_to? :get_tensor_flow_version
1140
+ @get_tensor_flow_version = ::Gapic::Config::Method.new get_tensor_flow_version_config
1141
+ list_accelerator_types_config = parent_rpcs.list_accelerator_types if parent_rpcs.respond_to? :list_accelerator_types
1142
+ @list_accelerator_types = ::Gapic::Config::Method.new list_accelerator_types_config
1143
+ get_accelerator_type_config = parent_rpcs.get_accelerator_type if parent_rpcs.respond_to? :get_accelerator_type
1144
+ @get_accelerator_type = ::Gapic::Config::Method.new get_accelerator_type_config
1145
+
1146
+ yield self if block_given?
1147
+ end
1148
+ end
1149
+ end
1150
+ end
1151
+ end
1152
+ end
1153
+ end
1154
+ end
1155
+ end