google-cloud-run-client 1.9.0 → 1.10.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/client/version.rb +1 -1
- data/lib/google/cloud/run.rb +71 -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: 2add445f96e1b7d8542e8b298a980e9bf0ca946c64ca4e1dbbd3a1d527d37bb0
|
|
4
|
+
data.tar.gz: 29a43c276152b706df4d5c79ee713457864e06e58886083fadb72172af263b73
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 529698bdb4cf29271db8d27f3ae627a6ae0f0dadabffa788ee4492eeb15753be691a18b12fb92df8d372cbfb3e394d967c690e570e1a56ad7f2527818d3268dd
|
|
7
|
+
data.tar.gz: e20fe9c86d8ae3c722f09abba1fc50311ed96cf81103621b8b3244ee30d3e5577d9f2c800fee745d83943040aaadabc26775919420602e18c3f080dfb90c0c7b
|
data/lib/google/cloud/run.rb
CHANGED
|
@@ -465,6 +465,77 @@ module Google
|
|
|
465
465
|
false
|
|
466
466
|
end
|
|
467
467
|
|
|
468
|
+
##
|
|
469
|
+
# Create a new client object for SourceUpload.
|
|
470
|
+
#
|
|
471
|
+
# By default, this returns an instance of
|
|
472
|
+
# [Google::Cloud::Run::V2::SourceUpload::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-run-v2/latest/Google-Cloud-Run-V2-SourceUpload-Client)
|
|
473
|
+
# for a gRPC client for version V2 of the API.
|
|
474
|
+
# However, you can specify a different API version by passing it in the
|
|
475
|
+
# `version` parameter. If the SourceUpload service is
|
|
476
|
+
# supported by that API version, and the corresponding gem is available, the
|
|
477
|
+
# appropriate versioned client will be returned.
|
|
478
|
+
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
|
479
|
+
# the `transport` parameter.
|
|
480
|
+
#
|
|
481
|
+
# Raises an exception if the currently installed versioned client gem for the
|
|
482
|
+
# given API version does not support the given transport of the SourceUpload service.
|
|
483
|
+
# You can determine whether the method will succeed by calling
|
|
484
|
+
# {Google::Cloud::Run.source_upload_available?}.
|
|
485
|
+
#
|
|
486
|
+
# ## About SourceUpload
|
|
487
|
+
#
|
|
488
|
+
# The Cloud Run Source Upload API allows you to upload source code to deploy
|
|
489
|
+
# Cloud Run resources.
|
|
490
|
+
#
|
|
491
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
|
492
|
+
# Defaults to `:v2`.
|
|
493
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
|
494
|
+
# @return [::Object] A client object for the specified version.
|
|
495
|
+
#
|
|
496
|
+
def self.source_upload version: :v2, transport: :grpc, &block
|
|
497
|
+
require "google/cloud/run/#{version.to_s.downcase}"
|
|
498
|
+
|
|
499
|
+
package_name = Google::Cloud::Run
|
|
500
|
+
.constants
|
|
501
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
|
502
|
+
.first
|
|
503
|
+
service_module = Google::Cloud::Run.const_get(package_name).const_get(:SourceUpload)
|
|
504
|
+
service_module = service_module.const_get(:Rest) if transport == :rest
|
|
505
|
+
service_module.const_get(:Client).new(&block)
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
##
|
|
509
|
+
# Determines whether the SourceUpload service is supported by the current client.
|
|
510
|
+
# If true, you can retrieve a client object by calling {Google::Cloud::Run.source_upload}.
|
|
511
|
+
# If false, that method will raise an exception. This could happen if the given
|
|
512
|
+
# API version does not exist or does not support the SourceUpload service,
|
|
513
|
+
# or if the versioned client gem needs an update to support the SourceUpload service.
|
|
514
|
+
#
|
|
515
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
|
516
|
+
# Defaults to `:v2`.
|
|
517
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
|
518
|
+
# @return [boolean] Whether the service is available.
|
|
519
|
+
#
|
|
520
|
+
def self.source_upload_available? version: :v2, transport: :grpc
|
|
521
|
+
require "google/cloud/run/#{version.to_s.downcase}"
|
|
522
|
+
package_name = Google::Cloud::Run
|
|
523
|
+
.constants
|
|
524
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
|
525
|
+
.first
|
|
526
|
+
return false unless package_name
|
|
527
|
+
service_module = Google::Cloud::Run.const_get package_name
|
|
528
|
+
return false unless service_module.const_defined? :SourceUpload
|
|
529
|
+
service_module = service_module.const_get :SourceUpload
|
|
530
|
+
if transport == :rest
|
|
531
|
+
return false unless service_module.const_defined? :Rest
|
|
532
|
+
service_module = service_module.const_get :Rest
|
|
533
|
+
end
|
|
534
|
+
service_module.const_defined? :Client
|
|
535
|
+
rescue ::LoadError
|
|
536
|
+
false
|
|
537
|
+
end
|
|
538
|
+
|
|
468
539
|
##
|
|
469
540
|
# Create a new client object for Tasks.
|
|
470
541
|
#
|