google-cloud-dataflow-v1beta3 0.4.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/README.md +3 -3
  4. data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/client.rb +6 -4
  5. data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/rest/client.rb +353 -0
  6. data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/rest/service_stub.rb +109 -0
  7. data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/rest.rb +51 -0
  8. data/lib/google/cloud/dataflow/v1beta3/flex_templates_service.rb +7 -1
  9. data/lib/google/cloud/dataflow/v1beta3/jobs/client.rb +14 -16
  10. data/lib/google/cloud/dataflow/v1beta3/jobs/rest/client.rb +786 -0
  11. data/lib/google/cloud/dataflow/v1beta3/jobs/rest/service_stub.rb +454 -0
  12. data/lib/google/cloud/dataflow/v1beta3/jobs/rest.rb +52 -0
  13. data/lib/google/cloud/dataflow/v1beta3/jobs.rb +7 -1
  14. data/lib/google/cloud/dataflow/v1beta3/messages/client.rb +10 -10
  15. data/lib/google/cloud/dataflow/v1beta3/messages/rest/client.rb +375 -0
  16. data/lib/google/cloud/dataflow/v1beta3/messages/rest/service_stub.rb +117 -0
  17. data/lib/google/cloud/dataflow/v1beta3/messages/rest.rb +52 -0
  18. data/lib/google/cloud/dataflow/v1beta3/messages.rb +7 -1
  19. data/lib/google/cloud/dataflow/v1beta3/metrics/client.rb +14 -16
  20. data/lib/google/cloud/dataflow/v1beta3/metrics/rest/client.rb +541 -0
  21. data/lib/google/cloud/dataflow/v1beta3/metrics/rest/service_stub.rb +240 -0
  22. data/lib/google/cloud/dataflow/v1beta3/metrics/rest.rb +52 -0
  23. data/lib/google/cloud/dataflow/v1beta3/metrics.rb +7 -1
  24. data/lib/google/cloud/dataflow/v1beta3/rest.rb +42 -0
  25. data/lib/google/cloud/dataflow/v1beta3/snapshots/client.rb +6 -4
  26. data/lib/google/cloud/dataflow/v1beta3/snapshots/rest/client.rb +496 -0
  27. data/lib/google/cloud/dataflow/v1beta3/snapshots/rest/service_stub.rb +261 -0
  28. data/lib/google/cloud/dataflow/v1beta3/snapshots/rest.rb +51 -0
  29. data/lib/google/cloud/dataflow/v1beta3/snapshots.rb +7 -1
  30. data/lib/google/cloud/dataflow/v1beta3/templates_service/client.rb +6 -4
  31. data/lib/google/cloud/dataflow/v1beta3/templates_service/rest/client.rb +524 -0
  32. data/lib/google/cloud/dataflow/v1beta3/templates_service/rest/service_stub.rb +253 -0
  33. data/lib/google/cloud/dataflow/v1beta3/templates_service/rest.rb +51 -0
  34. data/lib/google/cloud/dataflow/v1beta3/templates_service.rb +7 -1
  35. data/lib/google/cloud/dataflow/v1beta3/version.rb +1 -1
  36. data/lib/google/cloud/dataflow/v1beta3.rb +7 -2
  37. data/lib/google/dataflow/v1beta3/environment_pb.rb +26 -132
  38. data/lib/google/dataflow/v1beta3/jobs_pb.rb +28 -234
  39. data/lib/google/dataflow/v1beta3/messages_pb.rb +26 -54
  40. data/lib/google/dataflow/v1beta3/metrics_pb.rb +26 -91
  41. data/lib/google/dataflow/v1beta3/snapshots_pb.rb +26 -46
  42. data/lib/google/dataflow/v1beta3/streaming_pb.rb +24 -74
  43. data/lib/google/dataflow/v1beta3/templates_pb.rb +26 -173
  44. data/proto_docs/google/api/client.rb +381 -0
  45. data/proto_docs/google/api/launch_stage.rb +71 -0
  46. data/proto_docs/google/protobuf/any.rb +7 -4
  47. data/proto_docs/google/protobuf/struct.rb +1 -1
  48. data/proto_docs/google/protobuf/timestamp.rb +1 -3
  49. data/proto_docs/google/rpc/status.rb +4 -2
  50. metadata +29 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '048e432d7f5927424923a12bf33c9cb0bbe1f21c89d36596f529b9f777eb65d7'
4
- data.tar.gz: c91f26bbfaeba8454c6667aa7066f95f5285a200ae74d5bff617d7f96544af93
3
+ metadata.gz: 4cc986065db087923e3e63ab135d9aafb0410a95cf24bd3de248caafdcb5f68a
4
+ data.tar.gz: 7f98f4696ad66cf4ffa17c108a6b578145c4aa8c81cd8b452068d9039098f834
5
5
  SHA512:
