google-cloud-run-v2 0.16.1 → 0.17.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 +4 -4
- data/AUTHENTICATION.md +4 -4
- data/README.md +3 -3
- data/lib/google/cloud/run/v2/build_pb.rb +53 -0
- data/lib/google/cloud/run/v2/build_services_pb.rb +45 -0
- data/lib/google/cloud/run/v2/builds/client.rb +463 -0
- data/lib/google/cloud/run/v2/builds/credentials.rb +47 -0
- data/lib/google/cloud/run/v2/builds/paths.rb +52 -0
- data/lib/google/cloud/run/v2/builds/rest/client.rb +430 -0
- data/lib/google/cloud/run/v2/builds/rest/service_stub.rb +129 -0
- data/lib/google/cloud/run/v2/builds/rest.rb +52 -0
- data/lib/google/cloud/run/v2/builds.rb +55 -0
- data/lib/google/cloud/run/v2/job_pb.rb +2 -1
- data/lib/google/cloud/run/v2/jobs/paths.rb +33 -0
- data/lib/google/cloud/run/v2/rest.rb +2 -1
- data/lib/google/cloud/run/v2/revision_pb.rb +1 -1
- data/lib/google/cloud/run/v2/revision_template_pb.rb +1 -1
- data/lib/google/cloud/run/v2/service_pb.rb +1 -1
- data/lib/google/cloud/run/v2/services/paths.rb +52 -0
- data/lib/google/cloud/run/v2/vendor_settings_pb.rb +4 -1
- data/lib/google/cloud/run/v2/version.rb +1 -1
- data/lib/google/cloud/run/v2.rb +3 -2
- data/proto_docs/google/cloud/run/v2/build.rb +149 -0
- data/proto_docs/google/cloud/run/v2/revision.rb +6 -0
- data/proto_docs/google/cloud/run/v2/revision_template.rb +8 -1
- data/proto_docs/google/cloud/run/v2/service.rb +14 -7
- data/proto_docs/google/cloud/run/v2/vendor_settings.rb +47 -5
- metadata +13 -3
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Run
|
23
|
+
module V2
|
24
|
+
module Builds
|
25
|
+
# Path helper methods for the Builds API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified WorkerPool resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/locations/{location}/workerPools/{worker_pool}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param location [String]
|
36
|
+
# @param worker_pool [String]
|
37
|
+
#
|
38
|
+
# @return [::String]
|
39
|
+
def worker_pool_path project:, location:, worker_pool:
|
40
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
41
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
42
|
+
|
43
|
+
"projects/#{project}/locations/#{location}/workerPools/#{worker_pool}"
|
44
|
+
end
|
45
|
+
|
46
|
+
extend self
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,430 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/cloud/run/v2/build_pb"
|
21
|
+
require "google/cloud/run/v2/builds/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module Run
|
27
|
+
module V2
|
28
|
+
module Builds
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the Builds service.
|
32
|
+
#
|
33
|
+
# Cloud Run Build Control Plane API
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
# @private
|
37
|
+
API_VERSION = ""
|
38
|
+
|
39
|
+
# @private
|
40
|
+
DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
|
41
|
+
|
42
|
+
include Paths
|
43
|
+
|
44
|
+
# @private
|
45
|
+
attr_reader :builds_stub
|
46
|
+
|
47
|
+
##
|
48
|
+
# Configure the Builds Client class.
|
49
|
+
#
|
50
|
+
# See {::Google::Cloud::Run::V2::Builds::Rest::Client::Configuration}
|
51
|
+
# for a description of the configuration fields.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
#
|
55
|
+
# # Modify the configuration for all Builds clients
|
56
|
+
# ::Google::Cloud::Run::V2::Builds::Rest::Client.configure do |config|
|
57
|
+
# config.timeout = 10.0
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# @yield [config] Configure the Client client.
|
61
|
+
# @yieldparam config [Client::Configuration]
|
62
|
+
#
|
63
|
+
# @return [Client::Configuration]
|
64
|
+
#
|
65
|
+
def self.configure
|
66
|
+
@configure ||= begin
|
67
|
+
namespace = ["Google", "Cloud", "Run", "V2"]
|
68
|
+
parent_config = while namespace.any?
|
69
|
+
parent_name = namespace.join "::"
|
70
|
+
parent_const = const_get parent_name
|
71
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
72
|
+
namespace.pop
|
73
|
+
end
|
74
|
+
default_config = Client::Configuration.new parent_config
|
75
|
+
|
76
|
+
default_config
|
77
|
+
end
|
78
|
+
yield @configure if block_given?
|
79
|
+
@configure
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Configure the Builds Client instance.
|
84
|
+
#
|
85
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
86
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
87
|
+
# should be made on {Client.configure}.
|
88
|
+
#
|
89
|
+
# See {::Google::Cloud::Run::V2::Builds::Rest::Client::Configuration}
|
90
|
+
# for a description of the configuration fields.
|
91
|
+
#
|
92
|
+
# @yield [config] Configure the Client client.
|
93
|
+
# @yieldparam config [Client::Configuration]
|
94
|
+
#
|
95
|
+
# @return [Client::Configuration]
|
96
|
+
#
|
97
|
+
def configure
|
98
|
+
yield @config if block_given?
|
99
|
+
@config
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# The effective universe domain
|
104
|
+
#
|
105
|
+
# @return [String]
|
106
|
+
#
|
107
|
+
def universe_domain
|
108
|
+
@builds_stub.universe_domain
|
109
|
+
end
|
110
|
+
|
111
|
+
##
|
112
|
+
# Create a new Builds REST client object.
|
113
|
+
#
|
114
|
+
# @example
|
115
|
+
#
|
116
|
+
# # Create a client using the default configuration
|
117
|
+
# client = ::Google::Cloud::Run::V2::Builds::Rest::Client.new
|
118
|
+
#
|
119
|
+
# # Create a client using a custom configuration
|
120
|
+
# client = ::Google::Cloud::Run::V2::Builds::Rest::Client.new do |config|
|
121
|
+
# config.timeout = 10.0
|
122
|
+
# end
|
123
|
+
#
|
124
|
+
# @yield [config] Configure the Builds client.
|
125
|
+
# @yieldparam config [Client::Configuration]
|
126
|
+
#
|
127
|
+
def initialize
|
128
|
+
# Create the configuration object
|
129
|
+
@config = Configuration.new Client.configure
|
130
|
+
|
131
|
+
# Yield the configuration if needed
|
132
|
+
yield @config if block_given?
|
133
|
+
|
134
|
+
# Create credentials
|
135
|
+
credentials = @config.credentials
|
136
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
137
|
+
# but only if the default endpoint does not have a region prefix.
|
138
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
139
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
140
|
+
!@config.endpoint.split(".").first.include?("-"))
|
141
|
+
credentials ||= Credentials.default scope: @config.scope,
|
142
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
143
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
144
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
145
|
+
end
|
146
|
+
|
147
|
+
@quota_project_id = @config.quota_project
|
148
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
149
|
+
|
150
|
+
@builds_stub = ::Google::Cloud::Run::V2::Builds::Rest::ServiceStub.new(
|
151
|
+
endpoint: @config.endpoint,
|
152
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
153
|
+
universe_domain: @config.universe_domain,
|
154
|
+
credentials: credentials
|
155
|
+
)
|
156
|
+
|
157
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
158
|
+
config.credentials = credentials
|
159
|
+
config.quota_project = @quota_project_id
|
160
|
+
config.endpoint = @builds_stub.endpoint
|
161
|
+
config.universe_domain = @builds_stub.universe_domain
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
##
|
166
|
+
# Get the associated client for mix-in of the Locations.
|
167
|
+
#
|
168
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
169
|
+
#
|
170
|
+
attr_reader :location_client
|
171
|
+
|
172
|
+
# Service calls
|
173
|
+
|
174
|
+
##
|
175
|
+
# Submits a build in a given project.
|
176
|
+
#
|
177
|
+
# @overload submit_build(request, options = nil)
|
178
|
+
# Pass arguments to `submit_build` via a request object, either of type
|
179
|
+
# {::Google::Cloud::Run::V2::SubmitBuildRequest} or an equivalent Hash.
|
180
|
+
#
|
181
|
+
# @param request [::Google::Cloud::Run::V2::SubmitBuildRequest, ::Hash]
|
182
|
+
# A request object representing the call parameters. Required. To specify no
|
183
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
184
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
185
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
186
|
+
#
|
187
|
+
# @overload submit_build(parent: nil, storage_source: nil, image_uri: nil, buildpack_build: nil, docker_build: nil, service_account: nil, worker_pool: nil, tags: nil)
|
188
|
+
# Pass arguments to `submit_build` via keyword arguments. Note that at
|
189
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
190
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
191
|
+
#
|
192
|
+
# @param parent [::String]
|
193
|
+
# Required. The project and location to build in. Location must be a region,
|
194
|
+
# e.g., 'us-central1' or 'global' if the global builder is to be used.
|
195
|
+
# Format:
|
196
|
+
# `projects/{project}/locations/{location}`
|
197
|
+
# @param storage_source [::Google::Cloud::Run::V2::StorageSource, ::Hash]
|
198
|
+
# Required. Source for the build.
|
199
|
+
# @param image_uri [::String]
|
200
|
+
# Required. Artifact Registry URI to store the built image.
|
201
|
+
# @param buildpack_build [::Google::Cloud::Run::V2::SubmitBuildRequest::BuildpacksBuild, ::Hash]
|
202
|
+
# Build the source using Buildpacks.
|
203
|
+
# @param docker_build [::Google::Cloud::Run::V2::SubmitBuildRequest::DockerBuild, ::Hash]
|
204
|
+
# Build the source using Docker. This means the source has a Dockerfile.
|
205
|
+
# @param service_account [::String]
|
206
|
+
# Optional. The service account to use for the build. If not set, the default
|
207
|
+
# Cloud Build service account for the project will be used.
|
208
|
+
# @param worker_pool [::String]
|
209
|
+
# Optional. Name of the Cloud Build Custom Worker Pool that should be used to
|
210
|
+
# build the function. The format of this field is
|
211
|
+
# `projects/{project}/locations/{region}/workerPools/{workerPool}` where
|
212
|
+
# `{project}` and `{region}` are the project id and region respectively where
|
213
|
+
# the worker pool is defined and `{workerPool}` is the short name of the
|
214
|
+
# worker pool.
|
215
|
+
# @param tags [::Array<::String>]
|
216
|
+
# Optional. Additional tags to annotate the build.
|
217
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
218
|
+
# @yieldparam result [::Google::Cloud::Run::V2::SubmitBuildResponse]
|
219
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
220
|
+
#
|
221
|
+
# @return [::Google::Cloud::Run::V2::SubmitBuildResponse]
|
222
|
+
#
|
223
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
224
|
+
#
|
225
|
+
# @example Basic example
|
226
|
+
# require "google/cloud/run/v2"
|
227
|
+
#
|
228
|
+
# # Create a client object. The client can be reused for multiple calls.
|
229
|
+
# client = Google::Cloud::Run::V2::Builds::Rest::Client.new
|
230
|
+
#
|
231
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
232
|
+
# request = Google::Cloud::Run::V2::SubmitBuildRequest.new
|
233
|
+
#
|
234
|
+
# # Call the submit_build method.
|
235
|
+
# result = client.submit_build request
|
236
|
+
#
|
237
|
+
# # The returned object is of type Google::Cloud::Run::V2::SubmitBuildResponse.
|
238
|
+
# p result
|
239
|
+
#
|
240
|
+
def submit_build request, options = nil
|
241
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
242
|
+
|
243
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::SubmitBuildRequest
|
244
|
+
|
245
|
+
# Converts hash and nil to an options object
|
246
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
247
|
+
|
248
|
+
# Customize the options with defaults
|
249
|
+
call_metadata = @config.rpcs.submit_build.metadata.to_h
|
250
|
+
|
251
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
252
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
253
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
254
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
255
|
+
transports_version_send: [:rest]
|
256
|
+
|
257
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
258
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
259
|
+
|
260
|
+
options.apply_defaults timeout: @config.rpcs.submit_build.timeout,
|
261
|
+
metadata: call_metadata,
|
262
|
+
retry_policy: @config.rpcs.submit_build.retry_policy
|
263
|
+
|
264
|
+
options.apply_defaults timeout: @config.timeout,
|
265
|
+
metadata: @config.metadata,
|
266
|
+
retry_policy: @config.retry_policy
|
267
|
+
|
268
|
+
@builds_stub.submit_build request, options do |result, operation|
|
269
|
+
yield result, operation if block_given?
|
270
|
+
return result
|
271
|
+
end
|
272
|
+
rescue ::Gapic::Rest::Error => e
|
273
|
+
raise ::Google::Cloud::Error.from_error(e)
|
274
|
+
end
|
275
|
+
|
276
|
+
##
|
277
|
+
# Configuration class for the Builds REST API.
|
278
|
+
#
|
279
|
+
# This class represents the configuration for Builds REST,
|
280
|
+
# providing control over timeouts, retry behavior, logging, transport
|
281
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
282
|
+
# applied individually to specific RPCs. See
|
283
|
+
# {::Google::Cloud::Run::V2::Builds::Rest::Client::Configuration::Rpcs}
|
284
|
+
# for a list of RPCs that can be configured independently.
|
285
|
+
#
|
286
|
+
# Configuration can be applied globally to all clients, or to a single client
|
287
|
+
# on construction.
|
288
|
+
#
|
289
|
+
# @example
|
290
|
+
#
|
291
|
+
# # Modify the global config, setting the timeout for
|
292
|
+
# # submit_build to 20 seconds,
|
293
|
+
# # and all remaining timeouts to 10 seconds.
|
294
|
+
# ::Google::Cloud::Run::V2::Builds::Rest::Client.configure do |config|
|
295
|
+
# config.timeout = 10.0
|
296
|
+
# config.rpcs.submit_build.timeout = 20.0
|
297
|
+
# end
|
298
|
+
#
|
299
|
+
# # Apply the above configuration only to a new client.
|
300
|
+
# client = ::Google::Cloud::Run::V2::Builds::Rest::Client.new do |config|
|
301
|
+
# config.timeout = 10.0
|
302
|
+
# config.rpcs.submit_build.timeout = 20.0
|
303
|
+
# end
|
304
|
+
#
|
305
|
+
# @!attribute [rw] endpoint
|
306
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
307
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
308
|
+
# @return [::String,nil]
|
309
|
+
# @!attribute [rw] credentials
|
310
|
+
# Credentials to send with calls. You may provide any of the following types:
|
311
|
+
# * (`String`) The path to a service account key file in JSON format
|
312
|
+
# * (`Hash`) A service account key as a Hash
|
313
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
314
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
315
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
316
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
317
|
+
# * (`nil`) indicating no credentials
|
318
|
+
# @return [::Object]
|
319
|
+
# @!attribute [rw] scope
|
320
|
+
# The OAuth scopes
|
321
|
+
# @return [::Array<::String>]
|
322
|
+
# @!attribute [rw] lib_name
|
323
|
+
# The library name as recorded in instrumentation and logging
|
324
|
+
# @return [::String]
|
325
|
+
# @!attribute [rw] lib_version
|
326
|
+
# The library version as recorded in instrumentation and logging
|
327
|
+
# @return [::String]
|
328
|
+
# @!attribute [rw] timeout
|
329
|
+
# The call timeout in seconds.
|
330
|
+
# @return [::Numeric]
|
331
|
+
# @!attribute [rw] metadata
|
332
|
+
# Additional headers to be sent with the call.
|
333
|
+
# @return [::Hash{::Symbol=>::String}]
|
334
|
+
# @!attribute [rw] retry_policy
|
335
|
+
# The retry policy. The value is a hash with the following keys:
|
336
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
337
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
338
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
339
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
340
|
+
# trigger a retry.
|
341
|
+
# @return [::Hash]
|
342
|
+
# @!attribute [rw] quota_project
|
343
|
+
# A separate project against which to charge quota.
|
344
|
+
# @return [::String]
|
345
|
+
# @!attribute [rw] universe_domain
|
346
|
+
# The universe domain within which to make requests. This determines the
|
347
|
+
# default endpoint URL. The default value of nil uses the environment
|
348
|
+
# universe (usually the default "googleapis.com" universe).
|
349
|
+
# @return [::String,nil]
|
350
|
+
#
|
351
|
+
class Configuration
|
352
|
+
extend ::Gapic::Config
|
353
|
+
|
354
|
+
# @private
|
355
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
356
|
+
DEFAULT_ENDPOINT = "run.googleapis.com"
|
357
|
+
|
358
|
+
config_attr :endpoint, nil, ::String, nil
|
359
|
+
config_attr :credentials, nil do |value|
|
360
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
361
|
+
allowed.any? { |klass| klass === value }
|
362
|
+
end
|
363
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
364
|
+
config_attr :lib_name, nil, ::String, nil
|
365
|
+
config_attr :lib_version, nil, ::String, nil
|
366
|
+
config_attr :timeout, nil, ::Numeric, nil
|
367
|
+
config_attr :metadata, nil, ::Hash, nil
|
368
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
369
|
+
config_attr :quota_project, nil, ::String, nil
|
370
|
+
config_attr :universe_domain, nil, ::String, nil
|
371
|
+
|
372
|
+
# @private
|
373
|
+
def initialize parent_config = nil
|
374
|
+
@parent_config = parent_config unless parent_config.nil?
|
375
|
+
|
376
|
+
yield self if block_given?
|
377
|
+
end
|
378
|
+
|
379
|
+
##
|
380
|
+
# Configurations for individual RPCs
|
381
|
+
# @return [Rpcs]
|
382
|
+
#
|
383
|
+
def rpcs
|
384
|
+
@rpcs ||= begin
|
385
|
+
parent_rpcs = nil
|
386
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
387
|
+
Rpcs.new parent_rpcs
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
##
|
392
|
+
# Configuration RPC class for the Builds API.
|
393
|
+
#
|
394
|
+
# Includes fields providing the configuration for each RPC in this service.
|
395
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
396
|
+
# the following configuration fields:
|
397
|
+
#
|
398
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
399
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
400
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
401
|
+
# include the following keys:
|
402
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
403
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
404
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
405
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
406
|
+
# trigger a retry.
|
407
|
+
#
|
408
|
+
class Rpcs
|
409
|
+
##
|
410
|
+
# RPC-specific configuration for `submit_build`
|
411
|
+
# @return [::Gapic::Config::Method]
|
412
|
+
#
|
413
|
+
attr_reader :submit_build
|
414
|
+
|
415
|
+
# @private
|
416
|
+
def initialize parent_rpcs = nil
|
417
|
+
submit_build_config = parent_rpcs.submit_build if parent_rpcs.respond_to? :submit_build
|
418
|
+
@submit_build = ::Gapic::Config::Method.new submit_build_config
|
419
|
+
|
420
|
+
yield self if block_given?
|
421
|
+
end
|
422
|
+
end
|
423
|
+
end
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
end
|
430
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/run/v2/build_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Run
|
24
|
+
module V2
|
25
|
+
module Builds
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the Builds 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:, endpoint_template:, universe_domain:, 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,
|
39
|
+
endpoint_template: endpoint_template,
|
40
|
+
universe_domain: universe_domain,
|
41
|
+
credentials: credentials,
|
42
|
+
numeric_enums: true,
|
43
|
+
raise_faraday_errors: false
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# The effective universe domain
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
#
|
51
|
+
def universe_domain
|
52
|
+
@client_stub.universe_domain
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# The effective endpoint
|
57
|
+
#
|
58
|
+
# @return [String]
|
59
|
+
#
|
60
|
+
def endpoint
|
61
|
+
@client_stub.endpoint
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# Baseline implementation for the submit_build REST call
|
66
|
+
#
|
67
|
+
# @param request_pb [::Google::Cloud::Run::V2::SubmitBuildRequest]
|
68
|
+
# A request object representing the call parameters. Required.
|
69
|
+
# @param options [::Gapic::CallOptions]
|
70
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
71
|
+
#
|
72
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
73
|
+
# @yieldparam result [::Google::Cloud::Run::V2::SubmitBuildResponse]
|
74
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
75
|
+
#
|
76
|
+
# @return [::Google::Cloud::Run::V2::SubmitBuildResponse]
|
77
|
+
# A result object deserialized from the server's reply
|
78
|
+
def submit_build request_pb, options = nil
|
79
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
80
|
+
|
81
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_submit_build_request request_pb
|
82
|
+
query_string_params = if query_string_params.any?
|
83
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
84
|
+
else
|
85
|
+
{}
|
86
|
+
end
|
87
|
+
|
88
|
+
response = @client_stub.make_http_request(
|
89
|
+
verb,
|
90
|
+
uri: uri,
|
91
|
+
body: body || "",
|
92
|
+
params: query_string_params,
|
93
|
+
options: options
|
94
|
+
)
|
95
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
96
|
+
result = ::Google::Cloud::Run::V2::SubmitBuildResponse.decode_json response.body, ignore_unknown_fields: true
|
97
|
+
|
98
|
+
yield result, operation if block_given?
|
99
|
+
result
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# @private
|
104
|
+
#
|
105
|
+
# GRPC transcoding helper method for the submit_build REST call
|
106
|
+
#
|
107
|
+
# @param request_pb [::Google::Cloud::Run::V2::SubmitBuildRequest]
|
108
|
+
# A request object representing the call parameters. Required.
|
109
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
110
|
+
# Uri, Body, Query string parameters
|
111
|
+
def self.transcode_submit_build_request request_pb
|
112
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
113
|
+
.with_bindings(
|
114
|
+
uri_method: :post,
|
115
|
+
uri_template: "/v2/{parent}/builds:submit",
|
116
|
+
body: "*",
|
117
|
+
matches: [
|
118
|
+
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
|
119
|
+
]
|
120
|
+
)
|
121
|
+
transcoder.transcode request_pb
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/run/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/run/v2/builds/credentials"
|
26
|
+
require "google/cloud/run/v2/builds/paths"
|
27
|
+
require "google/cloud/run/v2/builds/rest/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Run
|
32
|
+
module V2
|
33
|
+
##
|
34
|
+
# Cloud Run Build Control Plane API
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a REST client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/run/v2/builds/rest"
|
39
|
+
# client = ::Google::Cloud::Run::V2::Builds::Rest::Client.new
|
40
|
+
#
|
41
|
+
module Builds
|
42
|
+
# Client for the REST transport
|
43
|
+
module Rest
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
52
|
+
require "google/cloud/run/v2/builds/rest/helpers" if ::File.file? helper_path
|