google-cloud-dataproc 0.7.3 → 0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c03685adcdb562711ff81450df7a7cc90444f8f89d8cac3a77e8f04fe6e52c26
4
- data.tar.gz: 76887fdfc30a80b75fa15bf704ac565e2176acf0fdd34179804f1e98e8c2127c
3
+ metadata.gz: 50ba4599348472de65875bad49dc3ae2d958123cc77468ac1cfb0c142117f8b0
4
+ data.tar.gz: 3d6b2e61d53912b68f2119f01bcd34bbae0b30fb08c54c23b8d1636fafac4c1d
5
5
  SHA512:
6
- metadata.gz: cf1b0988a7691e5163d6959cc7f8cdb7655f651ceaa4b2f60c234d2c1d1952d6fd4fdbf16da4265f66963711d574f5fb903b5c61d6650d74f801df72112add5e
7
- data.tar.gz: 78a5e8ef225c601576c644af90e4ffa5c31ad33f45dd88af38ae1d9b98c48c80ab354ec1b57a8cf89a3d65ec98d340c8e06956ab38c207502d4367955661aa3c
6
+ metadata.gz: e358cdbe94e7e9762b19b57d1c3f9666d85a4836ee18dfdafc41f3c2e199557c07a5099a6589c05124bd6080a224fd1797b9277af836fdf38621a0be53f4a720
7
+ data.tar.gz: 31d4f8955fc9c2f3aaa5961af6a07b5bc54dcae0a14233e7876ef1a875161733fd906eeb06a7d8096ea823b94b1c0c6a7d8617749ecc07773a4ed960818a0cb2
@@ -16,6 +16,7 @@
16
16
  require "google/cloud/dataproc/v1/cluster_controller_client"
17
17
  require "google/cloud/dataproc/v1/job_controller_client"
18
18
  require "google/cloud/dataproc/v1/workflow_template_service_client"
19
+ require "google/cloud/dataproc/v1/autoscaling_policy_service_client"
19
20
  require "google/cloud/dataproc/v1/operations_pb"
20
21
  require "google/cloud/dataproc/v1/clusters_pb"
21
22
  require "google/cloud/dataproc/v1/workflow_templates_pb"
@@ -299,6 +300,71 @@ module Google
299
300
  Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.new(**kwargs)
300
301
  end
301
302
  end
303
+
304
+ module AutoscalingPolicyService
305
+ ##
306
+ # The API interface for managing autoscaling policies in the
307
+ # Dataproc API.
308
+ #
309
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
310
+ # Provides the means for authenticating requests made by the client. This parameter can
311
+ # be many types.
312
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
313
+ # authenticating requests made by this client.
314
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
315
+ # credentials for this client.
316
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
317
+ # credentials for this client.
318
+ # A `GRPC::Core::Channel` will be used to make calls through.
319
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
320
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
321
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
322
+ # metadata for requests, generally, to give OAuth credentials.
323
+ # @param scopes [Array<String>]
324
+ # The OAuth scopes for this service. This parameter is ignored if
325
+ # an updater_proc is supplied.
326
+ # @param client_config [Hash]
327
+ # A Hash for call options for each method. See
328
+ # Google::Gax#construct_settings for the structure of
329
+ # this data. Falls back to the default config if not specified
330
+ # or the specified config is missing data points.
331
+ # @param timeout [Numeric]
332
+ # The default timeout, in seconds, for calls made through this client.
333
+ # @param metadata [Hash]
334
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
335
+ # @param service_address [String]
336
+ # Override for the service hostname, or `nil` to leave as the default.
337
+ # @param service_port [Integer]
338
+ # Override for the service port, or `nil` to leave as the default.
339
+ # @param exception_transformer [Proc]
340
+ # An optional proc that intercepts any exceptions raised during an API call to inject
341
+ # custom error handling.
342
+ def self.new \
343
+ credentials: nil,
344
+ scopes: nil,
345
+ client_config: nil,
346
+ timeout: nil,
347
+ metadata: nil,
348
+ service_address: nil,
349
+ service_port: nil,
350
+ exception_transformer: nil,
351
+ lib_name: nil,
352
+ lib_version: nil
353
+ kwargs = {
354
+ credentials: credentials,
355
+ scopes: scopes,
356
+ client_config: client_config,
357
+ timeout: timeout,
358
+ metadata: metadata,
359
+ exception_transformer: exception_transformer,
360
+ lib_name: lib_name,
361
+ service_address: service_address,
362
+ service_port: service_port,
363
+ lib_version: lib_version
364
+ }.select { |_, v| v != nil }
365
+ Google::Cloud::Dataproc::V1::AutoscalingPolicyServiceClient.new(**kwargs)
366
+ end
367
+ end
302
368
  end