6
- metadata.gz: 235f015326621059e1bf9f010d08409ba077c4e058bfbb6fb544330b2f5fbbc11d9c3d13661a3629a8e5174f8e27e41a202482e898f90bcbb6ce11e68f9d75bc
7
- data.tar.gz: f2f6d686d79807ee5c6b4c0ace49b30fc419d4126c34fc2c0346c450cb2cb7e91365506e3ed652255b6faad23cdcc4b7ea891a28518ad94555c75927331eaa83
6
+ metadata.gz: bd80230ec50b7ee0e9e9aaa413a12bcf7f54aef7dc3832e1bd844b7d1661acb24c3c749bf60d62cb218ec030b16bc1a843d26989b4c8ec4b766cf008dde892e2
7
+ data.tar.gz: e716cb7f094623a118fea2d5f25f01a60b8c43a315f773033c32b070822c6b8e7ffc62d35d98220e091a6e8d47d9ca168664d78167e7647afcc1ba716c1c91c9
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby Client for the Dataflow V1beta3 API
2
2
 
3
- API Client library for the Dataflow V1beta3 API
3
+ Manages Google Cloud Dataflow projects on Google Cloud Platform.
4
4
 
5
5
  Dataflow is a managed service for executing a wide variety of data processing patterns.
6
6
 
@@ -46,8 +46,8 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
+ or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
53
 
@@ -121,7 +121,7 @@ module Google
121
121
  credentials = @config.credentials
122
122
  # Use self-signed JWT if the endpoint is unchanged from default,
123
123
  # but only if the default endpoint does not have a region prefix.
124
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
124
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
125
125
  !@config.endpoint.split(".").first.include?("-")
126
126
  credentials ||= Credentials.default scope: @config.scope,
127
127
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -277,9 +277,9 @@ module Google
277
277
  # * (`String`) The path to a service account key file in JSON format
278
278
  # * (`Hash`) A service account key as a Hash
279
279
  # * (`Google::Auth::Credentials`) A googleauth credentials object
280
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
280
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
281
281
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
282
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
282
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
283
283
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
284
284
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
285
285
  # * (`nil`) indicating no credentials
@@ -321,7 +321,9 @@ module Google
321
321
  class Configuration
322
322
  extend ::Gapic::Config
323
323
 
324
- config_attr :endpoint, "dataflow.googleapis.com", ::String
324
+ DEFAULT_ENDPOINT = "dataflow.googleapis.com"
325
+
326
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
325
327
  config_attr :credentials, nil do |value|
