google-cloud-run-client 1.5.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 676f006aabf018f7ac1862b7e91c97f3c3d5265710c8fd57a411bbd0f4aaf034
4
- data.tar.gz: b66bf036f398a924a18b5df51f830274be6e38fa22d005ce77fcb25d7166d21a
3
+ metadata.gz: 1a4262192fdeecd8461f1a2df2a93930b91076a1fe407c6e9432768185d47386
4
+ data.tar.gz: 0502f1e8083507517ebce5ffb4ab1dbaab06f9f6c848bb6eb8ea6b6b4ac770fb
5
5
  SHA512:
6
- metadata.gz: b6a1e8aa7c9a85399ff01b82fb35a59ed5045340cb4999a71fc57dcee8f698e17e268b862c692ff92a0412e175e82a2cb126ba2825a74e55658a59b295d1bc02
7
- data.tar.gz: 46dfaf5b21fb217e0e2d65372a38c11d510649bc74fc69e8a044540569d13165fb3f9a6f368092dc8ad7876d7810124db03690f7cbf1c294fa4d208d34b7792d
6
+ metadata.gz: 6c1a2b7b5e604c8c899190252f43897763f89d9dc1d4e1bb336769455ecf1aa7f0ee0a5017784b6515a0883da3196dcd7748a78092caf48e66930d5fae0a033c
7
+ data.tar.gz: e344d8d5a0f6b8a67bf4821f1e809b9528d6f6ad58cf56c647e98b212e342017a8713303afb424d31e4248b4d0dae55fbce5989c6fab9eb72652e187e4252a98
@@ -18,7 +18,7 @@ module Google
18
18
  module Cloud
19
19
  module Run
20
20
  module Client
21
- VERSION = "1.5.1"
21
+ VERSION = "1.6.0"
22
22
  end
23
23
  end
24
24
  end
@@ -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
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-run-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC