google-cloud-dataproc 0.10.0 → 1.0.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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -2
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +310 -0
  6. data/README.md +33 -44
  7. data/lib/{google/cloud/dataproc/v1/doc/google/protobuf/empty.rb → google-cloud-dataproc.rb} +4 -14
  8. data/lib/google/cloud/dataproc.rb +167 -305
  9. data/lib/google/cloud/dataproc/version.rb +6 -2
  10. metadata +97 -100
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/dataproc/v1.rb +0 -371
  13. data/lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb +0 -80
  14. data/lib/google/cloud/dataproc/v1/autoscaling_policies_services_pb.rb +0 -59
  15. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service_client.rb +0 -494
  16. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service_client_config.json +0 -51
  17. data/lib/google/cloud/dataproc/v1/cluster_controller_client.rb +0 -824
  18. data/lib/google/cloud/dataproc/v1/cluster_controller_client_config.json +0 -59
  19. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +0 -234
  20. data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +0 -69
  21. data/lib/google/cloud/dataproc/v1/credentials.rb +0 -41
  22. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/autoscaling_policies.rb +0 -238
  23. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/clusters.rb +0 -819
  24. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/jobs.rb +0 -759
  25. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/workflow_templates.rb +0 -566
  26. data/lib/google/cloud/dataproc/v1/doc/google/longrunning/operations.rb +0 -51
  27. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/any.rb +0 -131
  28. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/duration.rb +0 -91
  29. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/field_mask.rb +0 -222
  30. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/timestamp.rb +0 -113
  31. data/lib/google/cloud/dataproc/v1/doc/google/rpc/status.rb +0 -39
  32. data/lib/google/cloud/dataproc/v1/job_controller_client.rb +0 -592
  33. data/lib/google/cloud/dataproc/v1/job_controller_client_config.json +0 -59
  34. data/lib/google/cloud/dataproc/v1/jobs_pb.rb +0 -273
  35. data/lib/google/cloud/dataproc/v1/jobs_services_pb.rb +0 -61
  36. data/lib/google/cloud/dataproc/v1/operations_pb.rb +0 -45
  37. data/lib/google/cloud/dataproc/v1/shared_pb.rb +0 -26
  38. data/lib/google/cloud/dataproc/v1/workflow_template_service_client.rb +0 -770
  39. data/lib/google/cloud/dataproc/v1/workflow_template_service_client_config.json +0 -64
  40. data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +0 -184
  41. data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +0 -105
  42. data/lib/google/cloud/dataproc/v1beta2.rb +0 -371
  43. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policies_pb.rb +0 -80
  44. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policies_services_pb.rb +0 -59
  45. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service_client.rb +0 -494
  46. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service_client_config.json +0 -51
  47. data/lib/google/cloud/dataproc/v1beta2/cluster_controller_client.rb +0 -833
  48. data/lib/google/cloud/dataproc/v1beta2/cluster_controller_client_config.json +0 -59
  49. data/lib/google/cloud/dataproc/v1beta2/clusters_pb.rb +0 -241
  50. data/lib/google/cloud/dataproc/v1beta2/clusters_services_pb.rb +0 -69
  51. data/lib/google/cloud/dataproc/v1beta2/credentials.rb +0 -41
  52. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/autoscaling_policies.rb +0 -238
  53. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/clusters.rb +0 -841
  54. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/jobs.rb +0 -728
  55. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/workflow_templates.rb +0 -579
  56. data/lib/google/cloud/dataproc/v1beta2/doc/google/longrunning/operations.rb +0 -51
  57. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/any.rb +0 -131
  58. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/duration.rb +0 -91
  59. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/empty.rb +0 -29
  60. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/field_mask.rb +0 -222
  61. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/timestamp.rb +0 -113
  62. data/lib/google/cloud/dataproc/v1beta2/doc/google/rpc/status.rb +0 -39
  63. data/lib/google/cloud/dataproc/v1beta2/job_controller_client.rb +0 -592
  64. data/lib/google/cloud/dataproc/v1beta2/job_controller_client_config.json +0 -59
  65. data/lib/google/cloud/dataproc/v1beta2/jobs_pb.rb +0 -261
  66. data/lib/google/cloud/dataproc/v1beta2/jobs_services_pb.rb +0 -61
  67. data/lib/google/cloud/dataproc/v1beta2/operations_pb.rb +0 -44
  68. data/lib/google/cloud/dataproc/v1beta2/shared_pb.rb +0 -30
  69. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service_client.rb +0 -778
  70. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service_client_config.json +0 -64
  71. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_pb.rb +0 -186
  72. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_services_pb.rb +0 -105
