google-cloud-container 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,1628 @@
1
+ # Copyright 2017 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
+ # https://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
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/container/v1/cluster_service.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+ #
22
+ # The only allowed edits are to method and file documentation. A 3-way
23
+ # merge preserves those additions if the generated source changes.
24
+
25
+ require "json"
26
+ require "pathname"
27
+
28
+ require "google/gax"
29
+
30
+ require "google/container/v1/cluster_service_pb"
31
+ require "google/cloud/container/credentials"
32
+
33
+ module Google
34
+ module Cloud
35
+ module Container
36
+ module V1
37
+ # Google Container Engine Cluster Manager v1
38
+ #
39
+ # @!attribute [r] cluster_manager_stub
40
+ # @return [Google::Container::V1::ClusterManager::Stub]
41
+ class ClusterManagerClient
42
+ attr_reader :cluster_manager_stub
43
+
44
+ # The default address of the service.
45
+ SERVICE_ADDRESS = "container.googleapis.com".freeze
46
+
47
+ # The default port of the service.
48
+ DEFAULT_SERVICE_PORT = 443
49
+
50
+ DEFAULT_TIMEOUT = 30
51
+
52
+ # The scopes needed to make gRPC calls to all of the methods defined in
53
+ # this service.
54
+ ALL_SCOPES = [
55
+ "https://www.googleapis.com/auth/cloud-platform"
56
+ ].freeze
57
+
58
+
59
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
60
+ # Provides the means for authenticating requests made by the client. This parameter can
61
+ # be many types.
62
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
63
+ # authenticating requests made by this client.
64
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
65
+ # credentials for this client.
66
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
67
+ # credentials for this client.
68
+ # A `GRPC::Core::Channel` will be used to make calls through.
69
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
70
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
71
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
72
+ # metadata for requests, generally, to give OAuth credentials.
73
+ # @param scopes [Array<String>]
74
+ # The OAuth scopes for this service. This parameter is ignored if
75
+ # an updater_proc is supplied.
76
+ # @param client_config [Hash]
77
+ # A Hash for call options for each method. See
78
+ # Google::Gax#construct_settings for the structure of
79
+ # this data. Falls back to the default config if not specified
80
+ # or the specified config is missing data points.
81
+ # @param timeout [Numeric]
82
+ # The default timeout, in seconds, for calls made through this client.
83
+ def initialize \
84
+ credentials: nil,
85
+ scopes: ALL_SCOPES,
86
+ client_config: {},
87
+ timeout: DEFAULT_TIMEOUT,
88
+ lib_name: nil,
89
+ lib_version: ""
90
+ # These require statements are intentionally placed here to initialize
91
+ # the gRPC module only when it's required.
92
+ # See https://github.com/googleapis/toolkit/issues/446
93
+ require "google/gax/grpc"
94
+ require "google/container/v1/cluster_service_services_pb"
95
+
96
+ credentials ||= Google::Cloud::Container::Credentials.default
97
+
98
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
99
+ updater_proc = Google::Cloud::Container::Credentials.new(credentials).updater_proc
100
+ end
101
+ if credentials.is_a?(GRPC::Core::Channel)
102
+ channel = credentials
103
+ end
104
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
105
+ chan_creds = credentials
106
+ end
107
+ if credentials.is_a?(Proc)
108
+ updater_proc = credentials
109
+ end
110
+ if credentials.is_a?(Google::Auth::Credentials)
111
+ updater_proc = credentials.updater_proc
112
+ end
113
+
114
+ package_version = Gem.loaded_specs['google-cloud-container'].version.version
115
+
116
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
117
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
118
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
119
+ google_api_client << " grpc/#{GRPC::VERSION}"
120
+ google_api_client.freeze
121
+
122
+ headers = { :"x-goog-api-client" => google_api_client }
123
+ client_config_file = Pathname.new(__dir__).join(
124
+ "cluster_manager_client_config.json"
125
+ )
126
+ defaults = client_config_file.open do |f|
127
+ Google::Gax.construct_settings(
128
+ "google.container.v1.ClusterManager",
129
+ JSON.parse(f.read),
130
+ client_config,
131
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
132
+ timeout,
133
+ errors: Google::Gax::Grpc::API_ERRORS,
134
+ kwargs: headers
135
+ )
136
+ end
137
+
138
+ # Allow overriding the service path/port in subclasses.
139
+ service_path = self.class::SERVICE_ADDRESS
140
+ port = self.class::DEFAULT_SERVICE_PORT
141
+ @cluster_manager_stub = Google::Gax::Grpc.create_stub(
142
+ service_path,
143
+ port,
144
+ chan_creds: chan_creds,
145
+ channel: channel,
146
+ updater_proc: updater_proc,
147
+ scopes: scopes,
148
+ &Google::Container::V1::ClusterManager::Stub.method(:new)
149
+ )
150
+
151
+ @list_clusters = Google::Gax.create_api_call(
152
+ @cluster_manager_stub.method(:list_clusters),
153
+ defaults["list_clusters"]
154
+ )
155
+ @get_cluster = Google::Gax.create_api_call(
156
+ @cluster_manager_stub.method(:get_cluster),
157
+ defaults["get_cluster"]
158
+ )
159
+ @create_cluster = Google::Gax.create_api_call(
160
+ @cluster_manager_stub.method(:create_cluster),
161
+ defaults["create_cluster"]
162
+ )
163
+ @update_cluster = Google::Gax.create_api_call(
164
+ @cluster_manager_stub.method(:update_cluster),
165
+ defaults["update_cluster"]
166
+ )
167
+ @update_node_pool = Google::Gax.create_api_call(
168
+ @cluster_manager_stub.method(:update_node_pool),
169
+ defaults["update_node_pool"]
170
+ )
171
+ @set_node_pool_autoscaling = Google::Gax.create_api_call(
172
+ @cluster_manager_stub.method(:set_node_pool_autoscaling),
173
+ defaults["set_node_pool_autoscaling"]
174
+ )
175
+ @set_logging_service = Google::Gax.create_api_call(
176
+ @cluster_manager_stub.method(:set_logging_service),
177
+ defaults["set_logging_service"]
178
+ )
179
+ @set_monitoring_service = Google::Gax.create_api_call(
180
+ @cluster_manager_stub.method(:set_monitoring_service),
181
+ defaults["set_monitoring_service"]
182
+ )
183
+ @set_addons_config = Google::Gax.create_api_call(
184
+ @cluster_manager_stub.method(:set_addons_config),
185
+ defaults["set_addons_config"]
186
+ )
187
+ @set_locations = Google::Gax.create_api_call(
188
+ @cluster_manager_stub.method(:set_locations),
189
+ defaults["set_locations"]
190
+ )
191
+ @update_master = Google::Gax.create_api_call(
192
+ @cluster_manager_stub.method(:update_master),
193
+ defaults["update_master"]
194
+ )
195
+ @set_master_auth = Google::Gax.create_api_call(
196
+ @cluster_manager_stub.method(:set_master_auth),
197
+ defaults["set_master_auth"]
198
+ )
199
+ @delete_cluster = Google::Gax.create_api_call(
200
+ @cluster_manager_stub.method(:delete_cluster),
201
+ defaults["delete_cluster"]
202
+ )
203
+ @list_operations = Google::Gax.create_api_call(
204
+ @cluster_manager_stub.method(:list_operations),
205
+ defaults["list_operations"]
206
+ )
207
+ @get_operation = Google::Gax.create_api_call(
208
+ @cluster_manager_stub.method(:get_operation),
209
+ defaults["get_operation"]
210
+ )
211
+ @cancel_operation = Google::Gax.create_api_call(
212
+ @cluster_manager_stub.method(:cancel_operation),
213
+ defaults["cancel_operation"]
214
+ )
215
+ @get_server_config = Google::Gax.create_api_call(
216
+ @cluster_manager_stub.method(:get_server_config),
217
+ defaults["get_server_config"]
218
+ )
219
+ @list_node_pools = Google::Gax.create_api_call(
220
+ @cluster_manager_stub.method(:list_node_pools),
221
+ defaults["list_node_pools"]
222
+ )
223
+ @get_node_pool = Google::Gax.create_api_call(
224
+ @cluster_manager_stub.method(:get_node_pool),
225
+ defaults["get_node_pool"]
226
+ )
227
+ @create_node_pool = Google::Gax.create_api_call(
228
+ @cluster_manager_stub.method(:create_node_pool),
229
+ defaults["create_node_pool"]
230
+ )
231
+ @delete_node_pool = Google::Gax.create_api_call(
232
+ @cluster_manager_stub.method(:delete_node_pool),
233
+ defaults["delete_node_pool"]
234
+ )
235
+ @rollback_node_pool_upgrade = Google::Gax.create_api_call(
236
+ @cluster_manager_stub.method(:rollback_node_pool_upgrade),
237
+ defaults["rollback_node_pool_upgrade"]
238
+ )
239
+ @set_node_pool_management = Google::Gax.create_api_call(
240
+ @cluster_manager_stub.method(:set_node_pool_management),
241
+ defaults["set_node_pool_management"]
242
+ )
243
+ @set_labels = Google::Gax.create_api_call(
244
+ @cluster_manager_stub.method(:set_labels),
245
+ defaults["set_labels"]
246
+ )
247
+ @set_legacy_abac = Google::Gax.create_api_call(
248
+ @cluster_manager_stub.method(:set_legacy_abac),
249
+ defaults["set_legacy_abac"]
250
+ )
251
+ @start_ip_rotation = Google::Gax.create_api_call(
252
+ @cluster_manager_stub.method(:start_ip_rotation),
253
+ defaults["start_ip_rotation"]
254
+ )
255
+ @complete_ip_rotation = Google::Gax.create_api_call(
256
+ @cluster_manager_stub.method(:complete_ip_rotation),
257
+ defaults["complete_ip_rotation"]
258
+ )
259
+ @set_node_pool_size = Google::Gax.create_api_call(
260
+ @cluster_manager_stub.method(:set_node_pool_size),
261
+ defaults["set_node_pool_size"]
262
+ )
263
+ @set_network_policy = Google::Gax.create_api_call(
264
+ @cluster_manager_stub.method(:set_network_policy),
265
+ defaults["set_network_policy"]
266
+ )
267
+ @set_maintenance_policy = Google::Gax.create_api_call(
268
+ @cluster_manager_stub.method(:set_maintenance_policy),
269
+ defaults["set_maintenance_policy"]
270
+ )
271
+ end
272
+
273
+ # Service calls
274
+
275
+ # Lists all clusters owned by a project in either the specified zone or all
276
+ # zones.
277
+ #
278
+ # @param project_id [String]
279
+ # The Google Developers Console [project ID or project
280
+ # number](https://support.google.com/cloud/answer/6158840).
281
+ # @param zone [String]
282
+ # The name of the Google Compute Engine
283
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
284
+ # resides, or "-" for all zones.
285
+ # @param options [Google::Gax::CallOptions]
286
+ # Overrides the default settings for this call, e.g, timeout,
287
+ # retries, etc.
288
+ # @return [Google::Container::V1::ListClustersResponse]
289
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
290
+ # @example
291
+ # require "google/cloud/container/v1"
292
+ #
293
+ # cluster_manager_client = Google::Cloud::Container::V1.new
294
+ # project_id = ''
295
+ # zone = ''
296
+ # response = cluster_manager_client.list_clusters(project_id, zone)
297
+
298
+ def list_clusters \
299
+ project_id,
300
+ zone,
301
+ options: nil
302
+ req = {
303
+ project_id: project_id,
304
+ zone: zone
305
+ }.delete_if { |_, v| v.nil? }
306
+ req = Google::Gax::to_proto(req, Google::Container::V1::ListClustersRequest)
307
+ @list_clusters.call(req, options)
308
+ end
309
+
310
+ # Gets the details of a specific cluster.
311
+ #
312
+ # @param project_id [String]
313
+ # The Google Developers Console [project ID or project
314
+ # number](https://support.google.com/cloud/answer/6158840).
315
+ # @param zone [String]
316
+ # The name of the Google Compute Engine
317
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
318
+ # resides.
319
+ # @param cluster_id [String]
320
+ # The name of the cluster to retrieve.
321
+ # @param options [Google::Gax::CallOptions]
322
+ # Overrides the default settings for this call, e.g, timeout,
323
+ # retries, etc.
324
+ # @return [Google::Container::V1::Cluster]
325
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
326
+ # @example
327
+ # require "google/cloud/container/v1"
328
+ #
329
+ # cluster_manager_client = Google::Cloud::Container::V1.new
330
+ # project_id = ''
331
+ # zone = ''
332
+ # cluster_id = ''
333
+ # response = cluster_manager_client.get_cluster(project_id, zone, cluster_id)
334
+
335
+ def get_cluster \
336
+ project_id,
337
+ zone,
338
+ cluster_id,
339
+ options: nil
340
+ req = {
341
+ project_id: project_id,
342
+ zone: zone,
343
+ cluster_id: cluster_id
344
+ }.delete_if { |_, v| v.nil? }
345
+ req = Google::Gax::to_proto(req, Google::Container::V1::GetClusterRequest)
346
+ @get_cluster.call(req, options)
347
+ end
348
+
349
+ # Creates a cluster, consisting of the specified number and type of Google
350
+ # Compute Engine instances.
351
+ #
352
+ # By default, the cluster is created in the project's
353
+ # [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks).
354
+ #
355
+ # One firewall is added for the cluster. After cluster creation,
356
+ # the cluster creates routes for each node to allow the containers
357
+ # on that node to communicate with all other instances in the
358
+ # cluster.
359
+ #
360
+ # Finally, an entry is added to the project's global metadata indicating
361
+ # which CIDR range is being used by the cluster.
362
+ #
363
+ # @param project_id [String]
364
+ # The Google Developers Console [project ID or project
365
+ # number](https://support.google.com/cloud/answer/6158840).
366
+ # @param zone [String]
367
+ # The name of the Google Compute Engine
368
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
369
+ # resides.
370
+ # @param cluster [Google::Container::V1::Cluster | Hash]
371
+ # A [cluster
372
+ # resource](/container-engine/reference/rest/v1/projects.zones.clusters)
373
+ # A hash of the same form as `Google::Container::V1::Cluster`
374
+ # can also be provided.
375
+ # @param options [Google::Gax::CallOptions]
376
+ # Overrides the default settings for this call, e.g, timeout,
377
+ # retries, etc.
378
+ # @return [Google::Container::V1::Operation]
379
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
380
+ # @example
381
+ # require "google/cloud/container/v1"
382
+ #
383
+ # cluster_manager_client = Google::Cloud::Container::V1.new
384
+ # project_id = ''
385
+ # zone = ''
386
+ # cluster = {}
387
+ # response = cluster_manager_client.create_cluster(project_id, zone, cluster)
388
+
389
+ def create_cluster \
390
+ project_id,
391
+ zone,
392
+ cluster,
393
+ options: nil
394
+ req = {
395
+ project_id: project_id,
396
+ zone: zone,
397
+ cluster: cluster
398
+ }.delete_if { |_, v| v.nil? }
399
+ req = Google::Gax::to_proto(req, Google::Container::V1::CreateClusterRequest)
400
+ @create_cluster.call(req, options)
401
+ end
402
+
403
+ # Updates the settings of a specific cluster.
404
+ #
405
+ # @param project_id [String]
406
+ # The Google Developers Console [project ID or project
407
+ # number](https://support.google.com/cloud/answer/6158840).
408
+ # @param zone [String]
409
+ # The name of the Google Compute Engine
410
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
411
+ # resides.
412
+ # @param cluster_id [String]
413
+ # The name of the cluster to upgrade.
414
+ # @param update [Google::Container::V1::ClusterUpdate | Hash]
415
+ # A description of the update.
416
+ # A hash of the same form as `Google::Container::V1::ClusterUpdate`
417
+ # can also be provided.
418
+ # @param options [Google::Gax::CallOptions]
419
+ # Overrides the default settings for this call, e.g, timeout,
420
+ # retries, etc.
421
+ # @return [Google::Container::V1::Operation]
422
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
423
+ # @example
424
+ # require "google/cloud/container/v1"
425
+ #
426
+ # cluster_manager_client = Google::Cloud::Container::V1.new
427
+ # project_id = ''
428
+ # zone = ''
429
+ # cluster_id = ''
430
+ # update = {}
431
+ # response = cluster_manager_client.update_cluster(project_id, zone, cluster_id, update)
432
+
433
+ def update_cluster \
434
+ project_id,
435
+ zone,
436
+ cluster_id,
437
+ update,
438
+ options: nil
439
+ req = {
440
+ project_id: project_id,
441
+ zone: zone,
442
+ cluster_id: cluster_id,
443
+ update: update
444
+ }.delete_if { |_, v| v.nil? }
445
+ req = Google::Gax::to_proto(req, Google::Container::V1::UpdateClusterRequest)
446
+ @update_cluster.call(req, options)
447
+ end
448
+
449
+ # Updates the version and/or image type of a specific node pool.
450
+ #
451
+ # @param project_id [String]
452
+ # The Google Developers Console [project ID or project
453
+ # number](https://support.google.com/cloud/answer/6158840).
454
+ # @param zone [String]
455
+ # The name of the Google Compute Engine
456
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
457
+ # resides.
458
+ # @param cluster_id [String]
459
+ # The name of the cluster to upgrade.
460
+ # @param node_pool_id [String]
461
+ # The name of the node pool to upgrade.
462
+ # @param node_version [String]
463
+ # The Kubernetes version to change the nodes to (typically an
464
+ # upgrade). Use +-+ to upgrade to the latest version supported by
465
+ # the server.
466
+ # @param image_type [String]
467
+ # The desired image type for the node pool.
468
+ # @param options [Google::Gax::CallOptions]
469
+ # Overrides the default settings for this call, e.g, timeout,
470
+ # retries, etc.
471
+ # @return [Google::Container::V1::Operation]
472
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
473
+ # @example
474
+ # require "google/cloud/container/v1"
475
+ #
476
+ # cluster_manager_client = Google::Cloud::Container::V1.new
477
+ # project_id = ''
478
+ # zone = ''
479
+ # cluster_id = ''
480
+ # node_pool_id = ''
481
+ # node_version = ''
482
+ # image_type = ''
483
+ # response = cluster_manager_client.update_node_pool(project_id, zone, cluster_id, node_pool_id, node_version, image_type)
484
+
485
+ def update_node_pool \
486
+ project_id,
487
+ zone,
488
+ cluster_id,
489
+ node_pool_id,
490
+ node_version,
491
+ image_type,
492
+ options: nil
493
+ req = {
494
+ project_id: project_id,
495
+ zone: zone,
496
+ cluster_id: cluster_id,
497
+ node_pool_id: node_pool_id,
498
+ node_version: node_version,
499
+ image_type: image_type
500
+ }.delete_if { |_, v| v.nil? }
501
+ req = Google::Gax::to_proto(req, Google::Container::V1::UpdateNodePoolRequest)
502
+ @update_node_pool.call(req, options)
503
+ end
504
+
505
+ # Sets the autoscaling settings of a specific node pool.
506
+ #
507
+ # @param project_id [String]
508
+ # The Google Developers Console [project ID or project
509
+ # number](https://support.google.com/cloud/answer/6158840).
510
+ # @param zone [String]
511
+ # The name of the Google Compute Engine
512
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
513
+ # resides.
514
+ # @param cluster_id [String]
515
+ # The name of the cluster to upgrade.
516
+ # @param node_pool_id [String]
517
+ # The name of the node pool to upgrade.
518
+ # @param autoscaling [Google::Container::V1::NodePoolAutoscaling | Hash]
519
+ # Autoscaling configuration for the node pool.
520
+ # A hash of the same form as `Google::Container::V1::NodePoolAutoscaling`
521
+ # can also be provided.
522
+ # @param options [Google::Gax::CallOptions]
523
+ # Overrides the default settings for this call, e.g, timeout,
524
+ # retries, etc.
525
+ # @return [Google::Container::V1::Operation]
526
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
527
+ # @example
528
+ # require "google/cloud/container/v1"
529
+ #
530
+ # cluster_manager_client = Google::Cloud::Container::V1.new
531
+ # project_id = ''
532
+ # zone = ''
533
+ # cluster_id = ''
534
+ # node_pool_id = ''
535
+ # autoscaling = {}
536
+ # response = cluster_manager_client.set_node_pool_autoscaling(project_id, zone, cluster_id, node_pool_id, autoscaling)
537
+
538
+ def set_node_pool_autoscaling \
539
+ project_id,
540
+ zone,
541
+ cluster_id,
542
+ node_pool_id,
543
+ autoscaling,
544
+ options: nil
545
+ req = {
546
+ project_id: project_id,
547
+ zone: zone,
548
+ cluster_id: cluster_id,
549
+ node_pool_id: node_pool_id,
550
+ autoscaling: autoscaling
551
+ }.delete_if { |_, v| v.nil? }
552
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetNodePoolAutoscalingRequest)
553
+ @set_node_pool_autoscaling.call(req, options)
554
+ end
555
+
556
+ # Sets the logging service of a specific cluster.
557
+ #
558
+ # @param project_id [String]
559
+ # The Google Developers Console [project ID or project
560
+ # number](https://support.google.com/cloud/answer/6158840).
561
+ # @param zone [String]
562
+ # The name of the Google Compute Engine
563
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
564
+ # resides.
565
+ # @param cluster_id [String]
566
+ # The name of the cluster to upgrade.
567
+ # @param logging_service [String]
568
+ # The logging service the cluster should use to write metrics.
569
+ # Currently available options:
570
+ #
571
+ # * "logging.googleapis.com" - the Google Cloud Logging service
572
+ # * "none" - no metrics will be exported from the cluster
573
+ # @param options [Google::Gax::CallOptions]
574
+ # Overrides the default settings for this call, e.g, timeout,
575
+ # retries, etc.
576
+ # @return [Google::Container::V1::Operation]
577
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
578
+ # @example
579
+ # require "google/cloud/container/v1"
580
+ #
581
+ # cluster_manager_client = Google::Cloud::Container::V1.new
582
+ # project_id = ''
583
+ # zone = ''
584
+ # cluster_id = ''
585
+ # logging_service = ''
586
+ # response = cluster_manager_client.set_logging_service(project_id, zone, cluster_id, logging_service)
587
+
588
+ def set_logging_service \
589
+ project_id,
590
+ zone,
591
+ cluster_id,
592
+ logging_service,
593
+ options: nil
594
+ req = {
595
+ project_id: project_id,
596
+ zone: zone,
597
+ cluster_id: cluster_id,
598
+ logging_service: logging_service
599
+ }.delete_if { |_, v| v.nil? }
600
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetLoggingServiceRequest)
601
+ @set_logging_service.call(req, options)
602
+ end
603
+
604
+ # Sets the monitoring service of a specific cluster.
605
+ #
606
+ # @param project_id [String]
607
+ # The Google Developers Console [project ID or project
608
+ # number](https://support.google.com/cloud/answer/6158840).
609
+ # @param zone [String]
610
+ # The name of the Google Compute Engine
611
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
612
+ # resides.
613
+ # @param cluster_id [String]
614
+ # The name of the cluster to upgrade.
615
+ # @param monitoring_service [String]
616
+ # The monitoring service the cluster should use to write metrics.
617
+ # Currently available options:
618
+ #
619
+ # * "monitoring.googleapis.com" - the Google Cloud Monitoring service
620
+ # * "none" - no metrics will be exported from the cluster
621
+ # @param options [Google::Gax::CallOptions]
622
+ # Overrides the default settings for this call, e.g, timeout,
623
+ # retries, etc.
624
+ # @return [Google::Container::V1::Operation]
625
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
626
+ # @example
627
+ # require "google/cloud/container/v1"
628
+ #
629
+ # cluster_manager_client = Google::Cloud::Container::V1.new
630
+ # project_id = ''
631
+ # zone = ''
632
+ # cluster_id = ''
633
+ # monitoring_service = ''
634
+ # response = cluster_manager_client.set_monitoring_service(project_id, zone, cluster_id, monitoring_service)
635
+
636
+ def set_monitoring_service \
637
+ project_id,
638
+ zone,
639
+ cluster_id,
640
+ monitoring_service,
641
+ options: nil
642
+ req = {
643
+ project_id: project_id,
644
+ zone: zone,
645
+ cluster_id: cluster_id,
646
+ monitoring_service: monitoring_service
647
+ }.delete_if { |_, v| v.nil? }
648
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetMonitoringServiceRequest)
649
+ @set_monitoring_service.call(req, options)
650
+ end
651
+
652
+ # Sets the addons of a specific cluster.
653
+ #
654
+ # @param project_id [String]
655
+ # The Google Developers Console [project ID or project
656
+ # number](https://support.google.com/cloud/answer/6158840).
657
+ # @param zone [String]
658
+ # The name of the Google Compute Engine
659
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
660
+ # resides.
661
+ # @param cluster_id [String]
662
+ # The name of the cluster to upgrade.
663
+ # @param addons_config [Google::Container::V1::AddonsConfig | Hash]
664
+ # The desired configurations for the various addons available to run in the
665
+ # cluster.
666
+ # A hash of the same form as `Google::Container::V1::AddonsConfig`
667
+ # can also be provided.
668
+ # @param options [Google::Gax::CallOptions]
669
+ # Overrides the default settings for this call, e.g, timeout,
670
+ # retries, etc.
671
+ # @return [Google::Container::V1::Operation]
672
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
673
+ # @example
674
+ # require "google/cloud/container/v1"
675
+ #
676
+ # cluster_manager_client = Google::Cloud::Container::V1.new
677
+ # project_id = ''
678
+ # zone = ''
679
+ # cluster_id = ''
680
+ # addons_config = {}
681
+ # response = cluster_manager_client.set_addons_config(project_id, zone, cluster_id, addons_config)
682
+
683
+ def set_addons_config \
684
+ project_id,
685
+ zone,
686
+ cluster_id,
687
+ addons_config,
688
+ options: nil
689
+ req = {
690
+ project_id: project_id,
691
+ zone: zone,
692
+ cluster_id: cluster_id,
693
+ addons_config: addons_config
694
+ }.delete_if { |_, v| v.nil? }
695
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetAddonsConfigRequest)
696
+ @set_addons_config.call(req, options)
697
+ end
698
+
699
+ # Sets the locations of a specific cluster.
700
+ #
701
+ # @param project_id [String]
702
+ # The Google Developers Console [project ID or project
703
+ # number](https://support.google.com/cloud/answer/6158840).
704
+ # @param zone [String]
705
+ # The name of the Google Compute Engine
706
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
707
+ # resides.
708
+ # @param cluster_id [String]
709
+ # The name of the cluster to upgrade.
710
+ # @param locations [Array<String>]
711
+ # The desired list of Google Compute Engine
712
+ # [locations](https://cloud.google.com/compute/docs/zones#available) in which the cluster's nodes
713
+ # should be located. Changing the locations a cluster is in will result
714
+ # in nodes being either created or removed from the cluster, depending on
715
+ # whether locations are being added or removed.
716
+ #
717
+ # This list must always include the cluster's primary zone.
718
+ # @param options [Google::Gax::CallOptions]
719
+ # Overrides the default settings for this call, e.g, timeout,
720
+ # retries, etc.
721
+ # @return [Google::Container::V1::Operation]
722
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
723
+ # @example
724
+ # require "google/cloud/container/v1"
725
+ #
726
+ # cluster_manager_client = Google::Cloud::Container::V1.new
727
+ # project_id = ''
728
+ # zone = ''
729
+ # cluster_id = ''
730
+ # locations = []
731
+ # response = cluster_manager_client.set_locations(project_id, zone, cluster_id, locations)
732
+
733
+ def set_locations \
734
+ project_id,
735
+ zone,
736
+ cluster_id,
737
+ locations,
738
+ options: nil
739
+ req = {
740
+ project_id: project_id,
741
+ zone: zone,
742
+ cluster_id: cluster_id,
743
+ locations: locations
744
+ }.delete_if { |_, v| v.nil? }
745
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetLocationsRequest)
746
+ @set_locations.call(req, options)
747
+ end
748
+
749
+ # Updates the master of a specific cluster.
750
+ #
751
+ # @param project_id [String]
752
+ # The Google Developers Console [project ID or project
753
+ # number](https://support.google.com/cloud/answer/6158840).
754
+ # @param zone [String]
755
+ # The name of the Google Compute Engine
756
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
757
+ # resides.
758
+ # @param cluster_id [String]
759
+ # The name of the cluster to upgrade.
760
+ # @param master_version [String]
761
+ # The Kubernetes version to change the master to. The only valid value is the
762
+ # latest supported version. Use "-" to have the server automatically select
763
+ # the latest version.
764
+ # @param options [Google::Gax::CallOptions]
765
+ # Overrides the default settings for this call, e.g, timeout,
766
+ # retries, etc.
767
+ # @return [Google::Container::V1::Operation]
768
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
769
+ # @example
770
+ # require "google/cloud/container/v1"
771
+ #
772
+ # cluster_manager_client = Google::Cloud::Container::V1.new
773
+ # project_id = ''
774
+ # zone = ''
775
+ # cluster_id = ''
776
+ # master_version = ''
777
+ # response = cluster_manager_client.update_master(project_id, zone, cluster_id, master_version)
778
+
779
+ def update_master \
780
+ project_id,
781
+ zone,
782
+ cluster_id,
783
+ master_version,
784
+ options: nil
785
+ req = {
786
+ project_id: project_id,
787
+ zone: zone,
788
+ cluster_id: cluster_id,
789
+ master_version: master_version
790
+ }.delete_if { |_, v| v.nil? }
791
+ req = Google::Gax::to_proto(req, Google::Container::V1::UpdateMasterRequest)
792
+ @update_master.call(req, options)
793
+ end
794
+
795
+ # Used to set master auth materials. Currently supports :-
796
+ # Changing the admin password of a specific cluster.
797
+ # This can be either via password generation or explicitly set the password.
798
+ #
799
+ # @param project_id [String]
800
+ # The Google Developers Console [project ID or project
801
+ # number](https://support.google.com/cloud/answer/6158840).
802
+ # @param zone [String]
803
+ # The name of the Google Compute Engine
804
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
805
+ # resides.
806
+ # @param cluster_id [String]
807
+ # The name of the cluster to upgrade.
808
+ # @param action [Google::Container::V1::SetMasterAuthRequest::Action]
809
+ # The exact form of action to be taken on the master auth.
810
+ # @param update [Google::Container::V1::MasterAuth | Hash]
811
+ # A description of the update.
812
+ # A hash of the same form as `Google::Container::V1::MasterAuth`
813
+ # can also be provided.
814
+ # @param options [Google::Gax::CallOptions]
815
+ # Overrides the default settings for this call, e.g, timeout,
816
+ # retries, etc.
817
+ # @return [Google::Container::V1::Operation]
818
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
819
+ # @example
820
+ # require "google/cloud/container/v1"
821
+ #
822
+ # cluster_manager_client = Google::Cloud::Container::V1.new
823
+ # project_id = ''
824
+ # zone = ''
825
+ # cluster_id = ''
826
+ # action = :UNKNOWN
827
+ # update = {}
828
+ # response = cluster_manager_client.set_master_auth(project_id, zone, cluster_id, action, update)
829
+
830
+ def set_master_auth \
831
+ project_id,
832
+ zone,
833
+ cluster_id,
834
+ action,
835
+ update,
836
+ options: nil
837
+ req = {
838
+ project_id: project_id,
839
+ zone: zone,
840
+ cluster_id: cluster_id,
841
+ action: action,
842
+ update: update
843
+ }.delete_if { |_, v| v.nil? }
844
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetMasterAuthRequest)
845
+ @set_master_auth.call(req, options)
846
+ end
847
+
848
+ # Deletes the cluster, including the Kubernetes endpoint and all worker
849
+ # nodes.
850
+ #
851
+ # Firewalls and routes that were configured during cluster creation
852
+ # are also deleted.
853
+ #
854
+ # Other Google Compute Engine resources that might be in use by the cluster
855
+ # (e.g. load balancer resources) will not be deleted if they weren't present
856
+ # at the initial create time.
857
+ #
858
+ # @param project_id [String]
859
+ # The Google Developers Console [project ID or project
860
+ # number](https://support.google.com/cloud/answer/6158840).
861
+ # @param zone [String]
862
+ # The name of the Google Compute Engine
863
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
864
+ # resides.
865
+ # @param cluster_id [String]
866
+ # The name of the cluster to delete.
867
+ # @param options [Google::Gax::CallOptions]
868
+ # Overrides the default settings for this call, e.g, timeout,
869
+ # retries, etc.
870
+ # @return [Google::Container::V1::Operation]
871
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
872
+ # @example
873
+ # require "google/cloud/container/v1"
874
+ #
875
+ # cluster_manager_client = Google::Cloud::Container::V1.new
876
+ # project_id = ''
877
+ # zone = ''
878
+ # cluster_id = ''
879
+ # response = cluster_manager_client.delete_cluster(project_id, zone, cluster_id)
880
+
881
+ def delete_cluster \
882
+ project_id,
883
+ zone,
884
+ cluster_id,
885
+ options: nil
886
+ req = {
887
+ project_id: project_id,
888
+ zone: zone,
889
+ cluster_id: cluster_id
890
+ }.delete_if { |_, v| v.nil? }
891
+ req = Google::Gax::to_proto(req, Google::Container::V1::DeleteClusterRequest)
892
+ @delete_cluster.call(req, options)
893
+ end
894
+
895
+ # Lists all operations in a project in a specific zone or all zones.
896
+ #
897
+ # @param project_id [String]
898
+ # The Google Developers Console [project ID or project
899
+ # number](https://support.google.com/cloud/answer/6158840).
900
+ # @param zone [String]
901
+ # The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available)
902
+ # to return operations for, or +-+ for all zones.
903
+ # @param options [Google::Gax::CallOptions]
904
+ # Overrides the default settings for this call, e.g, timeout,
905
+ # retries, etc.
906
+ # @return [Google::Container::V1::ListOperationsResponse]
907
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
908
+ # @example
909
+ # require "google/cloud/container/v1"
910
+ #
911
+ # cluster_manager_client = Google::Cloud::Container::V1.new
912
+ # project_id = ''
913
+ # zone = ''
914
+ # response = cluster_manager_client.list_operations(project_id, zone)
915
+
916
+ def list_operations \
917
+ project_id,
918
+ zone,
919
+ options: nil
920
+ req = {
921
+ project_id: project_id,
922
+ zone: zone
923
+ }.delete_if { |_, v| v.nil? }
924
+ req = Google::Gax::to_proto(req, Google::Container::V1::ListOperationsRequest)
925
+ @list_operations.call(req, options)
926
+ end
927
+
928
+ # Gets the specified operation.
929
+ #
930
+ # @param project_id [String]
931
+ # The Google Developers Console [project ID or project
932
+ # number](https://support.google.com/cloud/answer/6158840).
933
+ # @param zone [String]
934
+ # The name of the Google Compute Engine
935
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
936
+ # resides.
937
+ # @param operation_id [String]
938
+ # The server-assigned +name+ of the operation.
939
+ # @param options [Google::Gax::CallOptions]
940
+ # Overrides the default settings for this call, e.g, timeout,
941
+ # retries, etc.
942
+ # @return [Google::Container::V1::Operation]
943
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
944
+ # @example
945
+ # require "google/cloud/container/v1"
946
+ #
947
+ # cluster_manager_client = Google::Cloud::Container::V1.new
948
+ # project_id = ''
949
+ # zone = ''
950
+ # operation_id = ''
951
+ # response = cluster_manager_client.get_operation(project_id, zone, operation_id)
952
+
953
+ def get_operation \
954
+ project_id,
955
+ zone,
956
+ operation_id,
957
+ options: nil
958
+ req = {
959
+ project_id: project_id,
960
+ zone: zone,
961
+ operation_id: operation_id
962
+ }.delete_if { |_, v| v.nil? }
963
+ req = Google::Gax::to_proto(req, Google::Container::V1::GetOperationRequest)
964
+ @get_operation.call(req, options)
965
+ end
966
+
967
+ # Cancels the specified operation.
968
+ #
969
+ # @param project_id [String]
970
+ # The Google Developers Console [project ID or project
971
+ # number](https://support.google.com/cloud/answer/6158840).
972
+ # @param zone [String]
973
+ # The name of the Google Compute Engine
974
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the operation resides.
975
+ # @param operation_id [String]
976
+ # The server-assigned +name+ of the operation.
977
+ # @param options [Google::Gax::CallOptions]
978
+ # Overrides the default settings for this call, e.g, timeout,
979
+ # retries, etc.
980
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
981
+ # @example
982
+ # require "google/cloud/container/v1"
983
+ #
984
+ # cluster_manager_client = Google::Cloud::Container::V1.new
985
+ # project_id = ''
986
+ # zone = ''
987
+ # operation_id = ''
988
+ # cluster_manager_client.cancel_operation(project_id, zone, operation_id)
989
+
990
+ def cancel_operation \
991
+ project_id,
992
+ zone,
993
+ operation_id,
994
+ options: nil
995
+ req = {
996
+ project_id: project_id,
997
+ zone: zone,
998
+ operation_id: operation_id
999
+ }.delete_if { |_, v| v.nil? }
1000
+ req = Google::Gax::to_proto(req, Google::Container::V1::CancelOperationRequest)
1001
+ @cancel_operation.call(req, options)
1002
+ nil
1003
+ end
1004
+
1005
+ # Returns configuration info about the Container Engine service.
1006
+ #
1007
+ # @param project_id [String]
1008
+ # The Google Developers Console [project ID or project
1009
+ # number](https://support.google.com/cloud/answer/6158840).
1010
+ # @param zone [String]
1011
+ # The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available)
1012
+ # to return operations for.
1013
+ # @param options [Google::Gax::CallOptions]
1014
+ # Overrides the default settings for this call, e.g, timeout,
1015
+ # retries, etc.
1016
+ # @return [Google::Container::V1::ServerConfig]
1017
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1018
+ # @example
1019
+ # require "google/cloud/container/v1"
1020
+ #
1021
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1022
+ # project_id = ''
1023
+ # zone = ''
1024
+ # response = cluster_manager_client.get_server_config(project_id, zone)
1025
+
1026
+ def get_server_config \
1027
+ project_id,
1028
+ zone,
1029
+ options: nil
1030
+ req = {
1031
+ project_id: project_id,
1032
+ zone: zone
1033
+ }.delete_if { |_, v| v.nil? }
1034
+ req = Google::Gax::to_proto(req, Google::Container::V1::GetServerConfigRequest)
1035
+ @get_server_config.call(req, options)
1036
+ end
1037
+
1038
+ # Lists the node pools for a cluster.
1039
+ #
1040
+ # @param project_id [String]
1041
+ # The Google Developers Console [project ID or project
1042
+ # number](https://developers.google.com/console/help/new/#projectnumber).
1043
+ # @param zone [String]
1044
+ # The name of the Google Compute Engine
1045
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1046
+ # resides.
1047
+ # @param cluster_id [String]
1048
+ # The name of the cluster.
1049
+ # @param options [Google::Gax::CallOptions]
1050
+ # Overrides the default settings for this call, e.g, timeout,
1051
+ # retries, etc.
1052
+ # @return [Google::Container::V1::ListNodePoolsResponse]
1053
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1054
+ # @example
1055
+ # require "google/cloud/container/v1"
1056
+ #
1057
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1058
+ # project_id = ''
1059
+ # zone = ''
1060
+ # cluster_id = ''
1061
+ # response = cluster_manager_client.list_node_pools(project_id, zone, cluster_id)
1062
+
1063
+ def list_node_pools \
1064
+ project_id,
1065
+ zone,
1066
+ cluster_id,
1067
+ options: nil
1068
+ req = {
1069
+ project_id: project_id,
1070
+ zone: zone,
1071
+ cluster_id: cluster_id
1072
+ }.delete_if { |_, v| v.nil? }
1073
+ req = Google::Gax::to_proto(req, Google::Container::V1::ListNodePoolsRequest)
1074
+ @list_node_pools.call(req, options)
1075
+ end
1076
+
1077
+ # Retrieves the node pool requested.
1078
+ #
1079
+ # @param project_id [String]
1080
+ # The Google Developers Console [project ID or project
1081
+ # number](https://developers.google.com/console/help/new/#projectnumber).
1082
+ # @param zone [String]
1083
+ # The name of the Google Compute Engine
1084
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1085
+ # resides.
1086
+ # @param cluster_id [String]
1087
+ # The name of the cluster.
1088
+ # @param node_pool_id [String]
1089
+ # The name of the node pool.
1090
+ # @param options [Google::Gax::CallOptions]
1091
+ # Overrides the default settings for this call, e.g, timeout,
1092
+ # retries, etc.
1093
+ # @return [Google::Container::V1::NodePool]
1094
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1095
+ # @example
1096
+ # require "google/cloud/container/v1"
1097
+ #
1098
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1099
+ # project_id = ''
1100
+ # zone = ''
1101
+ # cluster_id = ''
1102
+ # node_pool_id = ''
1103
+ # response = cluster_manager_client.get_node_pool(project_id, zone, cluster_id, node_pool_id)
1104
+
1105
+ def get_node_pool \
1106
+ project_id,
1107
+ zone,
1108
+ cluster_id,
1109
+ node_pool_id,
1110
+ options: nil
1111
+ req = {
1112
+ project_id: project_id,
1113
+ zone: zone,
1114
+ cluster_id: cluster_id,
1115
+ node_pool_id: node_pool_id
1116
+ }.delete_if { |_, v| v.nil? }
1117
+ req = Google::Gax::to_proto(req, Google::Container::V1::GetNodePoolRequest)
1118
+ @get_node_pool.call(req, options)
1119
+ end
1120
+
1121
+ # Creates a node pool for a cluster.
1122
+ #
1123
+ # @param project_id [String]
1124
+ # The Google Developers Console [project ID or project
1125
+ # number](https://developers.google.com/console/help/new/#projectnumber).
1126
+ # @param zone [String]
1127
+ # The name of the Google Compute Engine
1128
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1129
+ # resides.
1130
+ # @param cluster_id [String]
1131
+ # The name of the cluster.
1132
+ # @param node_pool [Google::Container::V1::NodePool | Hash]
1133
+ # The node pool to create.
1134
+ # A hash of the same form as `Google::Container::V1::NodePool`
1135
+ # can also be provided.
1136
+ # @param options [Google::Gax::CallOptions]
1137
+ # Overrides the default settings for this call, e.g, timeout,
1138
+ # retries, etc.
1139
+ # @return [Google::Container::V1::Operation]
1140
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1141
+ # @example
1142
+ # require "google/cloud/container/v1"
1143
+ #
1144
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1145
+ # project_id = ''
1146
+ # zone = ''
1147
+ # cluster_id = ''
1148
+ # node_pool = {}
1149
+ # response = cluster_manager_client.create_node_pool(project_id, zone, cluster_id, node_pool)
1150
+
1151
+ def create_node_pool \
1152
+ project_id,
1153
+ zone,
1154
+ cluster_id,
1155
+ node_pool,
1156
+ options: nil
1157
+ req = {
1158
+ project_id: project_id,
1159
+ zone: zone,
1160
+ cluster_id: cluster_id,
1161
+ node_pool: node_pool
1162
+ }.delete_if { |_, v| v.nil? }
1163
+ req = Google::Gax::to_proto(req, Google::Container::V1::CreateNodePoolRequest)
1164
+ @create_node_pool.call(req, options)
1165
+ end
1166
+
1167
+ # Deletes a node pool from a cluster.
1168
+ #
1169
+ # @param project_id [String]
1170
+ # The Google Developers Console [project ID or project
1171
+ # number](https://developers.google.com/console/help/new/#projectnumber).
1172
+ # @param zone [String]
1173
+ # The name of the Google Compute Engine
1174
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1175
+ # resides.
1176
+ # @param cluster_id [String]
1177
+ # The name of the cluster.
1178
+ # @param node_pool_id [String]
1179
+ # The name of the node pool to delete.
1180
+ # @param options [Google::Gax::CallOptions]
1181
+ # Overrides the default settings for this call, e.g, timeout,
1182
+ # retries, etc.
1183
+ # @return [Google::Container::V1::Operation]
1184
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1185
+ # @example
1186
+ # require "google/cloud/container/v1"
1187
+ #
1188
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1189
+ # project_id = ''
1190
+ # zone = ''
1191
+ # cluster_id = ''
1192
+ # node_pool_id = ''
1193
+ # response = cluster_manager_client.delete_node_pool(project_id, zone, cluster_id, node_pool_id)
1194
+
1195
+ def delete_node_pool \
1196
+ project_id,
1197
+ zone,
1198
+ cluster_id,
1199
+ node_pool_id,
1200
+ options: nil
1201
+ req = {
1202
+ project_id: project_id,
1203
+ zone: zone,
1204
+ cluster_id: cluster_id,
1205
+ node_pool_id: node_pool_id
1206
+ }.delete_if { |_, v| v.nil? }
1207
+ req = Google::Gax::to_proto(req, Google::Container::V1::DeleteNodePoolRequest)
1208
+ @delete_node_pool.call(req, options)
1209
+ end
1210
+
1211
+ # Roll back the previously Aborted or Failed NodePool upgrade.
1212
+ # This will be an no-op if the last upgrade successfully completed.
1213
+ #
1214
+ # @param project_id [String]
1215
+ # The Google Developers Console [project ID or project
1216
+ # number](https://support.google.com/cloud/answer/6158840).
1217
+ # @param zone [String]
1218
+ # The name of the Google Compute Engine
1219
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1220
+ # resides.
1221
+ # @param cluster_id [String]
1222
+ # The name of the cluster to rollback.
1223
+ # @param node_pool_id [String]
1224
+ # The name of the node pool to rollback.
1225
+ # @param options [Google::Gax::CallOptions]
1226
+ # Overrides the default settings for this call, e.g, timeout,
1227
+ # retries, etc.
1228
+ # @return [Google::Container::V1::Operation]
1229
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1230
+ # @example
1231
+ # require "google/cloud/container/v1"
1232
+ #
1233
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1234
+ # project_id = ''
1235
+ # zone = ''
1236
+ # cluster_id = ''
1237
+ # node_pool_id = ''
1238
+ # response = cluster_manager_client.rollback_node_pool_upgrade(project_id, zone, cluster_id, node_pool_id)
1239
+
1240
+ def rollback_node_pool_upgrade \
1241
+ project_id,
1242
+ zone,
1243
+ cluster_id,
1244
+ node_pool_id,
1245
+ options: nil
1246
+ req = {
1247
+ project_id: project_id,
1248
+ zone: zone,
1249
+ cluster_id: cluster_id,
1250
+ node_pool_id: node_pool_id
1251
+ }.delete_if { |_, v| v.nil? }
1252
+ req = Google::Gax::to_proto(req, Google::Container::V1::RollbackNodePoolUpgradeRequest)
1253
+ @rollback_node_pool_upgrade.call(req, options)
1254
+ end
1255
+
1256
+ # Sets the NodeManagement options for a node pool.
1257
+ #
1258
+ # @param project_id [String]
1259
+ # The Google Developers Console [project ID or project
1260
+ # number](https://support.google.com/cloud/answer/6158840).
1261
+ # @param zone [String]
1262
+ # The name of the Google Compute Engine
1263
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1264
+ # resides.
1265
+ # @param cluster_id [String]
1266
+ # The name of the cluster to update.
1267
+ # @param node_pool_id [String]
1268
+ # The name of the node pool to update.
1269
+ # @param management [Google::Container::V1::NodeManagement | Hash]
1270
+ # NodeManagement configuration for the node pool.
1271
+ # A hash of the same form as `Google::Container::V1::NodeManagement`
1272
+ # can also be provided.
1273
+ # @param options [Google::Gax::CallOptions]
1274
+ # Overrides the default settings for this call, e.g, timeout,
1275
+ # retries, etc.
1276
+ # @return [Google::Container::V1::Operation]
1277
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1278
+ # @example
1279
+ # require "google/cloud/container/v1"
1280
+ #
1281
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1282
+ # project_id = ''
1283
+ # zone = ''
1284
+ # cluster_id = ''
1285
+ # node_pool_id = ''
1286
+ # management = {}
1287
+ # response = cluster_manager_client.set_node_pool_management(project_id, zone, cluster_id, node_pool_id, management)
1288
+
1289
+ def set_node_pool_management \
1290
+ project_id,
1291
+ zone,
1292
+ cluster_id,
1293
+ node_pool_id,
1294
+ management,
1295
+ options: nil
1296
+ req = {
1297
+ project_id: project_id,
1298
+ zone: zone,
1299
+ cluster_id: cluster_id,
1300
+ node_pool_id: node_pool_id,
1301
+ management: management
1302
+ }.delete_if { |_, v| v.nil? }
1303
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetNodePoolManagementRequest)
1304
+ @set_node_pool_management.call(req, options)
1305
+ end
1306
+
1307
+ # Sets labels on a cluster.
1308
+ #
1309
+ # @param project_id [String]
1310
+ # The Google Developers Console [project ID or project
1311
+ # number](https://developers.google.com/console/help/new/#projectnumber).
1312
+ # @param zone [String]
1313
+ # The name of the Google Compute Engine
1314
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1315
+ # resides.
1316
+ # @param cluster_id [String]
1317
+ # The name of the cluster.
1318
+ # @param resource_labels [Hash{String => String}]
1319
+ # The labels to set for that cluster.
1320
+ # @param label_fingerprint [String]
1321
+ # The fingerprint of the previous set of labels for this resource,
1322
+ # used to detect conflicts. The fingerprint is initially generated by
1323
+ # Container Engine and changes after every request to modify or update
1324
+ # labels. You must always provide an up-to-date fingerprint hash when
1325
+ # updating or changing labels. Make a <code>get()</code> request to the
1326
+ # resource to get the latest fingerprint.
1327
+ # @param options [Google::Gax::CallOptions]
1328
+ # Overrides the default settings for this call, e.g, timeout,
1329
+ # retries, etc.
1330
+ # @return [Google::Container::V1::Operation]
1331
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1332
+ # @example
1333
+ # require "google/cloud/container/v1"
1334
+ #
1335
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1336
+ # project_id = ''
1337
+ # zone = ''
1338
+ # cluster_id = ''
1339
+ # resource_labels = {}
1340
+ # label_fingerprint = ''
1341
+ # response = cluster_manager_client.set_labels(project_id, zone, cluster_id, resource_labels, label_fingerprint)
1342
+
1343
+ def set_labels \
1344
+ project_id,
1345
+ zone,
1346
+ cluster_id,
1347
+ resource_labels,
1348
+ label_fingerprint,
1349
+ options: nil
1350
+ req = {
1351
+ project_id: project_id,
1352
+ zone: zone,
1353
+ cluster_id: cluster_id,
1354
+ resource_labels: resource_labels,
1355
+ label_fingerprint: label_fingerprint
1356
+ }.delete_if { |_, v| v.nil? }
1357
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetLabelsRequest)
1358
+ @set_labels.call(req, options)
1359
+ end
1360
+
1361
+ # Enables or disables the ABAC authorization mechanism on a cluster.
1362
+ #
1363
+ # @param project_id [String]
1364
+ # The Google Developers Console [project ID or project
1365
+ # number](https://support.google.com/cloud/answer/6158840).
1366
+ # @param zone [String]
1367
+ # The name of the Google Compute Engine
1368
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1369
+ # resides.
1370
+ # @param cluster_id [String]
1371
+ # The name of the cluster to update.
1372
+ # @param enabled [true, false]
1373
+ # Whether ABAC authorization will be enabled in the cluster.
1374
+ # @param options [Google::Gax::CallOptions]
1375
+ # Overrides the default settings for this call, e.g, timeout,
1376
+ # retries, etc.
1377
+ # @return [Google::Container::V1::Operation]
1378
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1379
+ # @example
1380
+ # require "google/cloud/container/v1"
1381
+ #
1382
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1383
+ # project_id = ''
1384
+ # zone = ''
1385
+ # cluster_id = ''
1386
+ # enabled = false
1387
+ # response = cluster_manager_client.set_legacy_abac(project_id, zone, cluster_id, enabled)
1388
+
1389
+ def set_legacy_abac \
1390
+ project_id,
1391
+ zone,
1392
+ cluster_id,
1393
+ enabled,
1394
+ options: nil
1395
+ req = {
1396
+ project_id: project_id,
1397
+ zone: zone,
1398
+ cluster_id: cluster_id,
1399
+ enabled: enabled
1400
+ }.delete_if { |_, v| v.nil? }
1401
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetLegacyAbacRequest)
1402
+ @set_legacy_abac.call(req, options)
1403
+ end
1404
+
1405
+ # Start master IP rotation.
1406
+ #
1407
+ # @param project_id [String]
1408
+ # The Google Developers Console [project ID or project
1409
+ # number](https://developers.google.com/console/help/new/#projectnumber).
1410
+ # @param zone [String]
1411
+ # The name of the Google Compute Engine
1412
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1413
+ # resides.
1414
+ # @param cluster_id [String]
1415
+ # The name of the cluster.
1416
+ # @param options [Google::Gax::CallOptions]
1417
+ # Overrides the default settings for this call, e.g, timeout,
1418
+ # retries, etc.
1419
+ # @return [Google::Container::V1::Operation]
1420
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1421
+ # @example
1422
+ # require "google/cloud/container/v1"
1423
+ #
1424
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1425
+ # project_id = ''
1426
+ # zone = ''
1427
+ # cluster_id = ''
1428
+ # response = cluster_manager_client.start_ip_rotation(project_id, zone, cluster_id)
1429
+
1430
+ def start_ip_rotation \
1431
+ project_id,
1432
+ zone,
1433
+ cluster_id,
1434
+ options: nil
1435
+ req = {
1436
+ project_id: project_id,
1437
+ zone: zone,
1438
+ cluster_id: cluster_id
1439
+ }.delete_if { |_, v| v.nil? }
1440
+ req = Google::Gax::to_proto(req, Google::Container::V1::StartIPRotationRequest)
1441
+ @start_ip_rotation.call(req, options)
1442
+ end
1443
+
1444
+ # Completes master IP rotation.
1445
+ #
1446
+ # @param project_id [String]
1447
+ # The Google Developers Console [project ID or project
1448
+ # number](https://developers.google.com/console/help/new/#projectnumber).
1449
+ # @param zone [String]
1450
+ # The name of the Google Compute Engine
1451
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1452
+ # resides.
1453
+ # @param cluster_id [String]
1454
+ # The name of the cluster.
1455
+ # @param options [Google::Gax::CallOptions]
1456
+ # Overrides the default settings for this call, e.g, timeout,
1457
+ # retries, etc.
1458
+ # @return [Google::Container::V1::Operation]
1459
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1460
+ # @example
1461
+ # require "google/cloud/container/v1"
1462
+ #
1463
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1464
+ # project_id = ''
1465
+ # zone = ''
1466
+ # cluster_id = ''
1467
+ # response = cluster_manager_client.complete_ip_rotation(project_id, zone, cluster_id)
1468
+
1469
+ def complete_ip_rotation \
1470
+ project_id,
1471
+ zone,
1472
+ cluster_id,
1473
+ options: nil
1474
+ req = {
1475
+ project_id: project_id,
1476
+ zone: zone,
1477
+ cluster_id: cluster_id
1478
+ }.delete_if { |_, v| v.nil? }
1479
+ req = Google::Gax::to_proto(req, Google::Container::V1::CompleteIPRotationRequest)
1480
+ @complete_ip_rotation.call(req, options)
1481
+ end
1482
+
1483
+ # Sets the size of a specific node pool.
1484
+ #
1485
+ # @param project_id [String]
1486
+ # The Google Developers Console [project ID or project
1487
+ # number](https://support.google.com/cloud/answer/6158840).
1488
+ # @param zone [String]
1489
+ # The name of the Google Compute Engine
1490
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1491
+ # resides.
1492
+ # @param cluster_id [String]
1493
+ # The name of the cluster to update.
1494
+ # @param node_pool_id [String]
1495
+ # The name of the node pool to update.
1496
+ # @param node_count [Integer]
1497
+ # The desired node count for the pool.
1498
+ # @param options [Google::Gax::CallOptions]
1499
+ # Overrides the default settings for this call, e.g, timeout,
1500
+ # retries, etc.
1501
+ # @return [Google::Container::V1::Operation]
1502
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1503
+ # @example
1504
+ # require "google/cloud/container/v1"
1505
+ #
1506
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1507
+ # project_id = ''
1508
+ # zone = ''
1509
+ # cluster_id = ''
1510
+ # node_pool_id = ''
1511
+ # node_count = 0
1512
+ # response = cluster_manager_client.set_node_pool_size(project_id, zone, cluster_id, node_pool_id, node_count)
1513
+
1514
+ def set_node_pool_size \
1515
+ project_id,
1516
+ zone,
1517
+ cluster_id,
1518
+ node_pool_id,
1519
+ node_count,
1520
+ options: nil
1521
+ req = {
1522
+ project_id: project_id,
1523
+ zone: zone,
1524
+ cluster_id: cluster_id,
1525
+ node_pool_id: node_pool_id,
1526
+ node_count: node_count
1527
+ }.delete_if { |_, v| v.nil? }
1528
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetNodePoolSizeRequest)
1529
+ @set_node_pool_size.call(req, options)
1530
+ end
1531
+
1532
+ # Enables/Disables Network Policy for a cluster.
1533
+ #
1534
+ # @param project_id [String]
1535
+ # The Google Developers Console [project ID or project
1536
+ # number](https://developers.google.com/console/help/new/#projectnumber).
1537
+ # @param zone [String]
1538
+ # The name of the Google Compute Engine
1539
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1540
+ # resides.
1541
+ # @param cluster_id [String]
1542
+ # The name of the cluster.
1543
+ # @param network_policy [Google::Container::V1::NetworkPolicy | Hash]
1544
+ # Configuration options for the NetworkPolicy feature.
1545
+ # A hash of the same form as `Google::Container::V1::NetworkPolicy`
1546
+ # can also be provided.
1547
+ # @param options [Google::Gax::CallOptions]
1548
+ # Overrides the default settings for this call, e.g, timeout,
1549
+ # retries, etc.
1550
+ # @return [Google::Container::V1::Operation]
1551
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1552
+ # @example
1553
+ # require "google/cloud/container/v1"
1554
+ #
1555
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1556
+ # project_id = ''
1557
+ # zone = ''
1558
+ # cluster_id = ''
1559
+ # network_policy = {}
1560
+ # response = cluster_manager_client.set_network_policy(project_id, zone, cluster_id, network_policy)
1561
+
1562
+ def set_network_policy \
1563
+ project_id,
1564
+ zone,
1565
+ cluster_id,
1566
+ network_policy,
1567
+ options: nil
1568
+ req = {
1569
+ project_id: project_id,
1570
+ zone: zone,
1571
+ cluster_id: cluster_id,
1572
+ network_policy: network_policy
1573
+ }.delete_if { |_, v| v.nil? }
1574
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetNetworkPolicyRequest)
1575
+ @set_network_policy.call(req, options)
1576
+ end
1577
+
1578
+ # Sets the maintenance policy for a cluster.
1579
+ #
1580
+ # @param project_id [String]
1581
+ # The Google Developers Console [project ID or project
1582
+ # number](https://support.google.com/cloud/answer/6158840).
1583
+ # @param zone [String]
1584
+ # The name of the Google Compute Engine
1585
+ # [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster
1586
+ # resides.
1587
+ # @param cluster_id [String]
1588
+ # The name of the cluster to update.
1589
+ # @param maintenance_policy [Google::Container::V1::MaintenancePolicy | Hash]
1590
+ # The maintenance policy to be set for the cluster. An empty field
1591
+ # clears the existing maintenance policy.
1592
+ # A hash of the same form as `Google::Container::V1::MaintenancePolicy`
1593
+ # can also be provided.
1594
+ # @param options [Google::Gax::CallOptions]
1595
+ # Overrides the default settings for this call, e.g, timeout,
1596
+ # retries, etc.
1597
+ # @return [Google::Container::V1::Operation]
1598
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1599
+ # @example
1600
+ # require "google/cloud/container/v1"
1601
+ #
1602
+ # cluster_manager_client = Google::Cloud::Container::V1.new
1603
+ # project_id = ''
1604
+ # zone = ''
1605
+ # cluster_id = ''
1606
+ # maintenance_policy = {}
1607
+ # response = cluster_manager_client.set_maintenance_policy(project_id, zone, cluster_id, maintenance_policy)
1608
+
1609
+ def set_maintenance_policy \
1610
+ project_id,
1611
+ zone,
1612
+ cluster_id,
1613
+ maintenance_policy,
1614
+ options: nil
1615
+ req = {
1616
+ project_id: project_id,
1617
+ zone: zone,
1618
+ cluster_id: cluster_id,
1619
+ maintenance_policy: maintenance_policy
1620
+ }.delete_if { |_, v| v.nil? }
1621
+ req = Google::Gax::to_proto(req, Google::Container::V1::SetMaintenancePolicyRequest)
1622
+ @set_maintenance_policy.call(req, options)
1623
+ end
1624
+ end
1625
+ end
1626
+ end
1627
+ end
1628
+ end