google-cloud-run-client 1.5.0 → 1.6.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/README.md +8 -0
- data/lib/google/cloud/run/client/version.rb +1 -1
- data/lib/google/cloud/run.rb +70 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a4262192fdeecd8461f1a2df2a93930b91076a1fe407c6e9432768185d47386
|
|
4
|
+
data.tar.gz: 0502f1e8083507517ebce5ffb4ab1dbaab06f9f6c848bb6eb8ea6b6b4ac770fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c1a2b7b5e604c8c899190252f43897763f89d9dc1d4e1bb336769455ecf1aa7f0ee0a5017784b6515a0883da3196dcd7748a78092caf48e66930d5fae0a033c
|
|
7
|
+
data.tar.gz: e344d8d5a0f6b8a67bf4821f1e809b9528d6f6ad58cf56c647e98b212e342017a8713303afb424d31e4248b4d0dae55fbce5989c6fab9eb72652e187e4252a98
|
data/README.md
CHANGED
|
@@ -34,6 +34,14 @@ In order to use this library, you first need to go through the following steps:
|
|
|
34
34
|
1. [Enable the API.](https://console.cloud.google.com/apis/library/run.googleapis.com)
|
|
35
35
|
1. {file:AUTHENTICATION.md Set up authentication.}
|
|
36
36
|
|
|
37
|
+
```ruby
|
|
38
|
+
require "google/cloud/run"
|
|
39
|
+
|
|
40
|
+
client = Google::Cloud::Run.builds
|
|
41
|
+
request = ::Google::Cloud::Run::V2::SubmitBuildRequest.new # (request fields as keyword arguments...)
|
|
42
|
+
response = client.submit_build request
|
|
43
|
+
```
|
|
44
|
+
|
|
37
45
|
## Debug Logging
|
|
38
46
|
|
|
39
47
|
This library comes with opt-in Debug Logging that can help you troubleshoot
|
data/lib/google/cloud/run.rb
CHANGED
|
@@ -185,6 +185,76 @@ module Google
|
|
|
185
185
|
false
|
|
186
186
|
end
|
|
187
187
|
|
|
188
|
+
##
|
|
189
|
+
# Create a new client object for Instances.
|
|
190
|
+
#
|
|
191
|
+
# By default, this returns an instance of
|
|
192
|
+
# [Google::Cloud::Run::V2::Instances::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-run-v2/latest/Google-Cloud-Run-V2-Instances-Client)
|
|
193
|
+
# for a gRPC client for version V2 of the API.
|
|
194
|
+
# However, you can specify a different API version by passing it in the
|
|
195
|
+
# `version` parameter. If the Instances service is
|
|
196
|
+
# supported by that API version, and the corresponding gem is available, the
|
|
197
|
+
# appropriate versioned client will be returned.
|
|
198
|
+
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
|
199
|
+
# the `transport` parameter.
|
|
200
|
+
#
|
|
201
|
+
# Raises an exception if the currently installed versioned client gem for the
|
|
202
|
+
# given API version does not support the given transport of the Instances service.
|
|
203
|
+
# You can determine whether the method will succeed by calling
|
|
204
|
+
# {Google::Cloud::Run.instances_available?}.
|
|
205
|
+
#
|
|
206
|
+
# ## About Instances
|
|
207
|
+
#
|
|
208
|
+
# The Cloud Run Instances API allows you to manage Cloud Run Instances.
|
|
209
|
+
#
|
|
210
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
|
211
|
+
# Defaults to `:v2`.
|
|
212
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
|
213
|
+
# @return [::Object] A client object for the specified version.
|
|
214
|
+
#
|
|
215
|
+
def self.instances version: :v2, transport: :grpc, &block
|
|
216
|
+
require "google/cloud/run/#{version.to_s.downcase}"
|
|
217
|
+
|
|
218
|
+
package_name = Google::Cloud::Run
|
|
219
|
+
.constants
|
|
220
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
|
221
|
+
.first
|
|
222
|
+
service_module = Google::Cloud::Run.const_get(package_name).const_get(:Instances)
|
|
223
|
+
service_module = service_module.const_get(:Rest) if transport == :rest
|
|
224
|
+
service_module.const_get(:Client).new(&block)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
##
|
|
228
|
+
# Determines whether the Instances service is supported by the current client.
|
|
229
|
+
# If true, you can retrieve a client object by calling {Google::Cloud::Run.instances}.
|
|
230
|
+
# If false, that method will raise an exception. This could happen if the given
|
|
231
|
+
# API version does not exist or does not support the Instances service,
|
|
232
|
+
# or if the versioned client gem needs an update to support the Instances service.
|
|
233
|
+
#
|
|
234
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
|
235
|
+
# Defaults to `:v2`.
|
|
236
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
|
237
|
+
# @return [boolean] Whether the service is available.
|
|
238
|
+
#
|
|
239
|
+
def self.instances_available? version: :v2, transport: :grpc
|
|
240
|
+
require "google/cloud/run/#{version.to_s.downcase}"
|
|
241
|
+
package_name = Google::Cloud::Run
|
|
242
|
+
.constants
|
|
243
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
|
244
|
+
.first
|
|
245
|
+
return false unless package_name
|
|
246
|
+
service_module = Google::Cloud::Run.const_get package_name
|
|
247
|
+
return false unless service_module.const_defined? :Instances
|
|
248
|
+
service_module = service_module.const_get :Instances
|
|
249
|
+
if transport == :rest
|
|
250
|
+
return false unless service_module.const_defined? :Rest
|
|
251
|
+
service_module = service_module.const_get :Rest
|
|
252
|
+
end
|
|
253
|
+
service_module.const_defined? :Client
|
|
254
|
+
rescue ::LoadError
|
|
255
|
+
false
|
|
256
|
+
end
|
|
257
|
+
|
|
188
258
|
##
|
|
189
259
|
# Create a new client object for Jobs.
|
|
190
260
|
#
|