google-cloud-dataproc 0.3.1 → 0.4.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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/dataproc.rb +53 -0
  3. data/lib/google/cloud/dataproc/v1/cluster_controller_client.rb +14 -16
  4. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +2 -0
  5. data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +1 -1
  6. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/clusters.rb +29 -26
  7. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/jobs.rb +8 -7
  8. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/workflow_templates.rb +6 -6
  9. data/lib/google/cloud/dataproc/v1/job_controller_client.rb +4 -3
  10. data/lib/google/cloud/dataproc/v1/jobs_services_pb.rb +1 -1
  11. data/lib/google/cloud/dataproc/v1/shared_pb.rb +26 -0
  12. data/lib/google/cloud/dataproc/v1/workflow_template_service_client.rb +3 -3
  13. data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +2 -3
  14. data/lib/google/cloud/dataproc/v1beta2.rb +58 -0
  15. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policies_pb.rb +81 -0
  16. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policies_services_pb.rb +60 -0
  17. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service_client.rb +457 -0
  18. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service_client_config.json +51 -0
  19. data/lib/google/cloud/dataproc/v1beta2/cluster_controller_client.rb +18 -16
  20. data/lib/google/cloud/dataproc/v1beta2/clusters_pb.rb +48 -0
  21. data/lib/google/cloud/dataproc/v1beta2/clusters_services_pb.rb +1 -1
  22. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/autoscaling_policies.rb +202 -0
  23. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/clusters.rb +172 -28
  24. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/jobs.rb +44 -9
  25. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/workflow_templates.rb +8 -6
  26. data/lib/google/cloud/dataproc/v1beta2/job_controller_client.rb +5 -5
  27. data/lib/google/cloud/dataproc/v1beta2/jobs_pb.rb +10 -0
  28. data/lib/google/cloud/dataproc/v1beta2/jobs_services_pb.rb +1 -1
  29. data/lib/google/cloud/dataproc/v1beta2/shared_pb.rb +12 -0
  30. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service_client.rb +3 -3
  31. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_services_pb.rb +2 -3
  32. data/lib/google/cloud/dataproc/version.rb +22 -0
  33. metadata +9 -2
