google-cloud-run-client 0.2.0 → 0.4.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 +6 -6
- data/README.md +0 -26
- data/lib/google/cloud/run/client/version.rb +1 -1
- data/lib/google/cloud/run.rb +123 -13
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f94374952efb5ed30adb6d58fe4dcdaa1bef920338d244efd6450f8cbd04501d
|
4
|
+
data.tar.gz: ab150e9fb5790344161493e61f044577e184064a8a1f4743b12c693649fabfac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f566793f738022eab85635ad7cec14a62041b8f04d5e504b94228bb54fd53019de83c11b5eef0feae554dec1a4d7a88305a6ae134eedf99271ae6b63293c435
|
7
|
+
data.tar.gz: a998b5a73293a5bdea3058136eaf07e1a6362faf94bab3342a04c3fcf92b9c6aa2c30bcb4965079f8d304100ceae69eeee73a05278e1690518e77686b44456e7
|
data/AUTHENTICATION.md
CHANGED
@@ -27,7 +27,7 @@ export GOOGLE_CLOUD_CREDENTIALS=path/to/keyfile.json
|
|
27
27
|
```ruby
|
28
28
|
require "google/cloud/run"
|
29
29
|
|
30
|
-
client = Google::Cloud::Run.
|
30
|
+
client = Google::Cloud::Run.executions
|
31
31
|
```
|
32
32
|
|
33
33
|
## Credential Lookup
|
@@ -64,7 +64,7 @@ containers where writing files is difficult or not encouraged.
|
|
64
64
|
|
65
65
|
The environment variables that google-cloud-run-client
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
|
-
`::Google::Cloud::Run::V2::
|
67
|
+
`::Google::Cloud::Run::V2::Executions::Credentials`):
|
68
68
|
|
69
69
|
* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
|
70
70
|
* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
|
@@ -75,7 +75,7 @@ require "google/cloud/run"
|
|
75
75
|
|
76
76
|
ENV["GOOGLE_CLOUD_CREDENTIALS"] = "path/to/keyfile.json"
|
77
77
|
|
78
|
-
client = Google::Cloud::Run.
|
78
|
+
client = Google::Cloud::Run.executions
|
79
79
|
```
|
80
80
|
|
81
81
|
### Configuration
|
@@ -86,7 +86,7 @@ it in an environment variable. Either on an individual client initialization:
|
|
86
86
|
```ruby
|
87
87
|
require "google/cloud/run"
|
88
88
|
|
89
|
-
client = Google::Cloud::Run.
|
89
|
+
client = Google::Cloud::Run.executions do |config|
|
90
90
|
config.credentials = "path/to/keyfile.json"
|
91
91
|
end
|
92
92
|
```
|
@@ -100,7 +100,7 @@ Google::Cloud::Run.configure do |config|
|
|
100
100
|
config.credentials = "path/to/keyfile.json"
|
101
101
|
end
|
102
102
|
|
103
|
-
client = Google::Cloud::Run.
|
103
|
+
client = Google::Cloud::Run.executions
|
104
104
|
```
|
105
105
|
|
106
106
|
### Cloud SDK
|
@@ -112,7 +112,7 @@ credentials are discovered.
|
|
112
112
|
To configure your system for this, simply:
|
113
113
|
|
114
114
|
1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
|
115
|
-
2. Authenticate using OAuth 2.0 `$ gcloud auth login`
|
115
|
+
2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
|
116
116
|
3. Write code as if already authenticated.
|
117
117
|
|
118
118
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
data/README.md
CHANGED
@@ -34,32 +34,6 @@ 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
|
-
## Enabling Logging
|
38
|
-
|
39
|
-
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
40
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
|
41
|
-
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
42
|
-
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
43
|
-
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
44
|
-
|
45
|
-
Configuring a Ruby stdlib logger:
|
46
|
-
|
47
|
-
```ruby
|
48
|
-
require "logger"
|
49
|
-
|
50
|
-
module MyLogger
|
51
|
-
LOGGER = Logger.new $stderr, level: Logger::WARN
|
52
|
-
def logger
|
53
|
-
LOGGER
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
58
|
-
module GRPC
|
59
|
-
extend MyLogger
|
60
|
-
end
|
61
|
-
```
|
62
|
-
|
63
37
|
## Supported Ruby Versions
|
64
38
|
|
65
39
|
This library is supported on Ruby 2.6+.
|
data/lib/google/cloud/run.rb
CHANGED
@@ -44,16 +44,86 @@ end
|
|
44
44
|
module Google
|
45
45
|
module Cloud
|
46
46
|
module Run
|
47
|
+
##
|
48
|
+
# Create a new client object for Executions.
|
49
|
+
#
|
50
|
+
# By default, this returns an instance of
|
51
|
+
# [Google::Cloud::Run::V2::Executions::Client](https://googleapis.dev/ruby/google-cloud-run-v2/latest/Google/Cloud/Run/V2/Executions/Client.html)
|
52
|
+
# for a gRPC client for version V2 of the API.
|
53
|
+
# However, you can specify a different API version by passing it in the
|
54
|
+
# `version` parameter. If the Executions service is
|
55
|
+
# supported by that API version, and the corresponding gem is available, the
|
56
|
+
# appropriate versioned client will be returned.
|
57
|
+
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
58
|
+
# the `transport` parameter.
|
59
|
+
#
|
60
|
+
# ## About Executions
|
61
|
+
#
|
62
|
+
# Cloud Run Execution Control Plane API.
|
63
|
+
#
|
64
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
65
|
+
# Defaults to `:v2`.
|
66
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
67
|
+
# @return [::Object] A client object for the specified version.
|
68
|
+
#
|
69
|
+
def self.executions version: :v2, transport: :grpc, &block
|
70
|
+
require "google/cloud/run/#{version.to_s.downcase}"
|
71
|
+
|
72
|
+
package_name = Google::Cloud::Run
|
73
|
+
.constants
|
74
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
75
|
+
.first
|
76
|
+
service_module = Google::Cloud::Run.const_get(package_name).const_get(:Executions)
|
77
|
+
service_module = service_module.const_get(:Rest) if transport == :rest
|
78
|
+
service_module.const_get(:Client).new(&block)
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Create a new client object for Jobs.
|
83
|
+
#
|
84
|
+
# By default, this returns an instance of
|
85
|
+
# [Google::Cloud::Run::V2::Jobs::Client](https://googleapis.dev/ruby/google-cloud-run-v2/latest/Google/Cloud/Run/V2/Jobs/Client.html)
|
86
|
+
# for a gRPC client for version V2 of the API.
|
87
|
+
# However, you can specify a different API version by passing it in the
|
88
|
+
# `version` parameter. If the Jobs service is
|
89
|
+
# supported by that API version, and the corresponding gem is available, the
|
90
|
+
# appropriate versioned client will be returned.
|
91
|
+
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
92
|
+
# the `transport` parameter.
|
93
|
+
#
|
94
|
+
# ## About Jobs
|
95
|
+
#
|
96
|
+
# Cloud Run Job Control Plane API.
|
97
|
+
#
|
98
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
99
|
+
# Defaults to `:v2`.
|
100
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
101
|
+
# @return [::Object] A client object for the specified version.
|
102
|
+
#
|
103
|
+
def self.jobs version: :v2, transport: :grpc, &block
|
104
|
+
require "google/cloud/run/#{version.to_s.downcase}"
|
105
|
+
|
106
|
+
package_name = Google::Cloud::Run
|
107
|
+
.constants
|
108
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
109
|
+
.first
|
110
|
+
service_module = Google::Cloud::Run.const_get(package_name).const_get(:Jobs)
|
111
|
+
service_module = service_module.const_get(:Rest) if transport == :rest
|
112
|
+
service_module.const_get(:Client).new(&block)
|
113
|
+
end
|
114
|
+
|
47
115
|
##
|
48
116
|
# Create a new client object for Revisions.
|
49
117
|
#
|
50
118
|
# By default, this returns an instance of
|
51
119
|
# [Google::Cloud::Run::V2::Revisions::Client](https://googleapis.dev/ruby/google-cloud-run-v2/latest/Google/Cloud/Run/V2/Revisions/Client.html)
|
52
|
-
# for version V2 of the API.
|
53
|
-
# However, you can specify
|
120
|
+
# for a gRPC client for version V2 of the API.
|
121
|
+
# However, you can specify a different API version by passing it in the
|
54
122
|
# `version` parameter. If the Revisions service is
|
55
123
|
# supported by that API version, and the corresponding gem is available, the
|
56
124
|
# appropriate versioned client will be returned.
|
125
|
+
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
126
|
+
# the `transport` parameter.
|
57
127
|
#
|
58
128
|
# ## About Revisions
|
59
129
|
#
|
@@ -61,17 +131,19 @@ module Google
|
|
61
131
|
#
|
62
132
|
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
63
133
|
# Defaults to `:v2`.
|
64
|
-
# @
|
134
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
135
|
+
# @return [::Object] A client object for the specified version.
|
65
136
|
#
|
66
|
-
def self.revisions version: :v2, &block
|
137
|
+
def self.revisions version: :v2, transport: :grpc, &block
|
67
138
|
require "google/cloud/run/#{version.to_s.downcase}"
|
68
139
|
|
69
140
|
package_name = Google::Cloud::Run
|
70
141
|
.constants
|
71
142
|
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
72
143
|
.first
|
73
|
-
|
74
|
-
|
144
|
+
service_module = Google::Cloud::Run.const_get(package_name).const_get(:Revisions)
|
145
|
+
service_module = service_module.const_get(:Rest) if transport == :rest
|
146
|
+
service_module.const_get(:Client).new(&block)
|
75
147
|
end
|
76
148
|
|
77
149
|
##
|
@@ -79,11 +151,13 @@ module Google
|
|
79
151
|
#
|
80
152
|
# By default, this returns an instance of
|
81
153
|
# [Google::Cloud::Run::V2::Services::Client](https://googleapis.dev/ruby/google-cloud-run-v2/latest/Google/Cloud/Run/V2/Services/Client.html)
|
82
|
-
# for version V2 of the API.
|
83
|
-
# However, you can specify
|
154
|
+
# for a gRPC client for version V2 of the API.
|
155
|
+
# However, you can specify a different API version by passing it in the
|
84
156
|
# `version` parameter. If the Services service is
|
85
157
|
# supported by that API version, and the corresponding gem is available, the
|
86
158
|
# appropriate versioned client will be returned.
|
159
|
+
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
160
|
+
# the `transport` parameter.
|
87
161
|
#
|
88
162
|
# ## About Services
|
89
163
|
#
|
@@ -91,17 +165,53 @@ module Google
|
|
91
165
|
#
|
92
166
|
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
93
167
|
# Defaults to `:v2`.
|
94
|
-
# @
|
168
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
169
|
+
# @return [::Object] A client object for the specified version.
|
170
|
+
#
|
171
|
+
def self.services version: :v2, transport: :grpc, &block
|
172
|
+
require "google/cloud/run/#{version.to_s.downcase}"
|
173
|
+
|
174
|
+
package_name = Google::Cloud::Run
|
175
|
+
.constants
|
176
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
177
|
+
.first
|
178
|
+
service_module = Google::Cloud::Run.const_get(package_name).const_get(:Services)
|
179
|
+
service_module = service_module.const_get(:Rest) if transport == :rest
|
180
|
+
service_module.const_get(:Client).new(&block)
|
181
|
+
end
|
182
|
+
|
183
|
+
##
|
184
|
+
# Create a new client object for Tasks.
|
185
|
+
#
|
186
|
+
# By default, this returns an instance of
|
187
|
+
# [Google::Cloud::Run::V2::Tasks::Client](https://googleapis.dev/ruby/google-cloud-run-v2/latest/Google/Cloud/Run/V2/Tasks/Client.html)
|
188
|
+
# for a gRPC client for version V2 of the API.
|
189
|
+
# However, you can specify a different API version by passing it in the
|
190
|
+
# `version` parameter. If the Tasks service is
|
191
|
+
# supported by that API version, and the corresponding gem is available, the
|
192
|
+
# appropriate versioned client will be returned.
|
193
|
+
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
194
|
+
# the `transport` parameter.
|
195
|
+
#
|
196
|
+
# ## About Tasks
|
197
|
+
#
|
198
|
+
# Cloud Run Task Control Plane API.
|
199
|
+
#
|
200
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
201
|
+
# Defaults to `:v2`.
|
202
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
203
|
+
# @return [::Object] A client object for the specified version.
|
95
204
|
#
|
96
|
-
def self.
|
205
|
+
def self.tasks version: :v2, transport: :grpc, &block
|
97
206
|
require "google/cloud/run/#{version.to_s.downcase}"
|
98
207
|
|
99
208
|
package_name = Google::Cloud::Run
|
100
209
|
.constants
|
101
210
|
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
102
211
|
.first
|
103
|
-
|
104
|
-
|
212
|
+
service_module = Google::Cloud::Run.const_get(package_name).const_get(:Tasks)
|
213
|
+
service_module = service_module.const_get(:Rest) if transport == :rest
|
214
|
+
service_module.const_get(:Client).new(&block)
|
105
215
|
end
|
106
216
|
|
107
217
|
##
|
@@ -121,7 +231,7 @@ module Google
|
|
121
231
|
# * `timeout` (*type:* `Numeric`) -
|
122
232
|
# Default timeout in seconds.
|
123
233
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) -
|
124
|
-
# Additional
|
234
|
+
# Additional headers to be sent with the call.
|
125
235
|
# * `retry_policy` (*type:* `Hash`) -
|
126
236
|
# The retry policy. The value is a hash with the following keys:
|
127
237
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-run-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.7'
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: 2.a
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0.
|
43
|
+
version: '0.7'
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 2.a
|
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
192
|
+
rubygems_version: 3.4.2
|
193
193
|
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: API Client library for the Cloud Run API
|