google-cloud-dataflow-v1beta3 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +201 -0
- data/README.md +139 -0
- data/lib/google-cloud-dataflow-v1beta3.rb +21 -0
- data/lib/google/cloud/dataflow/v1beta3.rb +43 -0
- data/lib/google/cloud/dataflow/v1beta3/flex_templates_service.rb +48 -0
- data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/client.rb +376 -0
- data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/credentials.rb +54 -0
- data/lib/google/cloud/dataflow/v1beta3/jobs.rb +49 -0
- data/lib/google/cloud/dataflow/v1beta3/jobs/client.rb +868 -0
- data/lib/google/cloud/dataflow/v1beta3/jobs/credentials.rb +54 -0
- data/lib/google/cloud/dataflow/v1beta3/messages.rb +49 -0
- data/lib/google/cloud/dataflow/v1beta3/messages/client.rb +399 -0
- data/lib/google/cloud/dataflow/v1beta3/messages/credentials.rb +54 -0
- data/lib/google/cloud/dataflow/v1beta3/metrics.rb +49 -0
- data/lib/google/cloud/dataflow/v1beta3/metrics/client.rb +560 -0
- data/lib/google/cloud/dataflow/v1beta3/metrics/credentials.rb +54 -0
- data/lib/google/cloud/dataflow/v1beta3/snapshots.rb +48 -0
- data/lib/google/cloud/dataflow/v1beta3/snapshots/client.rb +515 -0
- data/lib/google/cloud/dataflow/v1beta3/snapshots/credentials.rb +54 -0
- data/lib/google/cloud/dataflow/v1beta3/templates_service.rb +48 -0
- data/lib/google/cloud/dataflow/v1beta3/templates_service/client.rb +543 -0
- data/lib/google/cloud/dataflow/v1beta3/templates_service/credentials.rb +54 -0
- data/lib/google/cloud/dataflow/v1beta3/version.rb +28 -0
- data/lib/google/dataflow/v1beta3/environment_pb.rb +167 -0
- data/lib/google/dataflow/v1beta3/jobs_pb.rb +292 -0
- data/lib/google/dataflow/v1beta3/jobs_services_pb.rb +83 -0
- data/lib/google/dataflow/v1beta3/messages_pb.rb +83 -0
- data/lib/google/dataflow/v1beta3/messages_services_pb.rb +52 -0
- data/lib/google/dataflow/v1beta3/metrics_pb.rb +126 -0
- data/lib/google/dataflow/v1beta3/metrics_services_pb.rb +61 -0
- data/lib/google/dataflow/v1beta3/snapshots_pb.rb +75 -0
- data/lib/google/dataflow/v1beta3/snapshots_services_pb.rb +49 -0
- data/lib/google/dataflow/v1beta3/streaming_pb.rb +105 -0
- data/lib/google/dataflow/v1beta3/templates_pb.rb +213 -0
- data/lib/google/dataflow/v1beta3/templates_services_pb.rb +65 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +65 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/dataflow/v1beta3/environment.rb +583 -0
- data/proto_docs/google/dataflow/v1beta3/jobs.rb +927 -0
- data/proto_docs/google/dataflow/v1beta3/messages.rb +226 -0
- data/proto_docs/google/dataflow/v1beta3/metrics.rb +367 -0
- data/proto_docs/google/dataflow/v1beta3/snapshots.rb +160 -0
- data/proto_docs/google/dataflow/v1beta3/streaming.rb +280 -0
- data/proto_docs/google/dataflow/v1beta3/templates.rb +669 -0
- data/proto_docs/google/protobuf/any.rb +141 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +129 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +243 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Dataflow
|
24
|
+
module V1beta3
|
25
|
+
module Snapshots
|
26
|
+
# Credentials for the Snapshots API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
30
|
+
"https://www.googleapis.com/auth/compute",
|
31
|
+
"https://www.googleapis.com/auth/compute.readonly",
|
32
|
+
"https://www.googleapis.com/auth/userinfo.email"
|
33
|
+
]
|
34
|
+
self.env_vars = [
|
35
|
+
"DATAFLOW_CREDENTIALS",
|
36
|
+
"DATAFLOW_KEYFILE",
|
37
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
38
|
+
"GOOGLE_CLOUD_KEYFILE",
|
39
|
+
"GCLOUD_KEYFILE",
|
40
|
+
"DATAFLOW_CREDENTIALS_JSON",
|
41
|
+
"DATAFLOW_KEYFILE_JSON",
|
42
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
43
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
44
|
+
"GCLOUD_KEYFILE_JSON"
|
45
|
+
]
|
46
|
+
self.paths = [
|
47
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
48
|
+
]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/dataflow/v1beta3/version"
|
24
|
+
|
25
|
+
require "google/cloud/dataflow/v1beta3/templates_service/credentials"
|
26
|
+
require "google/cloud/dataflow/v1beta3/templates_service/client"
|
27
|
+
|
28
|
+
module Google
|
29
|
+
module Cloud
|
30
|
+
module Dataflow
|
31
|
+
module V1beta3
|
32
|
+
##
|
33
|
+
# Provides a method to create Cloud Dataflow jobs from templates.
|
34
|
+
#
|
35
|
+
# To load this service and instantiate a client:
|
36
|
+
#
|
37
|
+
# require "google/cloud/dataflow/v1beta3/templates_service"
|
38
|
+
# client = ::Google::Cloud::Dataflow::V1beta3::TemplatesService::Client.new
|
39
|
+
#
|
40
|
+
module TemplatesService
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
helper_path = ::File.join __dir__, "templates_service", "helpers.rb"
|
48
|
+
require "google/cloud/dataflow/v1beta3/templates_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,543 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Dataflow
|
25
|
+
module V1beta3
|
26
|
+
module TemplatesService
|
27
|
+
##
|
28
|
+
# Client for the TemplatesService service.
|
29
|
+
#
|
30
|
+
# Provides a method to create Cloud Dataflow jobs from templates.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
# @private
|
34
|
+
attr_reader :templates_service_stub
|
35
|
+
|
36
|
+
##
|
37
|
+
# Configure the TemplatesService Client class.
|
38
|
+
#
|
39
|
+
# See {::Google::Cloud::Dataflow::V1beta3::TemplatesService::Client::Configuration}
|
40
|
+
# for a description of the configuration fields.
|
41
|
+
#
|
42
|
+
# ## Example
|
43
|
+
#
|
44
|
+
# To modify the configuration for all TemplatesService clients:
|
45
|
+
#
|
46
|
+
# ::Google::Cloud::Dataflow::V1beta3::TemplatesService::Client.configure do |config|
|
47
|
+
# config.timeout = 10.0
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# @yield [config] Configure the Client client.
|
51
|
+
# @yieldparam config [Client::Configuration]
|
52
|
+
#
|
53
|
+
# @return [Client::Configuration]
|
54
|
+
#
|
55
|
+
def self.configure
|
56
|
+
@configure ||= begin
|
57
|
+
namespace = ["Google", "Cloud", "Dataflow", "V1beta3"]
|
58
|
+
parent_config = while namespace.any?
|
59
|
+
parent_name = namespace.join "::"
|
60
|
+
parent_const = const_get parent_name
|
61
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
62
|
+
namespace.pop
|
63
|
+
end
|
64
|
+
default_config = Client::Configuration.new parent_config
|
65
|
+
|
66
|
+
default_config.timeout = 60.0
|
67
|
+
|
68
|
+
default_config
|
69
|
+
end
|
70
|
+
yield @configure if block_given?
|
71
|
+
@configure
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Configure the TemplatesService Client instance.
|
76
|
+
#
|
77
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
78
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
79
|
+
# should be made on {Client.configure}.
|
80
|
+
#
|
81
|
+
# See {::Google::Cloud::Dataflow::V1beta3::TemplatesService::Client::Configuration}
|
82
|
+
# for a description of the configuration fields.
|
83
|
+
#
|
84
|
+
# @yield [config] Configure the Client client.
|
85
|
+
# @yieldparam config [Client::Configuration]
|
86
|
+
#
|
87
|
+
# @return [Client::Configuration]
|
88
|
+
#
|
89
|
+
def configure
|
90
|
+
yield @config if block_given?
|
91
|
+
@config
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Create a new TemplatesService client object.
|
96
|
+
#
|
97
|
+
# ## Examples
|
98
|
+
#
|
99
|
+
# To create a new TemplatesService client with the default
|
100
|
+
# configuration:
|
101
|
+
#
|
102
|
+
# client = ::Google::Cloud::Dataflow::V1beta3::TemplatesService::Client.new
|
103
|
+
#
|
104
|
+
# To create a new TemplatesService client with a custom
|
105
|
+
# configuration:
|
106
|
+
#
|
107
|
+
# client = ::Google::Cloud::Dataflow::V1beta3::TemplatesService::Client.new do |config|
|
108
|
+
# config.timeout = 10.0
|
109
|
+
# end
|
110
|
+
#
|
111
|
+
# @yield [config] Configure the TemplatesService client.
|
112
|
+
# @yieldparam config [Client::Configuration]
|
113
|
+
#
|
114
|
+
def initialize
|
115
|
+
# These require statements are intentionally placed here to initialize
|
116
|
+
# the gRPC module only when it's required.
|
117
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
118
|
+
require "gapic/grpc"
|
119
|
+
require "google/dataflow/v1beta3/templates_services_pb"
|
120
|
+
|
121
|
+
# Create the configuration object
|
122
|
+
@config = Configuration.new Client.configure
|
123
|
+
|
124
|
+
# Yield the configuration if needed
|
125
|
+
yield @config if block_given?
|
126
|
+
|
127
|
+
# Create credentials
|
128
|
+
credentials = @config.credentials
|
129
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
130
|
+
# but only if the default endpoint does not have a region prefix.
|
131
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
132
|
+
@config.endpoint == Client.configure.endpoint &&
|
133
|
+
!@config.endpoint.split(".").first.include?("-")
|
134
|
+
credentials ||= Credentials.default scope: @config.scope,
|
135
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
136
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
137
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
138
|
+
end
|
139
|
+
@quota_project_id = @config.quota_project
|
140
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
141
|
+
|
142
|
+
@templates_service_stub = ::Gapic::ServiceStub.new(
|
143
|
+
::Google::Cloud::Dataflow::V1beta3::TemplatesService::Stub,
|
144
|
+
credentials: credentials,
|
145
|
+
endpoint: @config.endpoint,
|
146
|
+
channel_args: @config.channel_args,
|
147
|
+
interceptors: @config.interceptors
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Service calls
|
152
|
+
|
153
|
+
##
|
154
|
+
# Creates a Cloud Dataflow job from a template.
|
155
|
+
#
|
156
|
+
# @overload create_job_from_template(request, options = nil)
|
157
|
+
# Pass arguments to `create_job_from_template` via a request object, either of type
|
158
|
+
# {::Google::Cloud::Dataflow::V1beta3::CreateJobFromTemplateRequest} or an equivalent Hash.
|
159
|
+
#
|
160
|
+
# @param request [::Google::Cloud::Dataflow::V1beta3::CreateJobFromTemplateRequest, ::Hash]
|
161
|
+
# A request object representing the call parameters. Required. To specify no
|
162
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
163
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
164
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
165
|
+
#
|
166
|
+
# @overload create_job_from_template(project_id: nil, job_name: nil, gcs_path: nil, parameters: nil, environment: nil, location: nil)
|
167
|
+
# Pass arguments to `create_job_from_template` via keyword arguments. Note that at
|
168
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
169
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
170
|
+
#
|
171
|
+
# @param project_id [::String]
|
172
|
+
# Required. The ID of the Cloud Platform project that the job belongs to.
|
173
|
+
# @param job_name [::String]
|
174
|
+
# Required. The job name to use for the created job.
|
175
|
+
# @param gcs_path [::String]
|
176
|
+
# Required. A Cloud Storage path to the template from which to
|
177
|
+
# create the job.
|
178
|
+
# Must be a valid Cloud Storage URL, beginning with `gs://`.
|
179
|
+
# @param parameters [::Hash{::String => ::String}]
|
180
|
+
# The runtime parameters to pass to the job.
|
181
|
+
# @param environment [::Google::Cloud::Dataflow::V1beta3::RuntimeEnvironment, ::Hash]
|
182
|
+
# The runtime environment for the job.
|
183
|
+
# @param location [::String]
|
184
|
+
# The [regional endpoint]
|
185
|
+
# (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
|
186
|
+
# which to direct the request.
|
187
|
+
#
|
188
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
189
|
+
# @yieldparam response [::Google::Cloud::Dataflow::V1beta3::Job]
|
190
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
191
|
+
#
|
192
|
+
# @return [::Google::Cloud::Dataflow::V1beta3::Job]
|
193
|
+
#
|
194
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
195
|
+
#
|
196
|
+
def create_job_from_template request, options = nil
|
197
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
198
|
+
|
199
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataflow::V1beta3::CreateJobFromTemplateRequest
|
200
|
+
|
201
|
+
# Converts hash and nil to an options object
|
202
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
203
|
+
|
204
|
+
# Customize the options with defaults
|
205
|
+
metadata = @config.rpcs.create_job_from_template.metadata.to_h
|
206
|
+
|
207
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
208
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
209
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
210
|
+
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION
|
211
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
212
|
+
|
213
|
+
options.apply_defaults timeout: @config.rpcs.create_job_from_template.timeout,
|
214
|
+
metadata: metadata,
|
215
|
+
retry_policy: @config.rpcs.create_job_from_template.retry_policy
|
216
|
+
options.apply_defaults metadata: @config.metadata,
|
217
|
+
retry_policy: @config.retry_policy
|
218
|
+
|
219
|
+
@templates_service_stub.call_rpc :create_job_from_template, request, options: options do |response, operation|
|
220
|
+
yield response, operation if block_given?
|
221
|
+
return response
|
222
|
+
end
|
223
|
+
rescue ::GRPC::BadStatus => e
|
224
|
+
raise ::Google::Cloud::Error.from_error(e)
|
225
|
+
end
|
226
|
+
|
227
|
+
##
|
228
|
+
# Launch a template.
|
229
|
+
#
|
230
|
+
# @overload launch_template(request, options = nil)
|
231
|
+
# Pass arguments to `launch_template` via a request object, either of type
|
232
|
+
# {::Google::Cloud::Dataflow::V1beta3::LaunchTemplateRequest} or an equivalent Hash.
|
233
|
+
#
|
234
|
+
# @param request [::Google::Cloud::Dataflow::V1beta3::LaunchTemplateRequest, ::Hash]
|
235
|
+
# A request object representing the call parameters. Required. To specify no
|
236
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
237
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
238
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
239
|
+
#
|
240
|
+
# @overload launch_template(project_id: nil, validate_only: nil, gcs_path: nil, dynamic_template: nil, launch_parameters: nil, location: nil)
|
241
|
+
# Pass arguments to `launch_template` via keyword arguments. Note that at
|
242
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
243
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
244
|
+
#
|
245
|
+
# @param project_id [::String]
|
246
|
+
# Required. The ID of the Cloud Platform project that the job belongs to.
|
247
|
+
# @param validate_only [::Boolean]
|
248
|
+
# If true, the request is validated but not actually executed.
|
249
|
+
# Defaults to false.
|
250
|
+
# @param gcs_path [::String]
|
251
|
+
# A Cloud Storage path to the template from which to create
|
252
|
+
# the job.
|
253
|
+
# Must be valid Cloud Storage URL, beginning with 'gs://'.
|
254
|
+
# @param dynamic_template [::Google::Cloud::Dataflow::V1beta3::DynamicTemplateLaunchParams, ::Hash]
|
255
|
+
# Params for launching a dynamic template.
|
256
|
+
# @param launch_parameters [::Google::Cloud::Dataflow::V1beta3::LaunchTemplateParameters, ::Hash]
|
257
|
+
# The parameters of the template to launch. This should be part of the
|
258
|
+
# body of the POST request.
|
259
|
+
# @param location [::String]
|
260
|
+
# The [regional endpoint]
|
261
|
+
# (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
|
262
|
+
# which to direct the request.
|
263
|
+
#
|
264
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
265
|
+
# @yieldparam response [::Google::Cloud::Dataflow::V1beta3::LaunchTemplateResponse]
|
266
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
267
|
+
#
|
268
|
+
# @return [::Google::Cloud::Dataflow::V1beta3::LaunchTemplateResponse]
|
269
|
+
#
|
270
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
271
|
+
#
|
272
|
+
def launch_template request, options = nil
|
273
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
274
|
+
|
275
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataflow::V1beta3::LaunchTemplateRequest
|
276
|
+
|
277
|
+
# Converts hash and nil to an options object
|
278
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
279
|
+
|
280
|
+
# Customize the options with defaults
|
281
|
+
metadata = @config.rpcs.launch_template.metadata.to_h
|
282
|
+
|
283
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
284
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
285
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
286
|
+
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION
|
287
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
288
|
+
|
289
|
+
options.apply_defaults timeout: @config.rpcs.launch_template.timeout,
|
290
|
+
metadata: metadata,
|
291
|
+
retry_policy: @config.rpcs.launch_template.retry_policy
|
292
|
+
options.apply_defaults metadata: @config.metadata,
|
293
|
+
retry_policy: @config.retry_policy
|
294
|
+
|
295
|
+
@templates_service_stub.call_rpc :launch_template, request, options: options do |response, operation|
|
296
|
+
yield response, operation if block_given?
|
297
|
+
return response
|
298
|
+
end
|
299
|
+
rescue ::GRPC::BadStatus => e
|
300
|
+
raise ::Google::Cloud::Error.from_error(e)
|
301
|
+
end
|
302
|
+
|
303
|
+
##
|
304
|
+
# Get the template associated with a template.
|
305
|
+
#
|
306
|
+
# @overload get_template(request, options = nil)
|
307
|
+
# Pass arguments to `get_template` via a request object, either of type
|
308
|
+
# {::Google::Cloud::Dataflow::V1beta3::GetTemplateRequest} or an equivalent Hash.
|
309
|
+
#
|
310
|
+
# @param request [::Google::Cloud::Dataflow::V1beta3::GetTemplateRequest, ::Hash]
|
311
|
+
# A request object representing the call parameters. Required. To specify no
|
312
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
313
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
314
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
315
|
+
#
|
316
|
+
# @overload get_template(project_id: nil, gcs_path: nil, view: nil, location: nil)
|
317
|
+
# Pass arguments to `get_template` via keyword arguments. Note that at
|
318
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
319
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
320
|
+
#
|
321
|
+
# @param project_id [::String]
|
322
|
+
# Required. The ID of the Cloud Platform project that the job belongs to.
|
323
|
+
# @param gcs_path [::String]
|
324
|
+
# Required. A Cloud Storage path to the template from which to
|
325
|
+
# create the job.
|
326
|
+
# Must be valid Cloud Storage URL, beginning with 'gs://'.
|
327
|
+
# @param view [::Google::Cloud::Dataflow::V1beta3::GetTemplateRequest::TemplateView]
|
328
|
+
# The view to retrieve. Defaults to METADATA_ONLY.
|
329
|
+
# @param location [::String]
|
330
|
+
# The [regional endpoint]
|
331
|
+
# (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
|
332
|
+
# which to direct the request.
|
333
|
+
#
|
334
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
335
|
+
# @yieldparam response [::Google::Cloud::Dataflow::V1beta3::GetTemplateResponse]
|
336
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
337
|
+
#
|
338
|
+
# @return [::Google::Cloud::Dataflow::V1beta3::GetTemplateResponse]
|
339
|
+
#
|
340
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
341
|
+
#
|
342
|
+
def get_template request, options = nil
|
343
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
344
|
+
|
345
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataflow::V1beta3::GetTemplateRequest
|
346
|
+
|
347
|
+
# Converts hash and nil to an options object
|
348
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
349
|
+
|
350
|
+
# Customize the options with defaults
|
351
|
+
metadata = @config.rpcs.get_template.metadata.to_h
|
352
|
+
|
353
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
354
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
355
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
356
|
+
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION
|
357
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
358
|
+
|
359
|
+
options.apply_defaults timeout: @config.rpcs.get_template.timeout,
|
360
|
+
metadata: metadata,
|
361
|
+
retry_policy: @config.rpcs.get_template.retry_policy
|
362
|
+
options.apply_defaults metadata: @config.metadata,
|
363
|
+
retry_policy: @config.retry_policy
|
364
|
+
|
365
|
+
@templates_service_stub.call_rpc :get_template, request, options: options do |response, operation|
|
366
|
+
yield response, operation if block_given?
|
367
|
+
return response
|
368
|
+
end
|
369
|
+
rescue ::GRPC::BadStatus => e
|
370
|
+
raise ::Google::Cloud::Error.from_error(e)
|
371
|
+
end
|
372
|
+
|
373
|
+
##
|
374
|
+
# Configuration class for the TemplatesService API.
|
375
|
+
#
|
376
|
+
# This class represents the configuration for TemplatesService,
|
377
|
+
# providing control over timeouts, retry behavior, logging, transport
|
378
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
379
|
+
# applied individually to specific RPCs. See
|
380
|
+
# {::Google::Cloud::Dataflow::V1beta3::TemplatesService::Client::Configuration::Rpcs}
|
381
|
+
# for a list of RPCs that can be configured independently.
|
382
|
+
#
|
383
|
+
# Configuration can be applied globally to all clients, or to a single client
|
384
|
+
# on construction.
|
385
|
+
#
|
386
|
+
# # Examples
|
387
|
+
#
|
388
|
+
# To modify the global config, setting the timeout for create_job_from_template
|
389
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
390
|
+
#
|
391
|
+
# ::Google::Cloud::Dataflow::V1beta3::TemplatesService::Client.configure do |config|
|
392
|
+
# config.timeout = 10.0
|
393
|
+
# config.rpcs.create_job_from_template.timeout = 20.0
|
394
|
+
# end
|
395
|
+
#
|
396
|
+
# To apply the above configuration only to a new client:
|
397
|
+
#
|
398
|
+
# client = ::Google::Cloud::Dataflow::V1beta3::TemplatesService::Client.new do |config|
|
399
|
+
# config.timeout = 10.0
|
400
|
+
# config.rpcs.create_job_from_template.timeout = 20.0
|
401
|
+
# end
|
402
|
+
#
|
403
|
+
# @!attribute [rw] endpoint
|
404
|
+
# The hostname or hostname:port of the service endpoint.
|
405
|
+
# Defaults to `"dataflow.googleapis.com"`.
|
406
|
+
# @return [::String]
|
407
|
+
# @!attribute [rw] credentials
|
408
|
+
# Credentials to send with calls. You may provide any of the following types:
|
409
|
+
# * (`String`) The path to a service account key file in JSON format
|
410
|
+
# * (`Hash`) A service account key as a Hash
|
411
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
412
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
413
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
414
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
415
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
416
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
417
|
+
# * (`nil`) indicating no credentials
|
418
|
+
# @return [::Object]
|
419
|
+
# @!attribute [rw] scope
|
420
|
+
# The OAuth scopes
|
421
|
+
# @return [::Array<::String>]
|
422
|
+
# @!attribute [rw] lib_name
|
423
|
+
# The library name as recorded in instrumentation and logging
|
424
|
+
# @return [::String]
|
425
|
+
# @!attribute [rw] lib_version
|
426
|
+
# The library version as recorded in instrumentation and logging
|
427
|
+
# @return [::String]
|
428
|
+
# @!attribute [rw] channel_args
|
429
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
430
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
431
|
+
# @return [::Hash]
|
432
|
+
# @!attribute [rw] interceptors
|
433
|
+
# An array of interceptors that are run before calls are executed.
|
434
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
435
|
+
# @!attribute [rw] timeout
|
436
|
+
# The call timeout in seconds.
|
437
|
+
# @return [::Numeric]
|
438
|
+
# @!attribute [rw] metadata
|
439
|
+
# Additional gRPC headers to be sent with the call.
|
440
|
+
# @return [::Hash{::Symbol=>::String}]
|
441
|
+
# @!attribute [rw] retry_policy
|
442
|
+
# The retry policy. The value is a hash with the following keys:
|
443
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
444
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
445
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
446
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
447
|
+
# trigger a retry.
|
448
|
+
# @return [::Hash]
|
449
|
+
# @!attribute [rw] quota_project
|
450
|
+
# A separate project against which to charge quota.
|
451
|
+
# @return [::String]
|
452
|
+
#
|
453
|
+
class Configuration
|
454
|
+
extend ::Gapic::Config
|
455
|
+
|
456
|
+
config_attr :endpoint, "dataflow.googleapis.com", ::String
|
457
|
+
config_attr :credentials, nil do |value|
|
458
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
459
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
460
|
+
allowed.any? { |klass| klass === value }
|
461
|
+
end
|
462
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
463
|
+
config_attr :lib_name, nil, ::String, nil
|
464
|
+
config_attr :lib_version, nil, ::String, nil
|
465
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
466
|
+
config_attr :interceptors, nil, ::Array, nil
|
467
|
+
config_attr :timeout, nil, ::Numeric, nil
|
468
|
+
config_attr :metadata, nil, ::Hash, nil
|
469
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
470
|
+
config_attr :quota_project, nil, ::String, nil
|
471
|
+
|
472
|
+
# @private
|
473
|
+
def initialize parent_config = nil
|
474
|
+
@parent_config = parent_config unless parent_config.nil?
|
475
|
+
|
476
|
+
yield self if block_given?
|
477
|
+
end
|
478
|
+
|
479
|
+
##
|
480
|
+
# Configurations for individual RPCs
|
481
|
+
# @return [Rpcs]
|
482
|
+
#
|
483
|
+
def rpcs
|
484
|
+
@rpcs ||= begin
|
485
|
+
parent_rpcs = nil
|
486
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
487
|
+
Rpcs.new parent_rpcs
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
##
|
492
|
+
# Configuration RPC class for the TemplatesService API.
|
493
|
+
#
|
494
|
+
# Includes fields providing the configuration for each RPC in this service.
|
495
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
496
|
+
# the following configuration fields:
|
497
|
+
#
|
498
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
499
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
500
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
501
|
+
# include the following keys:
|
502
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
503
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
504
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
505
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
506
|
+
# trigger a retry.
|
507
|
+
#
|
508
|
+
class Rpcs
|
509
|
+
##
|
510
|
+
# RPC-specific configuration for `create_job_from_template`
|
511
|
+
# @return [::Gapic::Config::Method]
|
512
|
+
#
|
513
|
+
attr_reader :create_job_from_template
|
514
|
+
##
|
515
|
+
# RPC-specific configuration for `launch_template`
|
516
|
+
# @return [::Gapic::Config::Method]
|
517
|
+
#
|
518
|
+
attr_reader :launch_template
|
519
|
+
##
|
520
|
+
# RPC-specific configuration for `get_template`
|
521
|
+
# @return [::Gapic::Config::Method]
|
522
|
+
#
|
523
|
+
attr_reader :get_template
|
524
|
+
|
525
|
+
# @private
|
526
|
+
def initialize parent_rpcs = nil
|
527
|
+
create_job_from_template_config = parent_rpcs.create_job_from_template if parent_rpcs.respond_to? :create_job_from_template
|
528
|
+
@create_job_from_template = ::Gapic::Config::Method.new create_job_from_template_config
|
529
|
+
launch_template_config = parent_rpcs.launch_template if parent_rpcs.respond_to? :launch_template
|
530
|
+
@launch_template = ::Gapic::Config::Method.new launch_template_config
|
531
|
+
get_template_config = parent_rpcs.get_template if parent_rpcs.respond_to? :get_template
|
532
|
+
@get_template = ::Gapic::Config::Method.new get_template_config
|
533
|
+
|
534
|
+
yield self if block_given?
|
535
|
+
end
|
536
|
+
end
|
537
|
+
end
|
538
|
+
end
|
539
|
+
end
|
540
|
+
end
|
541
|
+
end
|
542
|
+
end
|
543
|
+
end
|