google-cloud-run-v2 0.31.0 → 0.32.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/lib/google/cloud/run/v2/build_pb.rb +1 -1
- data/lib/google/cloud/run/v2/builds/client.rb +2 -2
- data/lib/google/cloud/run/v2/builds/credentials.rb +2 -1
- data/lib/google/cloud/run/v2/builds/rest/client.rb +2 -2
- data/lib/google/cloud/run/v2/condition_pb.rb +2 -1
- data/lib/google/cloud/run/v2/execution_pb.rb +1 -1
- data/lib/google/cloud/run/v2/execution_template_pb.rb +1 -1
- data/lib/google/cloud/run/v2/executions/credentials.rb +3 -1
- data/lib/google/cloud/run/v2/instance_pb.rb +7 -1
- data/lib/google/cloud/run/v2/instance_services_pb.rb +14 -2
- data/lib/google/cloud/run/v2/instances/client.rb +424 -12
- data/lib/google/cloud/run/v2/instances/credentials.rb +3 -1
- data/lib/google/cloud/run/v2/instances/rest/client.rb +393 -12
- data/lib/google/cloud/run/v2/instances/rest/service_stub.rb +247 -0
- data/lib/google/cloud/run/v2/job_pb.rb +1 -1
- data/lib/google/cloud/run/v2/jobs/client.rb +2 -1
- data/lib/google/cloud/run/v2/jobs/credentials.rb +3 -1
- data/lib/google/cloud/run/v2/jobs/rest/client.rb +2 -1
- data/lib/google/cloud/run/v2/k8s.min_pb.rb +3 -1
- data/lib/google/cloud/run/v2/rest.rb +1 -0
- data/lib/google/cloud/run/v2/revision_pb.rb +2 -1
- data/lib/google/cloud/run/v2/revision_template_pb.rb +2 -1
- data/lib/google/cloud/run/v2/revisions/credentials.rb +3 -1
- data/lib/google/cloud/run/v2/sandbox_pb.rb +25 -0
- data/lib/google/cloud/run/v2/service_pb.rb +1 -1
- data/lib/google/cloud/run/v2/services/client.rb +12 -2
- data/lib/google/cloud/run/v2/services/credentials.rb +3 -1
- data/lib/google/cloud/run/v2/services/rest/client.rb +12 -2
- data/lib/google/cloud/run/v2/source_upload/client.rb +505 -0
- data/lib/google/cloud/run/v2/source_upload/credentials.rb +48 -0
- data/lib/google/cloud/run/v2/source_upload/paths.rb +69 -0
- data/lib/google/cloud/run/v2/source_upload/rest/client.rb +452 -0
- data/lib/google/cloud/run/v2/source_upload/rest/service_stub.rb +143 -0
- data/lib/google/cloud/run/v2/source_upload/rest.rb +53 -0
- data/lib/google/cloud/run/v2/source_upload.rb +56 -0
- data/lib/google/cloud/run/v2/source_upload_pb.rb +29 -0
- data/lib/google/cloud/run/v2/source_upload_services_pb.rb +52 -0
- data/lib/google/cloud/run/v2/task_pb.rb +2 -1
- data/lib/google/cloud/run/v2/task_template_pb.rb +2 -1
- data/lib/google/cloud/run/v2/tasks/credentials.rb +3 -1
- data/lib/google/cloud/run/v2/vendor_settings_pb.rb +6 -1
- data/lib/google/cloud/run/v2/version.rb +1 -1
- data/lib/google/cloud/run/v2/worker_pool_pb.rb +1 -1
- data/lib/google/cloud/run/v2/worker_pool_revision_template_pb.rb +2 -1
- data/lib/google/cloud/run/v2/worker_pools/client.rb +2 -1
- data/lib/google/cloud/run/v2/worker_pools/credentials.rb +3 -1
- data/lib/google/cloud/run/v2/worker_pools/rest/client.rb +2 -1
- data/lib/google/cloud/run/v2.rb +1 -0
- data/proto_docs/google/cloud/run/v2/build.rb +2 -2
- data/proto_docs/google/cloud/run/v2/condition.rb +29 -3
- data/proto_docs/google/cloud/run/v2/execution.rb +7 -1
- data/proto_docs/google/cloud/run/v2/execution_template.rb +10 -0
- data/proto_docs/google/cloud/run/v2/instance.rb +74 -32
- data/proto_docs/google/cloud/run/v2/job.rb +9 -1
- data/proto_docs/google/cloud/run/v2/k8s.min.rb +78 -16
- data/proto_docs/google/cloud/run/v2/revision.rb +17 -2
- data/proto_docs/google/cloud/run/v2/revision_template.rb +16 -1
- data/proto_docs/google/cloud/run/v2/sandbox.rb +67 -0
- data/proto_docs/google/cloud/run/v2/service.rb +18 -1
- data/proto_docs/google/cloud/run/v2/source_upload.rb +48 -0
- data/proto_docs/google/cloud/run/v2/task.rb +6 -0
- data/proto_docs/google/cloud/run/v2/task_template.rb +6 -0
- data/proto_docs/google/cloud/run/v2/vendor_settings.rb +80 -2
- data/proto_docs/google/cloud/run/v2/worker_pool.rb +2 -1
- data/proto_docs/google/cloud/run/v2/worker_pool_revision_template.rb +9 -0
- metadata +13 -1
|
@@ -26,7 +26,9 @@ module Google
|
|
|
26
26
|
# Credentials for the Services API.
|
|
27
27
|
class Credentials < ::Google::Auth::Credentials
|
|
28
28
|
self.scope = [
|
|
29
|
-
"https://www.googleapis.com/auth/cloud-platform"
|
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
|
30
|
+
"https://www.googleapis.com/auth/run",
|
|
31
|
+
"https://www.googleapis.com/auth/run.readonly"
|
|
30
32
|
]
|
|
31
33
|
self.env_vars = [
|
|
32
34
|
"GOOGLE_CLOUD_CREDENTIALS",
|
|
@@ -247,9 +247,10 @@ module Google
|
|
|
247
247
|
# @param service [::Google::Cloud::Run::V2::Service, ::Hash]
|
|
248
248
|
# Required. The Service instance to create.
|
|
249
249
|
# @param service_id [::String]
|
|
250
|
-
#
|
|
250
|
+
# Optional. The unique identifier for the Service. It must begin with letter,
|
|
251
251
|
# and cannot end with hyphen; must contain fewer than 50 characters.
|
|
252
252
|
# The name of the service becomes \\{parent}/services/\\{service_id}.
|
|
253
|
+
# If not provided, the server will generate a unique `service_id`.
|
|
253
254
|
# @param validate_only [::Boolean]
|
|
254
255
|
# Indicates that the request should be validated and default values
|
|
255
256
|
# populated, without persisting the request or creating any resources.
|
|
@@ -507,7 +508,7 @@ module Google
|
|
|
507
508
|
# @param options [::Gapic::CallOptions, ::Hash]
|
|
508
509
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
509
510
|
#
|
|
510
|
-
# @overload update_service(update_mask: nil, service: nil, validate_only: nil, allow_missing: nil)
|
|
511
|
+
# @overload update_service(update_mask: nil, service: nil, validate_only: nil, allow_missing: nil, force_new_revision: nil)
|
|
511
512
|
# Pass arguments to `update_service` via keyword arguments. Note that at
|
|
512
513
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
513
514
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
@@ -523,6 +524,15 @@ module Google
|
|
|
523
524
|
# Optional. If set to true, and if the Service does not exist, it will create
|
|
524
525
|
# a new one. The caller must have 'run.services.create' permissions if this
|
|
525
526
|
# is set to true and the Service does not exist.
|
|
527
|
+
# @param force_new_revision [::Boolean]
|
|
528
|
+
# Optional. If set to true, a new revision will be created from the template
|
|
529
|
+
# even if the system doesn't detect any changes from the previously deployed
|
|
530
|
+
# revision.
|
|
531
|
+
#
|
|
532
|
+
# This may be useful for cases where the underlying resources need to be
|
|
533
|
+
# recreated or reinitialized. For example if the image is specified by label,
|
|
534
|
+
# but the underlying image digest has changed) or if the container performs
|
|
535
|
+
# deployment initialization work that needs to be performed again.
|
|
526
536
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
527
537
|
# @yieldparam result [::Gapic::Operation]
|
|
528
538
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 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/source_upload_pb"
|
|
21
|
+
require "google/cloud/location"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Cloud
|
|
25
|
+
module Run
|
|
26
|
+
module V2
|
|
27
|
+
module SourceUpload
|
|
28
|
+
##
|
|
29
|
+
# Client for the SourceUpload service.
|
|
30
|
+
#
|
|
31
|
+
# The Cloud Run Source Upload API allows you to upload source code to deploy
|
|
32
|
+
# Cloud Run resources.
|
|
33
|
+
#
|
|
34
|
+
class Client
|
|
35
|
+
# @private
|
|
36
|
+
API_VERSION = ""
|
|
37
|
+
|
|
38
|
+
# @private
|
|
39
|
+
DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
|
|
40
|
+
|
|
41
|
+
include Paths
|
|
42
|
+
|
|
43
|
+
# @private
|
|
44
|
+
attr_reader :source_upload_stub
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Configure the SourceUpload Client class.
|
|
48
|
+
#
|
|
49
|
+
# See {::Google::Cloud::Run::V2::SourceUpload::Client::Configuration}
|
|
50
|
+
# for a description of the configuration fields.
|
|
51
|
+
#
|
|
52
|
+
# @example
|
|
53
|
+
#
|
|
54
|
+
# # Modify the configuration for all SourceUpload clients
|
|
55
|
+
# ::Google::Cloud::Run::V2::SourceUpload::Client.configure do |config|
|
|
56
|
+
# config.timeout = 10.0
|
|
57
|
+
# end
|
|
58
|
+
#
|
|
59
|
+
# @yield [config] Configure the Client client.
|
|
60
|
+
# @yieldparam config [Client::Configuration]
|
|
61
|
+
#
|
|
62
|
+
# @return [Client::Configuration]
|
|
63
|
+
#
|
|
64
|
+
def self.configure
|
|
65
|
+
@configure ||= begin
|
|
66
|
+
namespace = ["Google", "Cloud", "Run", "V2"]
|
|
67
|
+
parent_config = while namespace.any?
|
|
68
|
+
parent_name = namespace.join "::"
|
|
69
|
+
parent_const = const_get parent_name
|
|
70
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
71
|
+
namespace.pop
|
|
72
|
+
end
|
|
73
|
+
default_config = Client::Configuration.new parent_config
|
|
74
|
+
|
|
75
|
+
default_config
|
|
76
|
+
end
|
|
77
|
+
yield @configure if block_given?
|
|
78
|
+
@configure
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
##
|
|
82
|
+
# Configure the SourceUpload Client instance.
|
|
83
|
+
#
|
|
84
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
85
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
86
|
+
# should be made on {Client.configure}.
|
|
87
|
+
#
|
|
88
|
+
# See {::Google::Cloud::Run::V2::SourceUpload::Client::Configuration}
|
|
89
|
+
# for a description of the configuration fields.
|
|
90
|
+
#
|
|
91
|
+
# @yield [config] Configure the Client client.
|
|
92
|
+
# @yieldparam config [Client::Configuration]
|
|
93
|
+
#
|
|
94
|
+
# @return [Client::Configuration]
|
|
95
|
+
#
|
|
96
|
+
def configure
|
|
97
|
+
yield @config if block_given?
|
|
98
|
+
@config
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
##
|
|
102
|
+
# The effective universe domain
|
|
103
|
+
#
|
|
104
|
+
# @return [String]
|
|
105
|
+
#
|
|
106
|
+
def universe_domain
|
|
107
|
+
@source_upload_stub.universe_domain
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
##
|
|
111
|
+
# Create a new SourceUpload client object.
|
|
112
|
+
#
|
|
113
|
+
# @example
|
|
114
|
+
#
|
|
115
|
+
# # Create a client using the default configuration
|
|
116
|
+
# client = ::Google::Cloud::Run::V2::SourceUpload::Client.new
|
|
117
|
+
#
|
|
118
|
+
# # Create a client using a custom configuration
|
|
119
|
+
# client = ::Google::Cloud::Run::V2::SourceUpload::Client.new do |config|
|
|
120
|
+
# config.timeout = 10.0
|
|
121
|
+
# end
|
|
122
|
+
#
|
|
123
|
+
# @yield [config] Configure the SourceUpload client.
|
|
124
|
+
# @yieldparam config [Client::Configuration]
|
|
125
|
+
#
|
|
126
|
+
def initialize
|
|
127
|
+
# These require statements are intentionally placed here to initialize
|
|
128
|
+
# the gRPC module only when it's required.
|
|
129
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
|
130
|
+
require "gapic/grpc"
|
|
131
|
+
require "google/cloud/run/v2/source_upload_services_pb"
|
|
132
|
+
|
|
133
|
+
# Create the configuration object
|
|
134
|
+
@config = Configuration.new Client.configure
|
|
135
|
+
|
|
136
|
+
# Yield the configuration if needed
|
|
137
|
+
yield @config if block_given?
|
|
138
|
+
|
|
139
|
+
# Create credentials
|
|
140
|
+
credentials = @config.credentials
|
|
141
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
142
|
+
# but only if the default endpoint does not have a region prefix.
|
|
143
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
144
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
145
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
146
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
147
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
148
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
149
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
150
|
+
end
|
|
151
|
+
@quota_project_id = @config.quota_project
|
|
152
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
153
|
+
|
|
154
|
+
@source_upload_stub = ::Gapic::ServiceStub.new(
|
|
155
|
+
::Google::Cloud::Run::V2::SourceUpload::Stub,
|
|
156
|
+
credentials: credentials,
|
|
157
|
+
endpoint: @config.endpoint,
|
|
158
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
159
|
+
universe_domain: @config.universe_domain,
|
|
160
|
+
channel_args: @config.channel_args,
|
|
161
|
+
interceptors: @config.interceptors,
|
|
162
|
+
channel_pool_config: @config.channel_pool,
|
|
163
|
+
logger: @config.logger
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
@source_upload_stub.stub_logger&.info do |entry|
|
|
167
|
+
entry.set_system_name
|
|
168
|
+
entry.set_service
|
|
169
|
+
entry.message = "Created client for #{entry.service}"
|
|
170
|
+
entry.set_credentials_fields credentials
|
|
171
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
172
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
173
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
|
177
|
+
config.credentials = credentials
|
|
178
|
+
config.quota_project = @quota_project_id
|
|
179
|
+
config.endpoint = @source_upload_stub.endpoint
|
|
180
|
+
config.universe_domain = @source_upload_stub.universe_domain
|
|
181
|
+
config.logger = @source_upload_stub.logger if config.respond_to? :logger=
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
##
|
|
186
|
+
# Get the associated client for mix-in of the Locations.
|
|
187
|
+
#
|
|
188
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
|
189
|
+
#
|
|
190
|
+
attr_reader :location_client
|
|
191
|
+
|
|
192
|
+
##
|
|
193
|
+
# The logger used for request/response debug logging.
|
|
194
|
+
#
|
|
195
|
+
# @return [Logger]
|
|
196
|
+
#
|
|
197
|
+
def logger
|
|
198
|
+
@source_upload_stub.logger
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Service calls
|
|
202
|
+
|
|
203
|
+
##
|
|
204
|
+
# Uploads a source archive to a Google Cloud Storage bucket through Cloud
|
|
205
|
+
# Run. The uploaded source object should be used for Cloud Run resource
|
|
206
|
+
# deployments. User is responsible for managing the lifecycle of the uploaded
|
|
207
|
+
# object.
|
|
208
|
+
# If uploading through the Cloud Run API to Cloud Storage is not desired, you
|
|
209
|
+
# can use the IAM Deny Policy to deny the `run.locations.uploadSource`
|
|
210
|
+
# permission for all principals.
|
|
211
|
+
#
|
|
212
|
+
# @overload upload_source(request, options = nil)
|
|
213
|
+
# Pass arguments to `upload_source` via a request object, either of type
|
|
214
|
+
# {::Google::Cloud::Run::V2::UploadSourceRequest} or an equivalent Hash.
|
|
215
|
+
#
|
|
216
|
+
# @param request [::Google::Cloud::Run::V2::UploadSourceRequest, ::Hash]
|
|
217
|
+
# A request object representing the call parameters. Required. To specify no
|
|
218
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
219
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
220
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
221
|
+
#
|
|
222
|
+
# @overload upload_source(parent: nil, service: nil)
|
|
223
|
+
# Pass arguments to `upload_source` via keyword arguments. Note that at
|
|
224
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
225
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
226
|
+
#
|
|
227
|
+
# @param parent [::String]
|
|
228
|
+
# Required. The project and location in which the source archive should be
|
|
229
|
+
# uploaded to, specified in the format `projects/*/locations/*`.
|
|
230
|
+
# @param service [::String]
|
|
231
|
+
# The name of Cloud Run Service upload source archive will be used for.
|
|
232
|
+
#
|
|
233
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
234
|
+
# @yieldparam response [::Google::Cloud::Run::V2::UploadSourceResponse]
|
|
235
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
236
|
+
#
|
|
237
|
+
# @return [::Google::Cloud::Run::V2::UploadSourceResponse]
|
|
238
|
+
#
|
|
239
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
240
|
+
#
|
|
241
|
+
# @example Basic example
|
|
242
|
+
# require "google/cloud/run/v2"
|
|
243
|
+
#
|
|
244
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
245
|
+
# client = Google::Cloud::Run::V2::SourceUpload::Client.new
|
|
246
|
+
#
|
|
247
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
248
|
+
# request = Google::Cloud::Run::V2::UploadSourceRequest.new
|
|
249
|
+
#
|
|
250
|
+
# # Call the upload_source method.
|
|
251
|
+
# result = client.upload_source request
|
|
252
|
+
#
|
|
253
|
+
# # The returned object is of type Google::Cloud::Run::V2::UploadSourceResponse.
|
|
254
|
+
# p result
|
|
255
|
+
#
|
|
256
|
+
def upload_source request, options = nil
|
|
257
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
258
|
+
|
|
259
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::UploadSourceRequest
|
|
260
|
+
|
|
261
|
+
# Converts hash and nil to an options object
|
|
262
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
263
|
+
|
|
264
|
+
# Customize the options with defaults
|
|
265
|
+
metadata = @config.rpcs.upload_source.metadata.to_h
|
|
266
|
+
|
|
267
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
268
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
269
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
270
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
|
271
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
272
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
273
|
+
|
|
274
|
+
header_params = {}
|
|
275
|
+
if request.parent
|
|
276
|
+
regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent
|
|
277
|
+
if regex_match
|
|
278
|
+
header_params["location"] = regex_match["location".to_s]
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
request_params_header = URI.encode_www_form header_params
|
|
283
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
284
|
+
|
|
285
|
+
options.apply_defaults timeout: @config.rpcs.upload_source.timeout,
|
|
286
|
+
metadata: metadata,
|
|
287
|
+
retry_policy: @config.rpcs.upload_source.retry_policy
|
|
288
|
+
|
|
289
|
+
options.apply_defaults timeout: @config.timeout,
|
|
290
|
+
metadata: @config.metadata,
|
|
291
|
+
retry_policy: @config.retry_policy
|
|
292
|
+
|
|
293
|
+
@source_upload_stub.call_rpc :upload_source, request, options: options do |response, operation|
|
|
294
|
+
yield response, operation if block_given?
|
|
295
|
+
end
|
|
296
|
+
rescue ::GRPC::BadStatus => e
|
|
297
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
##
|
|
301
|
+
# Configuration class for the SourceUpload API.
|
|
302
|
+
#
|
|
303
|
+
# This class represents the configuration for SourceUpload,
|
|
304
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
305
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
306
|
+
# applied individually to specific RPCs. See
|
|
307
|
+
# {::Google::Cloud::Run::V2::SourceUpload::Client::Configuration::Rpcs}
|
|
308
|
+
# for a list of RPCs that can be configured independently.
|
|
309
|
+
#
|
|
310
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
311
|
+
# on construction.
|
|
312
|
+
#
|
|
313
|
+
# @example
|
|
314
|
+
#
|
|
315
|
+
# # Modify the global config, setting the timeout for
|
|
316
|
+
# # upload_source to 20 seconds,
|
|
317
|
+
# # and all remaining timeouts to 10 seconds.
|
|
318
|
+
# ::Google::Cloud::Run::V2::SourceUpload::Client.configure do |config|
|
|
319
|
+
# config.timeout = 10.0
|
|
320
|
+
# config.rpcs.upload_source.timeout = 20.0
|
|
321
|
+
# end
|
|
322
|
+
#
|
|
323
|
+
# # Apply the above configuration only to a new client.
|
|
324
|
+
# client = ::Google::Cloud::Run::V2::SourceUpload::Client.new do |config|
|
|
325
|
+
# config.timeout = 10.0
|
|
326
|
+
# config.rpcs.upload_source.timeout = 20.0
|
|
327
|
+
# end
|
|
328
|
+
#
|
|
329
|
+
# @!attribute [rw] endpoint
|
|
330
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
331
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
332
|
+
# @return [::String,nil]
|
|
333
|
+
# @!attribute [rw] credentials
|
|
334
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
335
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
336
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
337
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
338
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
339
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
|
340
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
341
|
+
# * (`nil`) indicating no credentials
|
|
342
|
+
#
|
|
343
|
+
# @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
|
|
344
|
+
# is deprecated. Providing an unvalidated credential configuration to
|
|
345
|
+
# Google APIs can compromise the security of your systems and data.
|
|
346
|
+
#
|
|
347
|
+
# @example
|
|
348
|
+
#
|
|
349
|
+
# # The recommended way to provide credentials is to use the `make_creds` method
|
|
350
|
+
# # on the appropriate credentials class for your environment.
|
|
351
|
+
#
|
|
352
|
+
# require "googleauth"
|
|
353
|
+
#
|
|
354
|
+
# credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
355
|
+
# json_key_io: ::File.open("/path/to/keyfile.json")
|
|
356
|
+
# )
|
|
357
|
+
#
|
|
358
|
+
# client = ::Google::Cloud::Run::V2::SourceUpload::Client.new do |config|
|
|
359
|
+
# config.credentials = credentials
|
|
360
|
+
# end
|
|
361
|
+
#
|
|
362
|
+
# @note Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
363
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
364
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
365
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
366
|
+
# For more information, refer to [Validate credential configurations from external
|
|
367
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
368
|
+
# @return [::Object]
|
|
369
|
+
# @!attribute [rw] scope
|
|
370
|
+
# The OAuth scopes
|
|
371
|
+
# @return [::Array<::String>]
|
|
372
|
+
# @!attribute [rw] lib_name
|
|
373
|
+
# The library name as recorded in instrumentation and logging
|
|
374
|
+
# @return [::String]
|
|
375
|
+
# @!attribute [rw] lib_version
|
|
376
|
+
# The library version as recorded in instrumentation and logging
|
|
377
|
+
# @return [::String]
|
|
378
|
+
# @!attribute [rw] channel_args
|
|
379
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
|
380
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
|
381
|
+
# @return [::Hash]
|
|
382
|
+
# @!attribute [rw] interceptors
|
|
383
|
+
# An array of interceptors that are run before calls are executed.
|
|
384
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
|
385
|
+
# @!attribute [rw] timeout
|
|
386
|
+
# The call timeout in seconds.
|
|
387
|
+
# @return [::Numeric]
|
|
388
|
+
# @!attribute [rw] metadata
|
|
389
|
+
# Additional gRPC headers to be sent with the call.
|
|
390
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
391
|
+
# @!attribute [rw] retry_policy
|
|
392
|
+
# The retry policy. The value is a hash with the following keys:
|
|
393
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
394
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
395
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
396
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
397
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
398
|
+
# trigger a retry.
|
|
399
|
+
# @return [::Hash]
|
|
400
|
+
# @!attribute [rw] quota_project
|
|
401
|
+
# A separate project against which to charge quota.
|
|
402
|
+
# @return [::String]
|
|
403
|
+
# @!attribute [rw] universe_domain
|
|
404
|
+
# The universe domain within which to make requests. This determines the
|
|
405
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
406
|
+
# universe (usually the default "googleapis.com" universe).
|
|
407
|
+
# @return [::String,nil]
|
|
408
|
+
# @!attribute [rw] logger
|
|
409
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
410
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
411
|
+
# explicitly disable logging.
|
|
412
|
+
# @return [::Logger,:default,nil]
|
|
413
|
+
#
|
|
414
|
+
class Configuration
|
|
415
|
+
extend ::Gapic::Config
|
|
416
|
+
|
|
417
|
+
# @private
|
|
418
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
419
|
+
DEFAULT_ENDPOINT = "run.googleapis.com"
|
|
420
|
+
|
|
421
|
+
config_attr :endpoint, nil, ::String, nil
|
|
422
|
+
config_attr :credentials, nil do |value|
|
|
423
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
424
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
|
|
425
|
+
allowed.any? { |klass| klass === value }
|
|
426
|
+
end
|
|
427
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
428
|
+
config_attr :lib_name, nil, ::String, nil
|
|
429
|
+
config_attr :lib_version, nil, ::String, nil
|
|
430
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
|
431
|
+
config_attr :interceptors, nil, ::Array, nil
|
|
432
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
433
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
434
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
435
|
+
config_attr :quota_project, nil, ::String, nil
|
|
436
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
437
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
438
|
+
|
|
439
|
+
# @private
|
|
440
|
+
def initialize parent_config = nil
|
|
441
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
442
|
+
|
|
443
|
+
yield self if block_given?
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
##
|
|
447
|
+
# Configurations for individual RPCs
|
|
448
|
+
# @return [Rpcs]
|
|
449
|
+
#
|
|
450
|
+
def rpcs
|
|
451
|
+
@rpcs ||= begin
|
|
452
|
+
parent_rpcs = nil
|
|
453
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
454
|
+
Rpcs.new parent_rpcs
|
|
455
|
+
end
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
##
|
|
459
|
+
# Configuration for the channel pool
|
|
460
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
|
461
|
+
#
|
|
462
|
+
def channel_pool
|
|
463
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
##
|
|
467
|
+
# Configuration RPC class for the SourceUpload API.
|
|
468
|
+
#
|
|
469
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
470
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
471
|
+
# the following configuration fields:
|
|
472
|
+
#
|
|
473
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
474
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
|
475
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
476
|
+
# include the following keys:
|
|
477
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
478
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
479
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
480
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
481
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
482
|
+
# trigger a retry.
|
|
483
|
+
#
|
|
484
|
+
class Rpcs
|
|
485
|
+
##
|
|
486
|
+
# RPC-specific configuration for `upload_source`
|
|
487
|
+
# @return [::Gapic::Config::Method]
|
|
488
|
+
#
|
|
489
|
+
attr_reader :upload_source
|
|
490
|
+
|
|
491
|
+
# @private
|
|
492
|
+
def initialize parent_rpcs = nil
|
|
493
|
+
upload_source_config = parent_rpcs.upload_source if parent_rpcs.respond_to? :upload_source
|
|
494
|
+
@upload_source = ::Gapic::Config::Method.new upload_source_config
|
|
495
|
+
|
|
496
|
+
yield self if block_given?
|
|
497
|
+
end
|
|
498
|
+
end
|
|
499
|
+
end
|
|
500
|
+
end
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
end
|
|
505
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 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 Run
|
|
24
|
+
module V2
|
|
25
|
+
module SourceUpload
|
|
26
|
+
# Credentials for the SourceUpload API.
|
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
|
28
|
+
self.scope = [
|
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
|
30
|
+
"https://www.googleapis.com/auth/run"
|
|
31
|
+
]
|
|
32
|
+
self.env_vars = [
|
|
33
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
|
34
|
+
"GOOGLE_CLOUD_KEYFILE",
|
|
35
|
+
"GCLOUD_KEYFILE",
|
|
36
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
|
37
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
|
38
|
+
"GCLOUD_KEYFILE_JSON"
|
|
39
|
+
]
|
|
40
|
+
self.paths = [
|
|
41
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
|
42
|
+
]
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 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 SourceUpload
|
|
25
|
+
# Path helper methods for the SourceUpload API.
|
|
26
|
+
module Paths
|
|
27
|
+
##
|
|
28
|
+
# Create a fully-qualified Location resource string.
|
|
29
|
+
#
|
|
30
|
+
# The resource will be in the following format:
|
|
31
|
+
#
|
|
32
|
+
# `projects/{project}/locations/{location}`
|
|
33
|
+
#
|
|
34
|
+
# @param project [String]
|
|
35
|
+
# @param location [String]
|
|
36
|
+
#
|
|
37
|
+
# @return [::String]
|
|
38
|
+
def location_path project:, location:
|
|
39
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
|
40
|
+
|
|
41
|
+
"projects/#{project}/locations/#{location}"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
##
|
|
45
|
+
# Create a fully-qualified Service resource string.
|
|
46
|
+
#
|
|
47
|
+
# The resource will be in the following format:
|
|
48
|
+
#
|
|
49
|
+
# `projects/{project}/locations/{location}/services/{service}`
|
|
50
|
+
#
|
|
51
|
+
# @param project [String]
|
|
52
|
+
# @param location [String]
|
|
53
|
+
# @param service [String]
|
|
54
|
+
#
|
|
55
|
+
# @return [::String]
|
|
56
|
+
def service_path project:, location:, service:
|
|
57
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
|
58
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
|
59
|
+
|
|
60
|
+
"projects/#{project}/locations/#{location}/services/#{service}"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
extend self
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|