326
328
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
327
329
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -0,0 +1,353 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/dataflow/v1beta3/templates_pb"
21
+ require "google/cloud/dataflow/v1beta3/flex_templates_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Dataflow
26
+ module V1beta3
27
+ module FlexTemplatesService
28
+ module Rest
29
+ ##
30
+ # REST client for the FlexTemplatesService service.
31
+ #
32
+ # Provides a service for Flex templates. This feature is not ready yet.
33
+ #
34
+ class Client
35
+ # @private
36
+ attr_reader :flex_templates_service_stub
37
+
38
+ ##
39
+ # Configure the FlexTemplatesService Client class.
40
+ #
41
+ # See {::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all FlexTemplatesService clients
47
+ # ::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "Dataflow", "V1beta3"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config
68
+ end
69
+ yield @configure if block_given?
70
+ @configure
71
+ end
72
+
73
+ ##
74
+ # Configure the FlexTemplatesService Client instance.
75
+ #
76
+ # The configuration is set to the derived mode, meaning that values can be changed,
77
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
78
+ # should be made on {Client.configure}.
79
+ #
80
+ # See {::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client::Configuration}
81
+ # for a description of the configuration fields.
82
+ #
83
+ # @yield [config] Configure the Client client.
84
+ # @yieldparam config [Client::Configuration]
85
+ #
86
+ # @return [Client::Configuration]
87
+ #
88
+ def configure
89
+ yield @config if block_given?
90
+ @config
91
+ end
92
+
93
+ ##
94
+ # Create a new FlexTemplatesService REST client object.
95
+ #
96
+ # @example
97
+ #
98
+ # # Create a client using the default configuration
99
+ # client = ::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client.new
100
+ #
101
+ # # Create a client using a custom configuration
102
+ # client = ::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client.new do |config|
103
+ # config.timeout = 10.0
104
+ # end
105
+ #
106
+ # @yield [config] Configure the FlexTemplatesService client.
107
+ # @yieldparam config [Client::Configuration]
108
+ #
109
+ def initialize
110
+ # Create the configuration object
111
+ @config = Configuration.new Client.configure
112
+
113
+ # Yield the configuration if needed
114
+ yield @config if block_given?
115
+
116
+ # Create credentials
117
+ credentials = @config.credentials
118
+ # Use self-signed JWT if the endpoint is unchanged from default,
119
+ # but only if the default endpoint does not have a region prefix.
120
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
121
+ !@config.endpoint.split(".").first.include?("-")
122
+ credentials ||= Credentials.default scope: @config.scope,
123
+ enable_self_signed_jwt: enable_self_signed_jwt
124
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
125
+ credentials = Credentials.new credentials, scope: @config.scope
126
+ end
127
+
128
+ @quota_project_id = @config.quota_project
129
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
130
+
131
+ @flex_templates_service_stub = ::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
132
+ end
133
+
134
+ # Service calls
135
+
136
+ ##
137
+ # Launch a job with a FlexTemplate.
138
+ #
139
+ # @overload launch_flex_template(request, options = nil)
140
+ # Pass arguments to `launch_flex_template` via a request object, either of type
141
+ # {::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateRequest} or an equivalent Hash.
142
+ #
143
+ # @param request [::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateRequest, ::Hash]
144
+ # A request object representing the call parameters. Required. To specify no
145
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
146
+ # @param options [::Gapic::CallOptions, ::Hash]
147
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
148
+ #
149
+ # @overload launch_flex_template(project_id: nil, launch_parameter: nil, location: nil, validate_only: nil)
150
+ # Pass arguments to `launch_flex_template` via keyword arguments. Note that at
151
+ # least one keyword argument is required. To specify no parameters, or to keep all
152
+ # the default parameter values, pass an empty Hash as a request object (see above).
153
+ #
154
+ # @param project_id [::String]
155
+ # Required. The ID of the Cloud Platform project that the job belongs to.
156
+ # @param launch_parameter [::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateParameter, ::Hash]
157
+ # Required. Parameter to launch a job form Flex Template.
158
+ # @param location [::String]
159
+ # Required. The [regional endpoint]
160
+ # (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
161
+ # which to direct the request. E.g., us-central1, us-west1.
162
+ # @param validate_only [::Boolean]
163
+ # If true, the request is validated but not actually executed.
164
+ # Defaults to false.
165
+ # @yield [result, operation] Access the result along with the TransportOperation object
166
+ # @yieldparam result [::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateResponse]
167
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
168
+ #
169
+ # @return [::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateResponse]
170
+ #
171
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
172
+ def launch_flex_template request, options = nil
173
+ raise ::ArgumentError, "request must be provided" if request.nil?
174
+
175
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateRequest
176
+
177
+ # Converts hash and nil to an options object
178
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
179
+
180
+ # Customize the options with defaults
181
+ call_metadata = @config.rpcs.launch_flex_template.metadata.to_h
182
+
183
+ # Set x-goog-api-client and x-goog-user-project headers
184
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
185
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
186
+ gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
187
+ transports_version_send: [:rest]
188
+
189
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
190
+
191
+ options.apply_defaults timeout: @config.rpcs.launch_flex_template.timeout,
192
+ metadata: call_metadata,
193
+ retry_policy: @config.rpcs.launch_flex_template.retry_policy
194
+
195
+ options.apply_defaults timeout: @config.timeout,
196
+ metadata: @config.metadata,
197
+ retry_policy: @config.retry_policy
198
+
199
+ @flex_templates_service_stub.launch_flex_template request, options do |result, operation|
200
+ yield result, operation if block_given?
201
+ return result
202
+ end
203
+ rescue ::Gapic::Rest::Error => e
204
+ raise ::Google::Cloud::Error.from_error(e)
205
+ end
206
+
207
+ ##
208
+ # Configuration class for the FlexTemplatesService REST API.
209
+ #
210
+ # This class represents the configuration for FlexTemplatesService REST,
211
+ # providing control over timeouts, retry behavior, logging, transport
212
+ # parameters, and other low-level controls. Certain parameters can also be
213
+ # applied individually to specific RPCs. See
214
+ # {::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client::Configuration::Rpcs}
215
+ # for a list of RPCs that can be configured independently.
216
+ #
217
+ # Configuration can be applied globally to all clients, or to a single client
218
+ # on construction.
219
+ #
220
+ # @example
221
+ #
222
+ # # Modify the global config, setting the timeout for
223
+ # # launch_flex_template to 20 seconds,
224
+ # # and all remaining timeouts to 10 seconds.
225
+ # ::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client.configure do |config|
226
+ # config.timeout = 10.0
227
+ # config.rpcs.launch_flex_template.timeout = 20.0
228
+ # end
229
+ #
230
+ # # Apply the above configuration only to a new client.
231
+ # client = ::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client.new do |config|
232
+ # config.timeout = 10.0
233
+ # config.rpcs.launch_flex_template.timeout = 20.0
234
+ # end
235
+ #
236
+ # @!attribute [rw] endpoint
237
+ # The hostname or hostname:port of the service endpoint.
238
+ # Defaults to `"dataflow.googleapis.com"`.
239
+ # @return [::String]
240
+ # @!attribute [rw] credentials
241
+ # Credentials to send with calls. You may provide any of the following types:
242
+ # * (`String`) The path to a service account key file in JSON format
243
+ # * (`Hash`) A service account key as a Hash
244
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
245
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
246
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
247
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
248
+ # * (`nil`) indicating no credentials
249
+ # @return [::Object]
250
+ # @!attribute [rw] scope
251
+ # The OAuth scopes
252
+ # @return [::Array<::String>]
253
+ # @!attribute [rw] lib_name
254
+ # The library name as recorded in instrumentation and logging
255
+ # @return [::String]
256
+ # @!attribute [rw] lib_version
257
+ # The library version as recorded in instrumentation and logging
258
+ # @return [::String]
259
+ # @!attribute [rw] timeout
260
+ # The call timeout in seconds.
261
+ # @return [::Numeric]
262
+ # @!attribute [rw] metadata
263
+ # Additional headers to be sent with the call.
264
+ # @return [::Hash{::Symbol=>::String}]
265
+ # @!attribute [rw] retry_policy
266
+ # The retry policy. The value is a hash with the following keys:
267
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
268
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
269
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
270
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
271
+ # trigger a retry.
272
+ # @return [::Hash]
273
+ # @!attribute [rw] quota_project
274
+ # A separate project against which to charge quota.
275
+ # @return [::String]
276
+ #
277
+ class Configuration
278
+ extend ::Gapic::Config
279
+
280
+ DEFAULT_ENDPOINT = "dataflow.googleapis.com"
281
+
282
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
283
+ config_attr :credentials, nil do |value|
284
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
285
+ allowed.any? { |klass| klass === value }
286
+ end
287
+ config_attr :scope, nil, ::String, ::Array, nil
288
+ config_attr :lib_name, nil, ::String, nil
289
+ config_attr :lib_version, nil, ::String, nil
290
+ config_attr :timeout, nil, ::Numeric, nil
291
+ config_attr :metadata, nil, ::Hash, nil
292
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
293
+ config_attr :quota_project, nil, ::String, nil
294
+
295
+ # @private
296
+ def initialize parent_config = nil
297
+ @parent_config = parent_config unless parent_config.nil?
298
+
299
+ yield self if block_given?
300
+ end
301
+
302
+ ##
303
+ # Configurations for individual RPCs
304
+ # @return [Rpcs]
305
+ #
306
+ def rpcs
307
+ @rpcs ||= begin
308
+ parent_rpcs = nil
309
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
310
+ Rpcs.new parent_rpcs
311
+ end
312
+ end
313
+
314
+ ##
315
+ # Configuration RPC class for the FlexTemplatesService API.
316
+ #
317
+ # Includes fields providing the configuration for each RPC in this service.
318
+ # Each configuration object is of type `Gapic::Config::Method` and includes
319
+ # the following configuration fields:
320
+ #
321
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
322
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
323
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
324
+ # include the following keys:
325
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
326
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
327
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
328
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
329
+ # trigger a retry.
330
+ #
331
+ class Rpcs
332
+ ##
333
+ # RPC-specific configuration for `launch_flex_template`
334
+ # @return [::Gapic::Config::Method]
335
+ #
336
+ attr_reader :launch_flex_template
337
+
338
+ # @private
339
+ def initialize parent_rpcs = nil
340
+ launch_flex_template_config = parent_rpcs.launch_flex_template if parent_rpcs.respond_to? :launch_flex_template
341
+ @launch_flex_template = ::Gapic::Config::Method.new launch_flex_template_config
342
+
343
+ yield self if block_given?
344
+ end
345
+ end
346
+ end
347
+ end
348
+ end
349
+ end
350
+ end
351
+ end
352
+ end
353
+ end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/dataflow/v1beta3/templates_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Dataflow
24
+ module V1beta3
25
+ module FlexTemplatesService
26
+ module Rest
27
+ ##
28
+ # REST service stub for the FlexTemplatesService service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ def initialize endpoint:, credentials:
34
+ # These require statements are intentionally placed here to initialize
35
+ # the REST modules only when it's required.
36
+ require "gapic/rest"
37
+
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
39
+ numeric_enums: true,
40
+ raise_faraday_errors: false
41
+ end
42
+
43
+ ##
44
+ # Baseline implementation for the launch_flex_template REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateRequest]
47
+ # A request object representing the call parameters. Required.
48
+ # @param options [::Gapic::CallOptions]
49
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
50
+ #
51
+ # @yield [result, operation] Access the result along with the TransportOperation object
52
+ # @yieldparam result [::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateResponse]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateResponse]
56
+ # A result object deserialized from the server's reply
57
+ def launch_flex_template request_pb, options = nil
58
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
59
+
60
+ verb, uri, query_string_params, body = ServiceStub.transcode_launch_flex_template_request request_pb
61
+ query_string_params = if query_string_params.any?
62
+ query_string_params.to_h { |p| p.split "=", 2 }
63
+ else
64
+ {}
65
+ end
66
+
67
+ response = @client_stub.make_http_request(
68
+ verb,
69
+ uri: uri,
70
+ body: body || "",
71
+ params: query_string_params,
72
+ options: options
73
+ )
74
+ operation = ::Gapic::Rest::TransportOperation.new response
75
+ result = ::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateResponse.decode_json response.body, ignore_unknown_fields: true
76
+
77
+ yield result, operation if block_given?
78
+ result
79
+ end
80
+
81
+ ##
82
+ # @private
83
+ #
84
+ # GRPC transcoding helper method for the launch_flex_template REST call
85
+ #
86
+ # @param request_pb [::Google::Cloud::Dataflow::V1beta3::LaunchFlexTemplateRequest]
87
+ # A request object representing the call parameters. Required.
88
+ # @return [Array(String, [String, nil], Hash{String => String})]
89
+ # Uri, Body, Query string parameters
90
+ def self.transcode_launch_flex_template_request request_pb
91
+ transcoder = Gapic::Rest::GrpcTranscoder.new
92
+ .with_bindings(
93
+ uri_method: :post,
94
+ uri_template: "/v1b3/projects/{project_id}/locations/{location}/flexTemplates:launch",
95
+ body: "*",
96
+ matches: [
97
+ ["project_id", %r{^[^/]+/?$}, false],
98
+ ["location", %r{^[^/]+/?$}, false]
99
+ ]
100
+ )
101
+ transcoder.transcode request_pb
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/dataflow/v1beta3/version"
24
+
25
+ require "google/cloud/dataflow/v1beta3/flex_templates_service/credentials"
26
+ require "google/cloud/dataflow/v1beta3/flex_templates_service/rest/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module Dataflow
31
+ module V1beta3
32
+ ##
33
+ # Provides a service for Flex templates. This feature is not ready yet.
34
+ #
35
+ # To load this service and instantiate a REST client:
36
+ #
37
+ # require "google/cloud/dataflow/v1beta3/flex_templates_service/rest"
38
+ # client = ::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client.new
39
+ #
40
+ module FlexTemplatesService
41
+ # Client for the REST transport
42
+ module Rest
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
51
+ require "google/cloud/dataflow/v1beta3/flex_templates_service/rest/helpers" if ::File.file? helper_path
@@ -24,6 +24,7 @@ require "google/cloud/dataflow/v1beta3/version"
24
24
 
25
25
  require "google/cloud/dataflow/v1beta3/flex_templates_service/credentials"
26
26
  require "google/cloud/dataflow/v1beta3/flex_templates_service/client"
27
+ require "google/cloud/dataflow/v1beta3/flex_templates_service/rest"
27
28
 
28
29
  module Google
29
30
  module Cloud
@@ -32,11 +33,16 @@ module Google
32
33
  ##
33
34
  # Provides a service for Flex templates. This feature is not ready yet.
34
35
  #
35
- # To load this service and instantiate a client:
36
+ # @example Load this service and instantiate a gRPC client
36
37
  #
37
38
  # require "google/cloud/dataflow/v1beta3/flex_templates_service"
38
39
  # client = ::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Client.new
39
40
  #
41
+ # @example Load this service and instantiate a REST client
42
+ #
43
+ # require "google/cloud/dataflow/v1beta3/flex_templates_service/rest"
44
+ # client = ::Google::Cloud::Dataflow::V1beta3::FlexTemplatesService::Rest::Client.new
45
+ #
40
46
  module FlexTemplatesService
41
47
  end
42
48
  end