@@ -1,59 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # Source: google/cloud/dataproc/v1/autoscaling_policies.proto for package 'google.cloud.dataproc.v1'
3
- # Original file comments:
4
- # Copyright 2020 Google LLC
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
-
20
- require 'grpc'
21
- require 'google/cloud/dataproc/v1/autoscaling_policies_pb'
22
-
23
- module Google
24
- module Cloud
25
- module Dataproc
26
- module V1
27
- module AutoscalingPolicyService
28
- # The API interface for managing autoscaling policies in the
29
- # Dataproc API.
30
- class Service
31
-
32
- include GRPC::GenericService
33
-
34
- self.marshal_class_method = :encode
35
- self.unmarshal_class_method = :decode
36
- self.service_name = 'google.cloud.dataproc.v1.AutoscalingPolicyService'
37
-
38
- # Creates new autoscaling policy.
39
- rpc :CreateAutoscalingPolicy, CreateAutoscalingPolicyRequest, AutoscalingPolicy
40
- # Updates (replaces) autoscaling policy.
41
- #
42
- # Disabled check for update_mask, because all updates will be full
43
- # replacements.
44
- rpc :UpdateAutoscalingPolicy, UpdateAutoscalingPolicyRequest, AutoscalingPolicy
45
- # Retrieves autoscaling policy.
46
- rpc :GetAutoscalingPolicy, GetAutoscalingPolicyRequest, AutoscalingPolicy
47
- # Lists autoscaling policies in the project.
48
- rpc :ListAutoscalingPolicies, ListAutoscalingPoliciesRequest, ListAutoscalingPoliciesResponse
49
- # Deletes an autoscaling policy. It is an error to delete an autoscaling
50
- # policy that is in use by one or more clusters.
51
- rpc :DeleteAutoscalingPolicy, DeleteAutoscalingPolicyRequest, Google::Protobuf::Empty
52
- end
53
-
54
- Stub = Service.rpc_stub_class
55
- end
56
- end
57
- end
58
- end
59
- end
@@ -1,494 +0,0 @@
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
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
186
- headers[:"x-goog-user-project"] = credentials.quota_project_id
187
- end
188
- headers.merge!(metadata) unless metadata.nil?
189
- client_config_file = Pathname.new(__dir__).join(
190
- "autoscaling_policy_service_client_config.json"
191
- )
192
- defaults = client_config_file.open do |f|
193
- Google::Gax.construct_settings(
194
- "google.cloud.dataproc.v1.AutoscalingPolicyService",
195
- JSON.parse(f.read),
196
- client_config,
197
- Google::Gax::Grpc::STATUS_CODE_NAMES,
198
- timeout,
199
- page_descriptors: PAGE_DESCRIPTORS,
200
- errors: Google::Gax::Grpc::API_ERRORS,
201
- metadata: headers
202
- )
203
- end
204
-
205
- # Allow overriding the service path/port in subclasses.
206
- service_path = service_address || self.class::SERVICE_ADDRESS
207
- port = service_port || self.class::DEFAULT_SERVICE_PORT
208
- interceptors = self.class::GRPC_INTERCEPTORS
209
- @autoscaling_policy_service_stub = Google::Gax::Grpc.create_stub(
210
- service_path,
211
- port,
212
- chan_creds: chan_creds,
213
- channel: channel,
214
- updater_proc: updater_proc,
215
- scopes: scopes,
216
- interceptors: interceptors,
217
- &Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Stub.method(:new)
218
- )
219
-
220
- @create_autoscaling_policy = Google::Gax.create_api_call(
221
- @autoscaling_policy_service_stub.method(:create_autoscaling_policy),
222
- defaults["create_autoscaling_policy"],
223
- exception_transformer: exception_transformer,
224
- params_extractor: proc do |request|
225
- {'parent' => request.parent}
226
- end
227
- )
228
- @update_autoscaling_policy = Google::Gax.create_api_call(
229
- @autoscaling_policy_service_stub.method(:update_autoscaling_policy),
230
- defaults["update_autoscaling_policy"],
231
- exception_transformer: exception_transformer,
232
- params_extractor: proc do |request|
233
- {'policy.name' => request.policy.name}
234
- end
235
- )
236
- @get_autoscaling_policy = Google::Gax.create_api_call(
237
- @autoscaling_policy_service_stub.method(:get_autoscaling_policy),
238
- defaults["get_autoscaling_policy"],
239
- exception_transformer: exception_transformer,
240
- params_extractor: proc do |request|
241
- {'name' => request.name}
242
- end
243
- )
244
- @list_autoscaling_policies = Google::Gax.create_api_call(
245
- @autoscaling_policy_service_stub.method(:list_autoscaling_policies),
246
- defaults["list_autoscaling_policies"],
247
- exception_transformer: exception_transformer,
248
- params_extractor: proc do |request|
249
- {'parent' => request.parent}
250
- end
251
- )
252
- @delete_autoscaling_policy = Google::Gax.create_api_call(
253
- @autoscaling_policy_service_stub.method(:delete_autoscaling_policy),
254
- defaults["delete_autoscaling_policy"],
255
- exception_transformer: exception_transformer,
256
- params_extractor: proc do |request|
257
- {'name' => request.name}
258
- end
259
- )
260
- end
261
-
262
- # Service calls
263
-
264
- # Creates new autoscaling policy.
265
- #
266
- # @param parent [String]
267
- # Required. The "resource name" of the region or location, as described
268
- # in https://cloud.google.com/apis/design/resource_names.
269
- #
270
- # * For `projects.regions.autoscalingPolicies.create`, the resource name
271
- # of the region has the following format:
272
- # `projects/{project_id}/regions/{region}`
273
- #
274
- # * For `projects.locations.autoscalingPolicies.create`, the resource name
275
- # of the location has the following format:
276
- # `projects/{project_id}/locations/{location}`
277
- # @param policy [Google::Cloud::Dataproc::V1::AutoscalingPolicy | Hash]
278
- # The autoscaling policy to create.
279
- # A hash of the same form as `Google::Cloud::Dataproc::V1::AutoscalingPolicy`
280
- # can also be provided.
281
- # @param options [Google::Gax::CallOptions]
282
- # Overrides the default settings for this call, e.g, timeout,
283
- # retries, etc.
284
- # @yield [result, operation] Access the result along with the RPC operation
285
- # @yieldparam result [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
286
- # @yieldparam operation [GRPC::ActiveCall::Operation]
287
- # @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
288
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
289
- # @example
290
- # require "google/cloud/dataproc"
291
- #
292
- # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
293
- # formatted_parent = Google::Cloud::Dataproc::V1::AutoscalingPolicyServiceClient.region_path("[PROJECT]", "[REGION]")
294
- #
295
- # # TODO: Initialize `policy`:
296
- # policy = {}
297
- # response = autoscaling_policy_client.create_autoscaling_policy(formatted_parent, policy)
298
-
299
- def create_autoscaling_policy \
300
- parent,
301
- policy,
302
- options: nil,
303
- &block
304
- req = {
305
- parent: parent,
306
- policy: policy
307
- }.delete_if { |_, v| v.nil? }
308
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::CreateAutoscalingPolicyRequest)
309
- @create_autoscaling_policy.call(req, options, &block)
310
- end
311
-
312
- # Updates (replaces) autoscaling policy.
313
- #
314
- # Disabled check for update_mask, because all updates will be full
315
- # replacements.
316
- #
317
- # @param policy [Google::Cloud::Dataproc::V1::AutoscalingPolicy | Hash]
318
- # Required. The updated autoscaling policy.
319
- # A hash of the same form as `Google::Cloud::Dataproc::V1::AutoscalingPolicy`
320
- # can also be provided.
321
- # @param options [Google::Gax::CallOptions]
322
- # Overrides the default settings for this call, e.g, timeout,
323
- # retries, etc.
324
- # @yield [result, operation] Access the result along with the RPC operation
325
- # @yieldparam result [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
326
- # @yieldparam operation [GRPC::ActiveCall::Operation]
327
- # @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
328
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
329
- # @example
330
- # require "google/cloud/dataproc"
331
- #
332
- # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
333
- #
334
- # # TODO: Initialize `policy`:
335
- # policy = {}
336
- # response = autoscaling_policy_client.update_autoscaling_policy(policy)
337
-
338
- def update_autoscaling_policy \
339
- policy,
340
- options: nil,
341
- &block
342
- req = {
343
- policy: policy
344
- }.delete_if { |_, v| v.nil? }
345
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::UpdateAutoscalingPolicyRequest)
346
- @update_autoscaling_policy.call(req, options, &block)
347
- end
348
-
349
- # Retrieves autoscaling policy.
350
- #
351
- # @param name [String]
352
- # Required. The "resource name" of the autoscaling policy, as described
353
- # in https://cloud.google.com/apis/design/resource_names.
354
- #
355
- # * For `projects.regions.autoscalingPolicies.get`, the resource name
356
- # of the policy has the following format:
357
- # `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
358
- #
359
- # * For `projects.locations.autoscalingPolicies.get`, the resource name
360
- # of the policy has the following format:
361
- # `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
362
- # @param options [Google::Gax::CallOptions]
363
- # Overrides the default settings for this call, e.g, timeout,
364
- # retries, etc.
365
- # @yield [result, operation] Access the result along with the RPC operation
366
- # @yieldparam result [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
367
- # @yieldparam operation [GRPC::ActiveCall::Operation]
368
- # @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
369
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
370
- # @example
371
- # require "google/cloud/dataproc"
372
- #
373
- # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
374
- # formatted_name = Google::Cloud::Dataproc::V1::AutoscalingPolicyServiceClient.autoscaling_policy_path("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
375
- # response = autoscaling_policy_client.get_autoscaling_policy(formatted_name)
376
-
377
- def get_autoscaling_policy \
378
- name,
379
- options: nil,
380
- &block
381
- req = {
382
- name: name
383
- }.delete_if { |_, v| v.nil? }
384
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::GetAutoscalingPolicyRequest)
385
- @get_autoscaling_policy.call(req, options, &block)
386
- end
387
-
388
- # Lists autoscaling policies in the project.
389
- #
390
- # @param parent [String]
391
- # Required. The "resource name" of the region or location, as described
392
- # in https://cloud.google.com/apis/design/resource_names.
393
- #
394
- # * For `projects.regions.autoscalingPolicies.list`, the resource name
395
- # of the region has the following format:
396
- # `projects/{project_id}/regions/{region}`
397
- #
398
- # * For `projects.locations.autoscalingPolicies.list`, the resource name
399
- # of the location has the following format:
400
- # `projects/{project_id}/locations/{location}`
401
- # @param page_size [Integer]
402
- # The maximum number of resources contained in the underlying API
403
- # response. If page streaming is performed per-resource, this
404
- # parameter does not affect the return value. If page streaming is
405
- # performed per-page, this determines the maximum number of
406
- # resources in a page.
407
- # @param options [Google::Gax::CallOptions]
408
- # Overrides the default settings for this call, e.g, timeout,
409
- # retries, etc.
410
- # @yield [result, operation] Access the result along with the RPC operation
411
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::AutoscalingPolicy>]
412
- # @yieldparam operation [GRPC::ActiveCall::Operation]
413
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::AutoscalingPolicy>]
414
- # An enumerable of Google::Cloud::Dataproc::V1::AutoscalingPolicy instances.
415
- # See Google::Gax::PagedEnumerable documentation for other
416
- # operations such as per-page iteration or access to the response
417
- # object.
418
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
419
- # @example
420
- # require "google/cloud/dataproc"
421
- #
422
- # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
423
- # formatted_parent = Google::Cloud::Dataproc::V1::AutoscalingPolicyServiceClient.region_path("[PROJECT]", "[REGION]")
424
- #
425
- # # Iterate over all results.
426
- # autoscaling_policy_client.list_autoscaling_policies(formatted_parent).each do |element|
427
- # # Process element.
428
- # end
429
- #
430
- # # Or iterate over results one page at a time.
431
- # autoscaling_policy_client.list_autoscaling_policies(formatted_parent).each_page do |page|
432
- # # Process each page at a time.
433
- # page.each do |element|
434
- # # Process element.
435
- # end
436
- # end
437
-
438
- def list_autoscaling_policies \
439
- parent,
440
- page_size: nil,
441
- options: nil,
442
- &block
443
- req = {
444
- parent: parent,
445
- page_size: page_size
446
- }.delete_if { |_, v| v.nil? }
447
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::ListAutoscalingPoliciesRequest)
448
- @list_autoscaling_policies.call(req, options, &block)
449
- end
450
-
451
- # Deletes an autoscaling policy. It is an error to delete an autoscaling
452
- # policy that is in use by one or more clusters.
453
- #
454
- # @param name [String]
455
- # Required. The "resource name" of the autoscaling policy, as described
456
- # in https://cloud.google.com/apis/design/resource_names.
457
- #
458
- # * For `projects.regions.autoscalingPolicies.delete`, the resource name
459
- # of the policy has the following format:
460
- # `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
461
- #
462
- # * For `projects.locations.autoscalingPolicies.delete`, the resource name
463
- # of the policy has the following format:
464
- # `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
465
- # @param options [Google::Gax::CallOptions]
466
- # Overrides the default settings for this call, e.g, timeout,
467
- # retries, etc.
468
- # @yield [result, operation] Access the result along with the RPC operation
469
- # @yieldparam result []
470
- # @yieldparam operation [GRPC::ActiveCall::Operation]
471
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
472
- # @example
473
- # require "google/cloud/dataproc"
474
- #
475
- # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1)
476
- # formatted_name = Google::Cloud::Dataproc::V1::AutoscalingPolicyServiceClient.autoscaling_policy_path("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
477
- # autoscaling_policy_client.delete_autoscaling_policy(formatted_name)
478
-
479
- def delete_autoscaling_policy \
480
- name,
481
- options: nil,
482
- &block
483
- req = {
484
- name: name
485
- }.delete_if { |_, v| v.nil? }
486
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::DeleteAutoscalingPolicyRequest)
487
- @delete_autoscaling_policy.call(req, options, &block)
488
- nil
489
- end
490
- end
491
- end
492
- end
493
- end
494
- end