@@ -0,0 +1,81 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/dataproc/v1beta2/autoscaling_policies.proto
3
+
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/annotations_pb'
8
+ require 'google/cloud/dataproc/v1beta2/clusters_pb'
9
+ require 'google/cloud/dataproc/v1beta2/jobs_pb'
10
+ require 'google/longrunning/operations_pb'
11
+ require 'google/protobuf/duration_pb'
12
+ require 'google/protobuf/empty_pb'
13
+ require 'google/protobuf/timestamp_pb'
14
+ Google::Protobuf::DescriptorPool.generated_pool.build do
15
+ add_message "google.cloud.dataproc.v1beta2.AutoscalingPolicy" do
16
+ optional :id, :string, 1
17
+ optional :name, :string, 2
18
+ optional :worker_config, :message, 4, "google.cloud.dataproc.v1beta2.InstanceGroupAutoscalingPolicyConfig"
19
+ optional :secondary_worker_config, :message, 5, "google.cloud.dataproc.v1beta2.InstanceGroupAutoscalingPolicyConfig"
20
+ oneof :algorithm do
21
+ optional :basic_algorithm, :message, 3, "google.cloud.dataproc.v1beta2.BasicAutoscalingAlgorithm"
22
+ end
23
+ end
24
+ add_message "google.cloud.dataproc.v1beta2.BasicAutoscalingAlgorithm" do
25
+ optional :yarn_config, :message, 1, "google.cloud.dataproc.v1beta2.BasicYarnAutoscalingConfig"
26
+ optional :cooldown_period, :message, 2, "google.protobuf.Duration"
27
+ end
28
+ add_message "google.cloud.dataproc.v1beta2.BasicYarnAutoscalingConfig" do
29
+ optional :graceful_decommission_timeout, :message, 5, "google.protobuf.Duration"
30
+ optional :scale_up_factor, :double, 1
31
+ optional :scale_down_factor, :double, 2
32
+ optional :scale_up_min_worker_fraction, :double, 3
33
+ optional :scale_down_min_worker_fraction, :double, 4
34
+ end
35
+ add_message "google.cloud.dataproc.v1beta2.InstanceGroupAutoscalingPolicyConfig" do
36
+ optional :min_instances, :int32, 1
37
+ optional :max_instances, :int32, 2
38
+ optional :weight, :int32, 3
39
+ end
40
+ add_message "google.cloud.dataproc.v1beta2.CreateAutoscalingPolicyRequest" do
41
+ optional :parent, :string, 1
42
+ optional :policy, :message, 2, "google.cloud.dataproc.v1beta2.AutoscalingPolicy"
43
+ end
44
+ add_message "google.cloud.dataproc.v1beta2.GetAutoscalingPolicyRequest" do
45
+ optional :name, :string, 1
46
+ end
47
+ add_message "google.cloud.dataproc.v1beta2.UpdateAutoscalingPolicyRequest" do
48
+ optional :policy, :message, 1, "google.cloud.dataproc.v1beta2.AutoscalingPolicy"
49
+ end
50
+ add_message "google.cloud.dataproc.v1beta2.DeleteAutoscalingPolicyRequest" do
51
+ optional :name, :string, 1
52
+ end
53
+ add_message "google.cloud.dataproc.v1beta2.ListAutoscalingPoliciesRequest" do
54
+ optional :parent, :string, 1
55
+ optional :page_size, :int32, 2
56
+ optional :page_token, :string, 3
57
+ end
58
+ add_message "google.cloud.dataproc.v1beta2.ListAutoscalingPoliciesResponse" do
59
+ repeated :policies, :message, 1, "google.cloud.dataproc.v1beta2.AutoscalingPolicy"
60
+ optional :next_page_token, :string, 2
61
+ end
62
+ end
63
+
64
+ module Google
65
+ module Cloud
66
+ module Dataproc
67
+ module V1beta2
68
+ AutoscalingPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.AutoscalingPolicy").msgclass
69
+ BasicAutoscalingAlgorithm = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.BasicAutoscalingAlgorithm").msgclass
70
+ BasicYarnAutoscalingConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.BasicYarnAutoscalingConfig").msgclass
71
+ InstanceGroupAutoscalingPolicyConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.InstanceGroupAutoscalingPolicyConfig").msgclass
72
+ CreateAutoscalingPolicyRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.CreateAutoscalingPolicyRequest").msgclass
73
+ GetAutoscalingPolicyRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.GetAutoscalingPolicyRequest").msgclass
74
+ UpdateAutoscalingPolicyRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.UpdateAutoscalingPolicyRequest").msgclass
75
+ DeleteAutoscalingPolicyRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.DeleteAutoscalingPolicyRequest").msgclass
76
+ ListAutoscalingPoliciesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.ListAutoscalingPoliciesRequest").msgclass
77
+ ListAutoscalingPoliciesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.ListAutoscalingPoliciesResponse").msgclass
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,60 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/dataproc/v1beta2/autoscaling_policies.proto for package 'google.cloud.dataproc.v1beta2'
3
+ # Original file comments:
4
+ # Copyright 2019 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
+
21
+ require 'grpc'
22
+ require 'google/cloud/dataproc/v1beta2/autoscaling_policies_pb'
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dataproc
27
+ module V1beta2
28
+ module AutoscalingPolicyService
29
+ # The API interface for managing autoscaling policies in the
30
+ # Google Cloud Dataproc API.
31
+ class Service
32
+
33
+ include GRPC::GenericService
34
+
35
+ self.marshal_class_method = :encode
36
+ self.unmarshal_class_method = :decode
37
+ self.service_name = 'google.cloud.dataproc.v1beta2.AutoscalingPolicyService'
38
+
39
+ # Creates new autoscaling policy.
40
+ rpc :CreateAutoscalingPolicy, CreateAutoscalingPolicyRequest, AutoscalingPolicy
41
+ # Updates (replaces) autoscaling policy.
42
+ #
43
+ # Disabled check for update_mask, because all updates will be full
44
+ # replacements.
45
+ rpc :UpdateAutoscalingPolicy, UpdateAutoscalingPolicyRequest, AutoscalingPolicy
46
+ # Retrieves autoscaling policy.
47
+ rpc :GetAutoscalingPolicy, GetAutoscalingPolicyRequest, AutoscalingPolicy
48
+ # Lists autoscaling policies in the project.
49
+ rpc :ListAutoscalingPolicies, ListAutoscalingPoliciesRequest, ListAutoscalingPoliciesResponse
50
+ # Deletes an autoscaling policy. It is an error to delete an autoscaling
51
+ # policy that is in use by one or more clusters.
52
+ rpc :DeleteAutoscalingPolicy, DeleteAutoscalingPolicyRequest, Google::Protobuf::Empty
53
+ end
54
+
55
+ Stub = Service.rpc_stub_class
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,457 @@
1
+ # Copyright 2019 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/v1beta2/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/v1beta2/autoscaling_policies_pb"
29
+ require "google/cloud/dataproc/v1beta2/credentials"
30
+ require "google/cloud/dataproc/version"
31
+
32
+ module Google
33
+ module Cloud
34
+ module Dataproc
35
+ module V1beta2
36
+ # The API interface for managing autoscaling policies in the
37
+ # Google Cloud Dataproc API.
38
+ #
39
+ # @!attribute [r] autoscaling_policy_service_stub
40
+ # @return [Google::Cloud::Dataproc::V1beta2::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 exception_transformer [Proc]
135
+ # An optional proc that intercepts any exceptions raised during an API call to inject
136
+ # custom error handling.
137
+ def initialize \
138
+ credentials: nil,
139
+ scopes: ALL_SCOPES,
140
+ client_config: {},
141
+ timeout: DEFAULT_TIMEOUT,
142
+ metadata: nil,
143
+ exception_transformer: nil,
144
+ lib_name: nil,
145
+ lib_version: ""
146
+ # These require statements are intentionally placed here to initialize
147
+ # the gRPC module only when it's required.
148
+ # See https://github.com/googleapis/toolkit/issues/446
149
+ require "google/gax/grpc"
150
+ require "google/cloud/dataproc/v1beta2/autoscaling_policies_services_pb"
151
+
152
+ credentials ||= Google::Cloud::Dataproc::V1beta2::Credentials.default
153
+
154
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
155
+ updater_proc = Google::Cloud::Dataproc::V1beta2::Credentials.new(credentials).updater_proc
156
+ end
157
+ if credentials.is_a?(GRPC::Core::Channel)
158
+ channel = credentials
159
+ end
160
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
161
+ chan_creds = credentials
162
+ end
163
+ if credentials.is_a?(Proc)
164
+ updater_proc = credentials
165
+ end
166
+ if credentials.is_a?(Google::Auth::Credentials)
167
+ updater_proc = credentials.updater_proc
168
+ end
169
+
170
+ package_version = Google::Cloud::Dataproc::VERSION
171
+
172
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
173
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
174
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
175
+ google_api_client << " grpc/#{GRPC::VERSION}"
176
+ google_api_client.freeze
177
+
178
+ headers = { :"x-goog-api-client" => google_api_client }
179
+ headers.merge!(metadata) unless metadata.nil?
180
+ client_config_file = Pathname.new(__dir__).join(
181
+ "autoscaling_policy_service_client_config.json"
182
+ )
183
+ defaults = client_config_file.open do |f|
184
+ Google::Gax.construct_settings(
185
+ "google.cloud.dataproc.v1beta2.AutoscalingPolicyService",
186
+ JSON.parse(f.read),
187
+ client_config,
188
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
189
+ timeout,
190
+ page_descriptors: PAGE_DESCRIPTORS,
191
+ errors: Google::Gax::Grpc::API_ERRORS,
192
+ metadata: headers
193
+ )
194
+ end
195
+
196
+ # Allow overriding the service path/port in subclasses.
197
+ service_path = self.class::SERVICE_ADDRESS
198
+ port = self.class::DEFAULT_SERVICE_PORT
199
+ interceptors = self.class::GRPC_INTERCEPTORS
200
+ @autoscaling_policy_service_stub = Google::Gax::Grpc.create_stub(
201
+ service_path,
202
+ port,
203
+ chan_creds: chan_creds,
204
+ channel: channel,
205
+ updater_proc: updater_proc,
206
+ scopes: scopes,
207
+ interceptors: interceptors,
208
+ &Google::Cloud::Dataproc::V1beta2::AutoscalingPolicyService::Stub.method(:new)
209
+ )
210
+
211
+ @create_autoscaling_policy = Google::Gax.create_api_call(
212
+ @autoscaling_policy_service_stub.method(:create_autoscaling_policy),
213
+ defaults["create_autoscaling_policy"],
214
+ exception_transformer: exception_transformer,
215
+ params_extractor: proc do |request|
216
+ {'parent' => request.parent}
217
+ end
218
+ )
219
+ @update_autoscaling_policy = Google::Gax.create_api_call(
220
+ @autoscaling_policy_service_stub.method(:update_autoscaling_policy),
221
+ defaults["update_autoscaling_policy"],
222
+ exception_transformer: exception_transformer,
223
+ params_extractor: proc do |request|
224
+ {'policy.name' => request.policy.name}
225
+ end
226
+ )
227
+ @get_autoscaling_policy = Google::Gax.create_api_call(
228
+ @autoscaling_policy_service_stub.method(:get_autoscaling_policy),
229
+ defaults["get_autoscaling_policy"],
230
+ exception_transformer: exception_transformer,
231
+ params_extractor: proc do |request|
232
+ {'name' => request.name}
233
+ end
234
+ )
235
+ @list_autoscaling_policies = Google::Gax.create_api_call(
236
+ @autoscaling_policy_service_stub.method(:list_autoscaling_policies),
237
+ defaults["list_autoscaling_policies"],
238
+ exception_transformer: exception_transformer,
239
+ params_extractor: proc do |request|
240
+ {'parent' => request.parent}
241
+ end
242
+ )
243
+ @delete_autoscaling_policy = Google::Gax.create_api_call(
244
+ @autoscaling_policy_service_stub.method(:delete_autoscaling_policy),
245
+ defaults["delete_autoscaling_policy"],
246
+ exception_transformer: exception_transformer,
247
+ params_extractor: proc do |request|
248
+ {'name' => request.name}
249
+ end
250
+ )
251
+ end
252
+
253
+ # Service calls
254
+
255
+ # Creates new autoscaling policy.
256
+ #
257
+ # @param parent [String]
258
+ # Required. The "resource name" of the region, as described
259
+ # in https://cloud.google.com/apis/design/resource_names of the form
260
+ # `projects/{project_id}/regions/{region}`.
261
+ # @param policy [Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy | Hash]
262
+ # The autoscaling policy to create.
263
+ # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy`
264
+ # can also be provided.
265
+ # @param options [Google::Gax::CallOptions]
266
+ # Overrides the default settings for this call, e.g, timeout,
267
+ # retries, etc.
268
+ # @yield [result, operation] Access the result along with the RPC operation
269
+ # @yieldparam result [Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy]
270
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
271
+ # @return [Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy]
272
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
273
+ # @example
274
+ # require "google/cloud/dataproc"
275
+ #
276
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1beta2)
277
+ # formatted_parent = Google::Cloud::Dataproc::V1beta2::AutoscalingPolicyServiceClient.region_path("[PROJECT]", "[REGION]")
278
+ #
279
+ # # TODO: Initialize `policy`:
280
+ # policy = {}
281
+ # response = autoscaling_policy_client.create_autoscaling_policy(formatted_parent, policy)
282
+
283
+ def create_autoscaling_policy \
284
+ parent,
285
+ policy,
286
+ options: nil,
287
+ &block
288
+ req = {
289
+ parent: parent,
290
+ policy: policy
291
+ }.delete_if { |_, v| v.nil? }
292
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::CreateAutoscalingPolicyRequest)
293
+ @create_autoscaling_policy.call(req, options, &block)
294
+ end
295
+
296
+ # Updates (replaces) autoscaling policy.
297
+ #
298
+ # Disabled check for update_mask, because all updates will be full
299
+ # replacements.
300
+ #
301
+ # @param policy [Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy | Hash]
302
+ # Required. The updated autoscaling policy.
303
+ # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy`
304
+ # can also be provided.
305
+ # @param options [Google::Gax::CallOptions]
306
+ # Overrides the default settings for this call, e.g, timeout,
307
+ # retries, etc.
308
+ # @yield [result, operation] Access the result along with the RPC operation
309
+ # @yieldparam result [Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy]
310
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
311
+ # @return [Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy]
312
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
313
+ # @example
314
+ # require "google/cloud/dataproc"
315
+ #
316
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1beta2)
317
+ #
318
+ # # TODO: Initialize `policy`:
319
+ # policy = {}
320
+ # response = autoscaling_policy_client.update_autoscaling_policy(policy)
321
+
322
+ def update_autoscaling_policy \
323
+ policy,
324
+ options: nil,
325
+ &block
326
+ req = {
327
+ policy: policy
328
+ }.delete_if { |_, v| v.nil? }
329
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::UpdateAutoscalingPolicyRequest)
330
+ @update_autoscaling_policy.call(req, options, &block)
331
+ end
332
+
333
+ # Retrieves autoscaling policy.
334
+ #
335
+ # @param name [String]
336
+ # Required. The "resource name" of the autoscaling policy, as described
337
+ # in https://cloud.google.com/apis/design/resource_names of the form
338
+ # `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`.
339
+ # @param options [Google::Gax::CallOptions]
340
+ # Overrides the default settings for this call, e.g, timeout,
341
+ # retries, etc.
342
+ # @yield [result, operation] Access the result along with the RPC operation
343
+ # @yieldparam result [Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy]
344
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
345
+ # @return [Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy]
346
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
347
+ # @example
348
+ # require "google/cloud/dataproc"
349
+ #
350
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1beta2)
351
+ # formatted_name = Google::Cloud::Dataproc::V1beta2::AutoscalingPolicyServiceClient.autoscaling_policy_path("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
352
+ # response = autoscaling_policy_client.get_autoscaling_policy(formatted_name)
353
+
354
+ def get_autoscaling_policy \
355
+ name,
356
+ options: nil,
357
+ &block
358
+ req = {
359
+ name: name
360
+ }.delete_if { |_, v| v.nil? }
361
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::GetAutoscalingPolicyRequest)
362
+ @get_autoscaling_policy.call(req, options, &block)
363
+ end
364
+
365
+ # Lists autoscaling policies in the project.
366
+ #
367
+ # @param parent [String]
368
+ # Required. The "resource name" of the region, as described
369
+ # in https://cloud.google.com/apis/design/resource_names of the form
370
+ # `projects/{project_id}/regions/{region}`
371
+ # @param page_size [Integer]
372
+ # The maximum number of resources contained in the underlying API
373
+ # response. If page streaming is performed per-resource, this
374
+ # parameter does not affect the return value. If page streaming is
375
+ # performed per-page, this determines the maximum number of
376
+ # resources in a page.
377
+ # @param options [Google::Gax::CallOptions]
378
+ # Overrides the default settings for this call, e.g, timeout,
379
+ # retries, etc.
380
+ # @yield [result, operation] Access the result along with the RPC operation
381
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy>]
382
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
383
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy>]
384
+ # An enumerable of Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy instances.
385
+ # See Google::Gax::PagedEnumerable documentation for other
386
+ # operations such as per-page iteration or access to the response
387
+ # object.
388
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
389
+ # @example
390
+ # require "google/cloud/dataproc"
391
+ #
392
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1beta2)
393
+ # formatted_parent = Google::Cloud::Dataproc::V1beta2::AutoscalingPolicyServiceClient.region_path("[PROJECT]", "[REGION]")
394
+ #
395
+ # # Iterate over all results.
396
+ # autoscaling_policy_client.list_autoscaling_policies(formatted_parent).each do |element|
397
+ # # Process element.
398
+ # end
399
+ #
400
+ # # Or iterate over results one page at a time.
401
+ # autoscaling_policy_client.list_autoscaling_policies(formatted_parent).each_page do |page|
402
+ # # Process each page at a time.
403
+ # page.each do |element|
404
+ # # Process element.
405
+ # end
406
+ # end
407
+
408
+ def list_autoscaling_policies \
409
+ parent,
410
+ page_size: nil,
411
+ options: nil,
412
+ &block
413
+ req = {
414
+ parent: parent,
415
+ page_size: page_size
416
+ }.delete_if { |_, v| v.nil? }
417
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::ListAutoscalingPoliciesRequest)
418
+ @list_autoscaling_policies.call(req, options, &block)
419
+ end
420
+
421
+ # Deletes an autoscaling policy. It is an error to delete an autoscaling
422
+ # policy that is in use by one or more clusters.
423
+ #
424
+ # @param name [String]
425
+ # Required. The "resource name" of the autoscaling policy, as described
426
+ # in https://cloud.google.com/apis/design/resource_names of the form
427
+ # `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`.
428
+ # @param options [Google::Gax::CallOptions]
429
+ # Overrides the default settings for this call, e.g, timeout,
430
+ # retries, etc.
431
+ # @yield [result, operation] Access the result along with the RPC operation
432
+ # @yieldparam result []
433
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
434
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
435
+ # @example
436
+ # require "google/cloud/dataproc"
437
+ #
438
+ # autoscaling_policy_client = Google::Cloud::Dataproc::AutoscalingPolicyService.new(version: :v1beta2)
439
+ # formatted_name = Google::Cloud::Dataproc::V1beta2::AutoscalingPolicyServiceClient.autoscaling_policy_path("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
440
+ # autoscaling_policy_client.delete_autoscaling_policy(formatted_name)
441
+
442
+ def delete_autoscaling_policy \
443
+ name,
444
+ options: nil,
445
+ &block
446
+ req = {
447
+ name: name
448
+ }.delete_if { |_, v| v.nil? }
449
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::DeleteAutoscalingPolicyRequest)
450
+ @delete_autoscaling_policy.call(req, options, &block)
451
+ nil
452
+ end
453
+ end
454
+ end
455
+ end
456
+ end
457
+ end