303
369
  end
304
370
  end
@@ -0,0 +1,491 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # 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/cloud/dataproc/v1/autoscaling_policies.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
+
23
+ require "json"
24
+ require "pathname"
25
+
26
+ require "google/gax"
27
+
28
+ require "google/cloud/dataproc/v1/autoscaling_policies_pb"
29
+ require "google/cloud/dataproc/v1/credentials"
30
+ require "google/cloud/dataproc/version"
31
+
32
+ module Google
33
+ module Cloud
34
+ module Dataproc
35
+ module V1
36
+ # The API interface for managing autoscaling policies in the
37
+ # Dataproc API.
38
+ #
39
+ # @!attribute [r] autoscaling_policy_service_stub
40
+ # @return [Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Stub]
41
+ class AutoscalingPolicyServiceClient
42
+ # @private
43
+ attr_reader :autoscaling_policy_service_stub
44
+
45
+ # The default address of the service.
46
+ SERVICE_ADDRESS = "dataproc.googleapis.com".freeze
47
+
48
+ # The default port of the service.
49
+ DEFAULT_SERVICE_PORT = 443
50
+
51
+ # The default set of gRPC interceptors.
52
+ GRPC_INTERCEPTORS = []
53
+
54
+ DEFAULT_TIMEOUT = 30
55
+
56
+ PAGE_DESCRIPTORS = {
57
+ "list_autoscaling_policies" => Google::Gax::PageDescriptor.new(
58
+ "page_token",
59
+ "next_page_token",
60
+ "policies")
61
+ }.freeze
62
+
63
+ private_constant :PAGE_DESCRIPTORS
64
+
65
+ # The scopes needed to make gRPC calls to all of the methods defined in
66
+ # this service.
67
+ ALL_SCOPES = [
68
+ "https://www.googleapis.com/auth/cloud-platform"
69
+ ].freeze
70
+
71
+
72
+ AUTOSCALING_POLICY_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
73
+ "projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}"
74
+ )
75
+
76
+ private_constant :AUTOSCALING_POLICY_PATH_TEMPLATE
77
+
78
+ REGION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
79
+ "projects/{project}/regions/{region}"
80
+ )
81
+
82
+ private_constant :REGION_PATH_TEMPLATE
83
+
84
+ # Returns a fully-qualified autoscaling_policy resource name string.
85
+ # @param project [String]
86
+ # @param region [String]
87
+ # @param autoscaling_policy [String]
88
+ # @return [String]
89
+ def self.autoscaling_policy_path project, region, autoscaling_policy
90
+ AUTOSCALING_POLICY_PATH_TEMPLATE.render(
91
+ :"project" => project,
92
+ :"region" => region,
93
+ :"autoscaling_policy" => autoscaling_policy
94
+ )
95
+ end
96
+
97
+ # Returns a fully-qualified region resource name string.
98
+ # @param project [String]
99
+ # @param region [String]
100
+ # @return [String]
101
+ def self.region_path project, region
102
+ REGION_PATH_TEMPLATE.render(
103
+ :"project" => project,
104
+ :"region" => region
105
+ )
106
+ end
107
+
108
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
109
+ # Provides the means for authenticating requests made by the client. This parameter can
110
+ # be many types.
111
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
112
+ # authenticating requests made by this client.
113
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
114
+ # credentials for this client.
115
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
116
+ # credentials for this client.
117
+ # A `GRPC::Core::Channel` will be used to make calls through.
118
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
119
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
120
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
121
+ # metadata for requests, generally, to give OAuth credentials.
122
+ # @param scopes [Array<String>]
123
+ # The OAuth scopes for this service. This parameter is ignored if
124
+ # an updater_proc is supplied.
125
+ # @param client_config [Hash]
126
+ # A Hash for call options for each method. See
127
+ # Google::Gax#construct_settings for the structure of
128
+ # this data. Falls back to the default config if not specified
129
+ # or the specified config is missing data points.
130
+ # @param timeout [Numeric]
131
+ # The default timeout, in seconds, for calls made through this client.
132
+ # @param metadata [Hash]
133
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
134
+ # @param service_address [String]
135
+ # Override for the service hostname, or `nil` to leave as the default.
136
+ # @param service_port [Integer]
137
+ # Override for the service port, or `nil` to leave as the default.
138
+ # @param exception_transformer [Proc]
139
+ # An optional proc that intercepts any exceptions raised during an API call to inject
140
+ # custom error handling.
141
+ def initialize \
142
+ credentials: nil,
143
+ scopes: ALL_SCOPES,
144
+ client_config: {},
145
+ timeout: DEFAULT_TIMEOUT,
146
+ metadata: nil,
147
+ service_address: nil,
148
+ service_port: nil,
149
+ exception_transformer: nil,
150
+ lib_name: nil,
151
+ lib_version: ""
152
+ # These require statements are intentionally placed here to initialize
153
+ # the gRPC module only when it's required.
154
+ # See https://github.com/googleapis/toolkit/issues/446
155
+ require "google/gax/grpc"
156
+ require "google/cloud/dataproc/v1/autoscaling_policies_services_pb"
157
+
158
+ credentials ||= Google::Cloud::Dataproc::V1::Credentials.default
159
+
160
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
161
+ updater_proc = Google::Cloud::Dataproc::V1::Credentials.new(credentials).updater_proc
162
+ end
163
+ if credentials.is_a?(GRPC::Core::Channel)
164
+ channel = credentials
165
+ end
166
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
167
+ chan_creds = credentials
168
+ end
169
+ if credentials.is_a?(Proc)
170
+ updater_proc = credentials
171
+ end
172
+ if credentials.is_a?(Google::Auth::Credentials)
173
+ updater_proc = credentials.updater_proc
174
+ end
175
+
176
+ package_version = Google::Cloud::Dataproc::VERSION
177
+
178
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
179
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
180
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
181
+ google_api_client << " grpc/#{GRPC::VERSION}"
182
+ google_api_client.freeze
183
+
184
+ headers = { :"x-goog-api-client" => google_api_client }
185
+ headers.merge!(metadata) unless metadata.nil?
186
+ client_config_file = Pathname.new(__dir__).join(
187
+ "autoscaling_policy_service_client_config.json"
188
+ )
189
+ defaults = client_config_file.open do |f|
190
+ Google::Gax.construct_settings(
191
+ "google.cloud.dataproc.v1.AutoscalingPolicyService",
192
+ JSON.parse(f.read),
193
+ client_config,
194
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
195
+ timeout,
196
+ page_descriptors: PAGE_DESCRIPTORS,
197
+ errors: Google::Gax::Grpc::API_ERRORS,
198
+ metadata: headers
199
+ )
200
+ end
201
+
202
+ # Allow overriding the service path/port in subclasses.
203
+ service_path = service_address || self.class::SERVICE_ADDRESS
204
+ port = service_port || self.class::DEFAULT_SERVICE_PORT
205
+ interceptors = self.class::GRPC_INTERCEPTORS
206
+ @autoscaling_policy_service_stub = Google::Gax::Grpc.create_stub(
207
+ service_path,
208
+ port,
209
+ chan_creds: chan_creds,
210
+ channel: channel,
211
+ updater_proc: updater_proc,
212
+ scopes: scopes,
213
+ interceptors: interceptors,
214
+ &Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Stub.method(:new)
215
+ )
216
+
217
+ @create_autoscaling_policy = Google::Gax.create_api_call(
218
+ @autoscaling_policy_service_stub.method(:create_autoscaling_policy),
219
+ defaults["create_autoscaling_policy"],
220
+ exception_transformer: exception_transformer,
221
+ params_extractor: proc do |request|
222
+ {'parent' => request.parent}
223
+ end
224
+ )
225
+ @update_autoscaling_policy = Google::Gax.create_api_call(
226
+ @autoscaling_policy_service_stub.method(:update_autoscaling_policy),
227
+ defaults["update_autoscaling_policy"],
228
+ exception_transformer: exception_transformer,
229
+ params_extractor: proc do |request|
230
+ {'policy.name' => request.policy.name}
231
+ end
232
+ )
233
+ @get_autoscaling_policy = Google::Gax.create_api_call(
234
+ @autoscaling_policy_service_stub.method(:get_autoscaling_policy),
235
+ defaults["get_autoscaling_policy"],
236
+ exception_transformer: exception_transformer,
237
+ params_extractor: proc do |request|
238
+ {'name' => request.name}
239
+ end
240
+ )
241
+ @list_autoscaling_policies = Google::Gax.create_api_call(
242
+ @autoscaling_policy_service_stub.method(:list_autoscaling_policies),
243
+ defaults["list_autoscaling_policies"],
244
+ exception_transformer: exception_transformer,
245
+ params_extractor: proc do |request|
246
+ {'parent' => request.parent}
247
+ end
248
+ )
249
+ @delete_autoscaling_policy = Google::Gax.create_api_call(
250
+ @autoscaling_policy_service_stub.method(:delete_autoscaling_policy),
251
+ defaults["delete_autoscaling_policy"],
252
+ exception_transformer: exception_transformer,
253
+ params_extractor: proc do |request|
254
+ {'name' => request.name}
255
+ end
256
+ )
257
+ end
258
+
259
+ # Service calls
260
+
261
+ # Creates new autoscaling policy.
262
+ #
263
+ # @param parent [String]
264
+ # Required. The "resource name" of the region or location, as described
265
+ # in https://cloud.google.com/apis/design/resource_names.
266
+ #
267
+ # * For `projects.regions.autoscalingPolicies.create`, the resource name
268
+ # of the region has the following format:
269
+ # `projects/{project_id}/regions/{region}`
270
+ #
271
+ # * For `projects.locations.autoscalingPolicies.create`, the resource name
272
+ # of the location has the following format:
273
+ # `projects/{project_id}/locations/{location}`
274
+ # @param policy [Google::Cloud::Dataproc::V1::AutoscalingPolicy | Hash]
275
+ # The autoscaling policy to create.
276
+ # A hash of the same form as `Google::Cloud::Dataproc::V1::AutoscalingPolicy`
277
+ # can also be provided.
278
+ # @param options [Google::Gax::CallOptions]
279
+ # Overrides the default settings for this call, e.g, timeout,
280
+ # retries, etc.
281
+ # @yield [result, operation] Access the result along with the RPC operation
282
+ # @yieldparam result [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
283
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
284
+ # @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
285
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
286
+ # @example
287
+ # require "google/cloud/dataproc"
288
+ #
289
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
290
+ # formatted_parent = Google::Cloud::Dataproc::V1::AutoscalingPolicyServiceClient.region_path("[PROJECT]", "[REGION]")
291
+ #
292
+ # # TODO: Initialize `policy`:
293
+ # policy = {}
294
+ # response = autoscaling_policy_client.create_autoscaling_policy(formatted_parent, policy)
295
+
296
+ def create_autoscaling_policy \
297
+ parent,
298
+ policy,
299
+ options: nil,
300
+ &block
301
+ req = {
302
+ parent: parent,
303
+ policy: policy
304
+ }.delete_if { |_, v| v.nil? }
305
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::CreateAutoscalingPolicyRequest)
306
+ @create_autoscaling_policy.call(req, options, &block)
307
+ end
308
+
309
+ # Updates (replaces) autoscaling policy.
310
+ #
311
+ # Disabled check for update_mask, because all updates will be full
312
+ # replacements.
313
+ #
314
+ # @param policy [Google::Cloud::Dataproc::V1::AutoscalingPolicy | Hash]
315
+ # Required. The updated autoscaling policy.
316
+ # A hash of the same form as `Google::Cloud::Dataproc::V1::AutoscalingPolicy`
317
+ # can also be provided.
318
+ # @param options [Google::Gax::CallOptions]
319
+ # Overrides the default settings for this call, e.g, timeout,
320
+ # retries, etc.
321
+ # @yield [result, operation] Access the result along with the RPC operation
322
+ # @yieldparam result [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
323
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
324
+ # @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
325
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
326
+ # @example
327
+ # require "google/cloud/dataproc"
328
+ #
329
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
330
+ #
331
+ # # TODO: Initialize `policy`:
332
+ # policy = {}
333
+ # response = autoscaling_policy_client.update_autoscaling_policy(policy)
334
+
335
+ def update_autoscaling_policy \
336
+ policy,
337
+ options: nil,
338
+ &block
339
+ req = {
340
+ policy: policy
341
+ }.delete_if { |_, v| v.nil? }
342
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::UpdateAutoscalingPolicyRequest)
343
+ @update_autoscaling_policy.call(req, options, &block)
344
+ end
345
+
346
+ # Retrieves autoscaling policy.
347
+ #
348
+ # @param name [String]
349
+ # Required. The "resource name" of the autoscaling policy, as described
350
+ # in https://cloud.google.com/apis/design/resource_names.
351
+ #
352
+ # * For `projects.regions.autoscalingPolicies.get`, the resource name
353
+ # of the policy has the following format:
354
+ # `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
355
+ #
356
+ # * For `projects.locations.autoscalingPolicies.get`, the resource name
357
+ # of the policy has the following format:
358
+ # `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
359
+ # @param options [Google::Gax::CallOptions]
360
+ # Overrides the default settings for this call, e.g, timeout,
361
+ # retries, etc.
362
+ # @yield [result, operation] Access the result along with the RPC operation
363
+ # @yieldparam result [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
364
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
365
+ # @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
366
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
367
+ # @example
368
+ # require "google/cloud/dataproc"
369
+ #
370
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
371
+ # formatted_name = Google::Cloud::Dataproc::V1::AutoscalingPolicyServiceClient.autoscaling_policy_path("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
372
+ # response = autoscaling_policy_client.get_autoscaling_policy(formatted_name)
373
+
374
+ def get_autoscaling_policy \
375
+ name,
376
+ options: nil,
377
+ &block
378
+ req = {
379
+ name: name
380
+ }.delete_if { |_, v| v.nil? }
381
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::GetAutoscalingPolicyRequest)
382
+ @get_autoscaling_policy.call(req, options, &block)
383
+ end
384
+
385
+ # Lists autoscaling policies in the project.
386
+ #
387
+ # @param parent [String]
388
+ # Required. The "resource name" of the region or location, as described
389
+ # in https://cloud.google.com/apis/design/resource_names.
390
+ #
391
+ # * For `projects.regions.autoscalingPolicies.list`, the resource name
392
+ # of the region has the following format:
393
+ # `projects/{project_id}/regions/{region}`
394
+ #
395
+ # * For `projects.locations.autoscalingPolicies.list`, the resource name
396
+ # of the location has the following format:
397
+ # `projects/{project_id}/locations/{location}`
398
+ # @param page_size [Integer]
399
+ # The maximum number of resources contained in the underlying API
400
+ # response. If page streaming is performed per-resource, this
401
+ # parameter does not affect the return value. If page streaming is
402
+ # performed per-page, this determines the maximum number of
403
+ # resources in a page.
404
+ # @param options [Google::Gax::CallOptions]
405
+ # Overrides the default settings for this call, e.g, timeout,
406
+ # retries, etc.
407
+ # @yield [result, operation] Access the result along with the RPC operation
408
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::AutoscalingPolicy>]
409
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
410
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::AutoscalingPolicy>]
411
+ # An enumerable of Google::Cloud::Dataproc::V1::AutoscalingPolicy instances.
412
+ # See Google::Gax::PagedEnumerable documentation for other
413
+ # operations such as per-page iteration or access to the response
414
+ # object.
415
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
416
+ # @example
417
+ # require "google/cloud/dataproc"
418
+ #
419
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
420
+ # formatted_parent = Google::Cloud::Dataproc::V1::AutoscalingPolicyServiceClient.region_path("[PROJECT]", "[REGION]")
421
+ #
422
+ # # Iterate over all results.
423
+ # autoscaling_policy_client.list_autoscaling_policies(formatted_parent).each do |element|
424
+ # # Process element.
425
+ # end
426
+ #
427
+ # # Or iterate over results one page at a time.
428
+ # autoscaling_policy_client.list_autoscaling_policies(formatted_parent).each_page do |page|
429
+ # # Process each page at a time.
430
+ # page.each do |element|
431
+ # # Process element.
432
+ # end
433
+ # end
434
+
435
+ def list_autoscaling_policies \
436
+ parent,
437
+ page_size: nil,
438
+ options: nil,
439
+ &block
440
+ req = {
441
+ parent: parent,
442
+ page_size: page_size
443
+ }.delete_if { |_, v| v.nil? }
444
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::ListAutoscalingPoliciesRequest)
445
+ @list_autoscaling_policies.call(req, options, &block)
446
+ end
447
+
448
+ # Deletes an autoscaling policy. It is an error to delete an autoscaling
449
+ # policy that is in use by one or more clusters.
450
+ #
451
+ # @param name [String]
452
+ # Required. The "resource name" of the autoscaling policy, as described
453
+ # in https://cloud.google.com/apis/design/resource_names.
454
+ #
455
+ # * For `projects.regions.autoscalingPolicies.delete`, the resource name
456
+ # of the policy has the following format:
457
+ # `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
458
+ #
459
+ # * For `projects.locations.autoscalingPolicies.delete`, the resource name
460
+ # of the policy has the following format:
461
+ # `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
462
+ # @param options [Google::Gax::CallOptions]
463
+ # Overrides the default settings for this call, e.g, timeout,
464
+ # retries, etc.
465
+ # @yield [result, operation] Access the result along with the RPC operation
466
+ # @yieldparam result []
467
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
468
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
469
+ # @example
470
+ # require "google/cloud/dataproc"
471
+ #
472
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
473
+ # formatted_name = Google::Cloud::Dataproc::V1::AutoscalingPolicyServiceClient.autoscaling_policy_path("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
474
+ # autoscaling_policy_client.delete_autoscaling_policy(formatted_name)
475
+
476
+ def delete_autoscaling_policy \
477
+ name,
478
+ options: nil,
479
+ &block
480
+ req = {
481
+ name: name
482
+ }.delete_if { |_, v| v.nil? }
483
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::DeleteAutoscalingPolicyRequest)
484
+ @delete_autoscaling_policy.call(req, options, &block)
485
+ nil
486
+ end
487
+ end
488
+ end
489
+ end
490
+ end
491
+ end
@@ -0,0 +1,51 @@
1
+ {
2
+ "interfaces": {
3
+ "google.cloud.dataproc.v1.AutoscalingPolicyService": {
4
+ "retry_codes": {
5
+ "idempotent": [
6
+ "DEADLINE_EXCEEDED",
7
+ "UNAVAILABLE"
8
+ ],
9
+ "non_idempotent": []
10
+ },
11
+ "retry_params": {
12
+ "default": {
13
+ "initial_retry_delay_millis": 100,
14
+ "retry_delay_multiplier": 1.3,
15
+ "max_retry_delay_millis": 60000,
16
+ "initial_rpc_timeout_millis": 20000,
17
+ "rpc_timeout_multiplier": 1.0,
18
+ "max_rpc_timeout_millis": 20000,
19
+ "total_timeout_millis": 600000
20
+ }
21
+ },
22
+ "methods": {
23
+ "CreateAutoscalingPolicy": {
24
+ "timeout_millis": 60000,
25
+ "retry_codes_name": "non_idempotent",
26
+ "retry_params_name": "default"
27
+ },
28
+ "UpdateAutoscalingPolicy": {
29
+ "timeout_millis": 60000,
30
+ "retry_codes_name": "idempotent",
31
+ "retry_params_name": "default"
32
+ },
33
+ "GetAutoscalingPolicy": {
34
+ "timeout_millis": 60000,
35
+ "retry_codes_name": "idempotent",
36
+ "retry_params_name": "default"
37
+ },
38
+ "ListAutoscalingPolicies": {
39
+ "timeout_millis": 60000,
40
+ "retry_codes_name": "idempotent",
41
+ "retry_params_name": "default"
42
+ },
43
+ "DeleteAutoscalingPolicy": {
44
+ "timeout_millis": 60000,
45
+ "retry_codes_name": "non_idempotent",
46
+ "retry_params_name": "default"
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
@@ -17,6 +17,221 @@ module Google
17
17
  module Cloud
18
18
  module Dataproc
19
19
  module V1
20
+ # Describes an autoscaling policy for Dataproc cluster autoscaler.
21
+ # @!attribute [rw] id
22
+ # @return [String]
23
+ # Required. The policy id.
24
+ #
25
+ # The id must contain only letters (a-z, A-Z), numbers (0-9),
26
+ # underscores (_), and hyphens (-). Cannot begin or end with underscore
27
+ # or hyphen. Must consist of between 3 and 50 characters.
28
+ # @!attribute [rw] name
29
+ # @return [String]
30
+ # Output only. The "resource name" of the autoscaling policy, as described
31
+ # in https://cloud.google.com/apis/design/resource_names.
32
+ #
33
+ # * For `projects.regions.autoscalingPolicies`, the resource name of the
34
+ # policy has the following format:
35
+ # `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
36
+ #
37
+ # * For `projects.locations.autoscalingPolicies`, the resource name of the
38
+ # policy has the following format:
39
+ # `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
40
+ # @!attribute [rw] basic_algorithm
41
+ # @return [Google::Cloud::Dataproc::V1::BasicAutoscalingAlgorithm]
42
+ # @!attribute [rw] worker_config
43
+ # @return [Google::Cloud::Dataproc::V1::InstanceGroupAutoscalingPolicyConfig]
44
+ # Required. Describes how the autoscaler will operate for primary workers.
45
+ # @!attribute [rw] secondary_worker_config
46
+ # @return [Google::Cloud::Dataproc::V1::InstanceGroupAutoscalingPolicyConfig]
47
+ # Optional. Describes how the autoscaler will operate for secondary workers.
48
+ class AutoscalingPolicy; end
49
+
50
+ # Basic algorithm for autoscaling.
51
+ # @!attribute [rw] yarn_config
52
+ # @return [Google::Cloud::Dataproc::V1::BasicYarnAutoscalingConfig]
53
+ # Required. YARN autoscaling configuration.
54
+ # @!attribute [rw] cooldown_period
55
+ # @return [Google::Protobuf::Duration]
56
+ # Optional. Duration between scaling events. A scaling period starts after
57
+ # the update operation from the previous event has completed.
58
+ #
59
+ # Bounds: [2m, 1d]. Default: 2m.
60
+ class BasicAutoscalingAlgorithm; end
61
+
62
+ # Basic autoscaling configurations for YARN.
63
+ # @!attribute [rw] graceful_decommission_timeout
64
+ # @return [Google::Protobuf::Duration]
65
+ # Required. Timeout for YARN graceful decommissioning of Node Managers.
66
+ # Specifies the duration to wait for jobs to complete before forcefully
67
+ # removing workers (and potentially interrupting jobs). Only applicable to
68
+ # downscaling operations.
69
+ #
70
+ # Bounds: [0s, 1d].
71
+ # @!attribute [rw] scale_up_factor
72
+ # @return [Float]
73
+ # Required. Fraction of average pending memory in the last cooldown period
74
+ # for which to add workers. A scale-up factor of 1.0 will result in scaling
75
+ # up so that there is no pending memory remaining after the update (more
76
+ # aggressive scaling). A scale-up factor closer to 0 will result in a smaller
77
+ # magnitude of scaling up (less aggressive scaling).
78
+ #
79
+ # Bounds: [0.0, 1.0].
80
+ # @!attribute [rw] scale_down_factor
81
+ # @return [Float]
82
+ # Required. Fraction of average pending memory in the last cooldown period
83
+ # for which to remove workers. A scale-down factor of 1 will result in
84
+ # scaling down so that there is no available memory remaining after the
85
+ # update (more aggressive scaling). A scale-down factor of 0 disables
86
+ # removing workers, which can be beneficial for autoscaling a single job.
87
+ #
88
+ # Bounds: [0.0, 1.0].
89
+ # @!attribute [rw] scale_up_min_worker_fraction
90
+ # @return [Float]
91
+ # Optional. Minimum scale-up threshold as a fraction of total cluster size
92
+ # before scaling occurs. For example, in a 20-worker cluster, a threshold of
93
+ # 0.1 means the autoscaler must recommend at least a 2-worker scale-up for
94
+ # the cluster to scale. A threshold of 0 means the autoscaler will scale up
95
+ # on any recommended change.
96
+ #
97
+ # Bounds: [0.0, 1.0]. Default: 0.0.
98
+ # @!attribute [rw] scale_down_min_worker_fraction
99
+ # @return [Float]
100
+ # Optional. Minimum scale-down threshold as a fraction of total cluster size
101
+ # before scaling occurs. For example, in a 20-worker cluster, a threshold of
102
+ # 0.1 means the autoscaler must recommend at least a 2 worker scale-down for
103
+ # the cluster to scale. A threshold of 0 means the autoscaler will scale down
104
+ # on any recommended change.
105
+ #
106
+ # Bounds: [0.0, 1.0]. Default: 0.0.
107
+ class BasicYarnAutoscalingConfig; end
108
+
109
+ # Configuration for the size bounds of an instance group, including its
110
+ # proportional size to other groups.
111
+ # @!attribute [rw] min_instances
112
+ # @return [Integer]
113
+ # Optional. Minimum number of instances for this group.
114
+ #
115
+ # Primary workers - Bounds: [2, max_instances]. Default: 2.
116
+ # Secondary workers - Bounds: [0, max_instances]. Default: 0.
117
+ # @!attribute [rw] max_instances
118
+ # @return [Integer]
119
+ # Required. Maximum number of instances for this group. Required for primary
120
+ # workers. Note that by default, clusters will not use secondary workers.
121
+ # Required for secondary workers if the minimum secondary instances is set.
122
+ #
123
+ # Primary workers - Bounds: [min_instances, ).
124
+ # Secondary workers - Bounds: [min_instances, ). Default: 0.
125
+ # @!attribute [rw] weight
126
+ # @return [Integer]
127
+ # Optional. Weight for the instance group, which is used to determine the
128
+ # fraction of total workers in the cluster from this instance group.
129
+ # For example, if primary workers have weight 2, and secondary workers have
130
+ # weight 1, the cluster will have approximately 2 primary workers for each
131
+ # secondary worker.
132
+ #
133
+ # The cluster may not reach the specified balance if constrained
134
+ # by min/max bounds or other autoscaling settings. For example, if
135
+ # `max_instances` for secondary workers is 0, then only primary workers will
136
+ # be added. The cluster can also be out of balance when created.
137
+ #
138
+ # If weight is not set on any instance group, the cluster will default to
139
+ # equal weight for all groups: the cluster will attempt to maintain an equal
140
+ # number of workers in each group within the configured size bounds for each
141
+ # group. If weight is set for one group only, the cluster will default to
142
+ # zero weight on the unset group. For example if weight is set only on
143
+ # primary workers, the cluster will use primary workers only and no
144
+ # secondary workers.
145
+ class InstanceGroupAutoscalingPolicyConfig; end
146
+
147
+ # A request to create an autoscaling policy.
148
+ # @!attribute [rw] parent
149
+ # @return [String]
150
+ # Required. The "resource name" of the region or location, as described
151
+ # in https://cloud.google.com/apis/design/resource_names.
152
+ #
153
+ # * For `projects.regions.autoscalingPolicies.create`, the resource name
154
+ # of the region has the following format:
155
+ # `projects/{project_id}/regions/{region}`
156
+ #
157
+ # * For `projects.locations.autoscalingPolicies.create`, the resource name
158
+ # of the location has the following format:
159
+ # `projects/{project_id}/locations/{location}`
160
+ # @!attribute [rw] policy
161
+ # @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
162
+ # The autoscaling policy to create.
163
+ class CreateAutoscalingPolicyRequest; end
164
+
165
+ # A request to fetch an autoscaling policy.
166
+ # @!attribute [rw] name
167
+ # @return [String]
168
+ # Required. The "resource name" of the autoscaling policy, as described
169
+ # in https://cloud.google.com/apis/design/resource_names.
170
+ #
171
+ # * For `projects.regions.autoscalingPolicies.get`, the resource name
172
+ # of the policy has the following format:
173
+ # `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
174
+ #
175
+ # * For `projects.locations.autoscalingPolicies.get`, the resource name
176
+ # of the policy has the following format:
177
+ # `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
178
+ class GetAutoscalingPolicyRequest; end
179
+
180
+ # A request to update an autoscaling policy.
181
+ # @!attribute [rw] policy
182
+ # @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
183
+ # Required. The updated autoscaling policy.
184
+ class UpdateAutoscalingPolicyRequest; end
185
+
186
+ # A request to delete an autoscaling policy.
187
+ #
188
+ # Autoscaling policies in use by one or more clusters will not be deleted.
189
+ # @!attribute [rw] name
190
+ # @return [String]
191
+ # Required. The "resource name" of the autoscaling policy, as described
192
+ # in https://cloud.google.com/apis/design/resource_names.
193
+ #
194
+ # * For `projects.regions.autoscalingPolicies.delete`, the resource name
195
+ # of the policy has the following format:
196
+ # `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
197
+ #
198
+ # * For `projects.locations.autoscalingPolicies.delete`, the resource name
199
+ # of the policy has the following format:
200
+ # `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
201
+ class DeleteAutoscalingPolicyRequest; end
202
+
203
+ # A request to list autoscaling policies in a project.
204
+ # @!attribute [rw] parent
205
+ # @return [String]
206
+ # Required. The "resource name" of the region or location, as described
207
+ # in https://cloud.google.com/apis/design/resource_names.
208
+ #
209
+ # * For `projects.regions.autoscalingPolicies.list`, the resource name
210
+ # of the region has the following format:
211
+ # `projects/{project_id}/regions/{region}`
212
+ #
213
+ # * For `projects.locations.autoscalingPolicies.list`, the resource name
214
+ # of the location has the following format:
215
+ # `projects/{project_id}/locations/{location}`
216
+ # @!attribute [rw] page_size
217
+ # @return [Integer]
218
+ # Optional. The maximum number of results to return in each response.
219
+ # Must be less than or equal to 1000. Defaults to 100.
220
+ # @!attribute [rw] page_token
221
+ # @return [String]
222
+ # Optional. The page token, returned by a previous call, to request the
223
+ # next page of results.
224
+ class ListAutoscalingPoliciesRequest; end
225
+
226
+ # A response to a request to list autoscaling policies in a project.
227
+ # @!attribute [rw] policies
228
+ # @return [Array<Google::Cloud::Dataproc::V1::AutoscalingPolicy>]
229
+ # Output only. Autoscaling policies list.
230
+ # @!attribute [rw] next_page_token
231
+ # @return [String]
232
+ # Output only. This token is included in the response if there are more
233
+ # results to fetch.
234
+ class ListAutoscalingPoliciesResponse; end
20
235
  end
21
236
  end
22
237
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Dataproc
19
- VERSION = "0.7.3".freeze
19
+ VERSION = "0.8.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-dataproc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-23 00:00:00.000000000 Z
11
+ date: 2020-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-gax
@@ -149,6 +149,8 @@ files:
149
149
  - lib/google/cloud/dataproc/v1.rb
150
150
  - lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb
151
151
  - lib/google/cloud/dataproc/v1/autoscaling_policies_services_pb.rb
152
+ - lib/google/cloud/dataproc/v1/autoscaling_policy_service_client.rb
153
+ - lib/google/cloud/dataproc/v1/autoscaling_policy_service_client_config.json
152
154
  - lib/google/cloud/dataproc/v1/cluster_controller_client.rb
153
155
  - lib/google/cloud/dataproc/v1/cluster_controller_client_config.json
154
156
  - lib/google/cloud/dataproc/v1/clusters_pb.rb