google-cloud-run-v2 0.16.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +4 -4
- data/README.md +3 -3
- data/lib/google/cloud/run/v2/build_pb.rb +53 -0
- data/lib/google/cloud/run/v2/build_services_pb.rb +45 -0
- data/lib/google/cloud/run/v2/builds/client.rb +463 -0
- data/lib/google/cloud/run/v2/builds/credentials.rb +47 -0
- data/lib/google/cloud/run/v2/builds/paths.rb +52 -0
- data/lib/google/cloud/run/v2/builds/rest/client.rb +430 -0
- data/lib/google/cloud/run/v2/builds/rest/service_stub.rb +129 -0
- data/lib/google/cloud/run/v2/builds/rest.rb +52 -0
- data/lib/google/cloud/run/v2/builds.rb +55 -0
- data/lib/google/cloud/run/v2/job_pb.rb +2 -1
- data/lib/google/cloud/run/v2/jobs/paths.rb +33 -0
- data/lib/google/cloud/run/v2/rest.rb +2 -1
- data/lib/google/cloud/run/v2/revision_pb.rb +1 -1
- data/lib/google/cloud/run/v2/revision_template_pb.rb +1 -1
- data/lib/google/cloud/run/v2/service_pb.rb +1 -1
- data/lib/google/cloud/run/v2/services/paths.rb +52 -0
- data/lib/google/cloud/run/v2/vendor_settings_pb.rb +4 -1
- data/lib/google/cloud/run/v2/version.rb +1 -1
- data/lib/google/cloud/run/v2.rb +3 -2
- data/proto_docs/google/cloud/run/v2/build.rb +149 -0
- data/proto_docs/google/cloud/run/v2/revision.rb +6 -0
- data/proto_docs/google/cloud/run/v2/revision_template.rb +8 -1
- data/proto_docs/google/cloud/run/v2/service.rb +14 -7
- data/proto_docs/google/cloud/run/v2/vendor_settings.rb +47 -5
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa21d7b8070e8594c9f64847515cc2ad8850b370bcee6a18610b84a866c61d25
|
4
|
+
data.tar.gz: f07f58968ce387b81a947b4d8742f1256ee4e04b09c704c33faee37cd3ed5792
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec996c2b395ef47c193f37b7b8dc9c4ac4989aa253e6499e0570221c7c1092197da9b0a0dca24e20b0913bd2673921feacd0156cb65c9367b167c524c4d88703
|
7
|
+
data.tar.gz: 8a1cb7af64000cd8be5cba0403006c8f977f1d425d3d7705ef909e8e060bd28fa3ccbd756c10de02b107fffafe01032e503876cc89f7ae29dcd60a945cbe058c
|
data/AUTHENTICATION.md
CHANGED
@@ -56,7 +56,7 @@ To configure a credentials file for an individual client initialization:
|
|
56
56
|
```ruby
|
57
57
|
require "google/cloud/run/v2"
|
58
58
|
|
59
|
-
client = ::Google::Cloud::Run::V2::
|
59
|
+
client = ::Google::Cloud::Run::V2::Builds::Client.new do |config|
|
60
60
|
config.credentials = "path/to/credentialfile.json"
|
61
61
|
end
|
62
62
|
```
|
@@ -66,11 +66,11 @@ To configure a credentials file globally for all clients:
|
|
66
66
|
```ruby
|
67
67
|
require "google/cloud/run/v2"
|
68
68
|
|
69
|
-
::Google::Cloud::Run::V2::
|
69
|
+
::Google::Cloud::Run::V2::Builds::Client.configure do |config|
|
70
70
|
config.credentials = "path/to/credentialfile.json"
|
71
71
|
end
|
72
72
|
|
73
|
-
client = ::Google::Cloud::Run::V2::
|
73
|
+
client = ::Google::Cloud::Run::V2::Builds::Client.new
|
74
74
|
```
|
75
75
|
|
76
76
|
### Environment Variables
|
@@ -100,7 +100,7 @@ require "google/cloud/run/v2"
|
|
100
100
|
|
101
101
|
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
|
102
102
|
|
103
|
-
client = ::Google::Cloud::Run::V2::
|
103
|
+
client = ::Google::Cloud::Run::V2::Builds::Client.new
|
104
104
|
```
|
105
105
|
|
106
106
|
### Local ADC file
|
data/README.md
CHANGED
@@ -32,9 +32,9 @@ In order to use this library, you first need to go through the following steps:
|
|
32
32
|
```ruby
|
33
33
|
require "google/cloud/run/v2"
|
34
34
|
|
35
|
-
client = ::Google::Cloud::Run::V2::
|
36
|
-
request = ::Google::Cloud::Run::V2::
|
37
|
-
response = client.
|
35
|
+
client = ::Google::Cloud::Run::V2::Builds::Client.new
|
36
|
+
request = ::Google::Cloud::Run::V2::SubmitBuildRequest.new # (request fields as keyword arguments...)
|
37
|
+
response = client.submit_build request
|
38
38
|
```
|
39
39
|
|
40
40
|
View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-run-v2/latest)
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: google/cloud/run/v2/build.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'google/api/annotations_pb'
|
8
|
+
require 'google/api/client_pb'
|
9
|
+
require 'google/api/field_behavior_pb'
|
10
|
+
require 'google/api/resource_pb'
|
11
|
+
require 'google/longrunning/operations_pb'
|
12
|
+
|
13
|
+
|
14
|
+
descriptor_data = "\n\x1fgoogle/cloud/run/v2/build.proto\x12\x13google.cloud.run.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\"\x99\x06\n\x12SubmitBuildRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x41\n\x0estorage_source\x18\x02 \x01(\x0b\x32\".google.cloud.run.v2.StorageSourceB\x03\xe0\x41\x02H\x00\x12\x16\n\timage_uri\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12R\n\x0f\x62uildpack_build\x18\x04 \x01(\x0b\x32\x37.google.cloud.run.v2.SubmitBuildRequest.BuildpacksBuildH\x01\x12K\n\x0c\x64ocker_build\x18\x05 \x01(\x0b\x32\x33.google.cloud.run.v2.SubmitBuildRequest.DockerBuildH\x01\x12\x1c\n\x0fservice_account\x18\x06 \x01(\tB\x03\xe0\x41\x01\x12\x41\n\x0bworker_pool\x18\x07 \x01(\tB,\xe0\x41\x01\xfa\x41&\n$cloudbuild.googleapis.com/WorkerPool\x12\x11\n\x04tags\x18\x08 \x03(\tB\x03\xe0\x41\x01\x1a\r\n\x0b\x44ockerBuild\x1a\xd6\x02\n\x0f\x42uildpacksBuild\x12\x13\n\x07runtime\x18\x01 \x01(\tB\x02\x18\x01\x12\x1c\n\x0f\x66unction_target\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x1c\n\x0f\x63\x61\x63he_image_uri\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x17\n\nbase_image\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12u\n\x15\x65nvironment_variables\x18\x05 \x03(\x0b\x32Q.google.cloud.run.v2.SubmitBuildRequest.BuildpacksBuild.EnvironmentVariablesEntryB\x03\xe0\x41\x01\x12%\n\x18\x65nable_automatic_updates\x18\x06 \x01(\x08\x42\x03\xe0\x41\x01\x1a;\n\x19\x45nvironmentVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x08\n\x06sourceB\x0c\n\nbuild_type\"\x81\x01\n\x13SubmitBuildResponse\x12\x36\n\x0f\x62uild_operation\x18\x01 \x01(\x0b\x32\x1d.google.longrunning.Operation\x12\x16\n\x0e\x62\x61se_image_uri\x18\x02 \x01(\t\x12\x1a\n\x12\x62\x61se_image_warning\x18\x03 \x01(\t\"R\n\rStorageSource\x12\x13\n\x06\x62ucket\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x13\n\x06object\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\ngeneration\x18\x03 \x01(\x03\x42\x03\xe0\x41\x01\x32\xf1\x01\n\x06\x42uilds\x12\x9e\x01\n\x0bSubmitBuild\x12\'.google.cloud.run.v2.SubmitBuildRequest\x1a(.google.cloud.run.v2.SubmitBuildResponse\"<\x82\xd3\xe4\x93\x02\x36\"1/v2/{parent=projects/*/locations/*}/builds:submit:\x01*\x1a\x46\xca\x41\x12run.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xbe\x01\n\x17\x63om.google.cloud.run.v2B\nBuildProtoP\x01Z)cloud.google.com/go/run/apiv2/runpb;runpb\xea\x41i\n$cloudbuild.googleapis.com/WorkerPool\x12\x41projects/{project}/locations/{location}/workerPools/{worker_pool}b\x06proto3"
|
15
|
+
|
16
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
17
|
+
|
18
|
+
begin
|
19
|
+
pool.add_serialized_file(descriptor_data)
|
20
|
+
rescue TypeError
|
21
|
+
# Compatibility code: will be removed in the next major version.
|
22
|
+
require 'google/protobuf/descriptor_pb'
|
23
|
+
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
24
|
+
parsed.clear_dependency
|
25
|
+
serialized = parsed.class.encode(parsed)
|
26
|
+
file = pool.add_serialized_file(serialized)
|
27
|
+
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
28
|
+
imports = [
|
29
|
+
["google.longrunning.Operation", "google/longrunning/operations.proto"],
|
30
|
+
]
|
31
|
+
imports.each do |type_name, expected_filename|
|
32
|
+
import_file = pool.lookup(type_name).file_descriptor
|
33
|
+
if import_file.name != expected_filename
|
34
|
+
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
warn "Each proto file must use a consistent fully-qualified name."
|
38
|
+
warn "This will become an error in the next major version."
|
39
|
+
end
|
40
|
+
|
41
|
+
module Google
|
42
|
+
module Cloud
|
43
|
+
module Run
|
44
|
+
module V2
|
45
|
+
SubmitBuildRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.run.v2.SubmitBuildRequest").msgclass
|
46
|
+
SubmitBuildRequest::DockerBuild = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.run.v2.SubmitBuildRequest.DockerBuild").msgclass
|
47
|
+
SubmitBuildRequest::BuildpacksBuild = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.run.v2.SubmitBuildRequest.BuildpacksBuild").msgclass
|
48
|
+
SubmitBuildResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.run.v2.SubmitBuildResponse").msgclass
|
49
|
+
StorageSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.run.v2.StorageSource").msgclass
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/run/v2/build.proto for package 'google.cloud.run.v2'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2024 Google LLC
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'grpc'
|
20
|
+
require 'google/cloud/run/v2/build_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Run
|
25
|
+
module V2
|
26
|
+
module Builds
|
27
|
+
# Cloud Run Build Control Plane API
|
28
|
+
class Service
|
29
|
+
|
30
|
+
include ::GRPC::GenericService
|
31
|
+
|
32
|
+
self.marshal_class_method = :encode
|
33
|
+
self.unmarshal_class_method = :decode
|
34
|
+
self.service_name = 'google.cloud.run.v2.Builds'
|
35
|
+
|
36
|
+
# Submits a build in a given project.
|
37
|
+
rpc :SubmitBuild, ::Google::Cloud::Run::V2::SubmitBuildRequest, ::Google::Cloud::Run::V2::SubmitBuildResponse
|
38
|
+
end
|
39
|
+
|
40
|
+
Stub = Service.rpc_stub_class
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,463 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/build_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Run
|
26
|
+
module V2
|
27
|
+
module Builds
|
28
|
+
##
|
29
|
+
# Client for the Builds service.
|
30
|
+
#
|
31
|
+
# Cloud Run Build Control Plane API
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
# @private
|
35
|
+
API_VERSION = ""
|
36
|
+
|
37
|
+
# @private
|
38
|
+
DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
|
39
|
+
|
40
|
+
include Paths
|
41
|
+
|
42
|
+
# @private
|
43
|
+
attr_reader :builds_stub
|
44
|
+
|
45
|
+
##
|
46
|
+
# Configure the Builds Client class.
|
47
|
+
#
|
48
|
+
# See {::Google::Cloud::Run::V2::Builds::Client::Configuration}
|
49
|
+
# for a description of the configuration fields.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
#
|
53
|
+
# # Modify the configuration for all Builds clients
|
54
|
+
# ::Google::Cloud::Run::V2::Builds::Client.configure do |config|
|
55
|
+
# config.timeout = 10.0
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# @yield [config] Configure the Client client.
|
59
|
+
# @yieldparam config [Client::Configuration]
|
60
|
+
#
|
61
|
+
# @return [Client::Configuration]
|
62
|
+
#
|
63
|
+
def self.configure
|
64
|
+
@configure ||= begin
|
65
|
+
namespace = ["Google", "Cloud", "Run", "V2"]
|
66
|
+
parent_config = while namespace.any?
|
67
|
+
parent_name = namespace.join "::"
|
68
|
+
parent_const = const_get parent_name
|
69
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
70
|
+
namespace.pop
|
71
|
+
end
|
72
|
+
default_config = Client::Configuration.new parent_config
|
73
|
+
|
74
|
+
default_config
|
75
|
+
end
|
76
|
+
yield @configure if block_given?
|
77
|
+
@configure
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Configure the Builds Client instance.
|
82
|
+
#
|
83
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
84
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
85
|
+
# should be made on {Client.configure}.
|
86
|
+
#
|
87
|
+
# See {::Google::Cloud::Run::V2::Builds::Client::Configuration}
|
88
|
+
# for a description of the configuration fields.
|
89
|
+
#
|
90
|
+
# @yield [config] Configure the Client client.
|
91
|
+
# @yieldparam config [Client::Configuration]
|
92
|
+
#
|
93
|
+
# @return [Client::Configuration]
|
94
|
+
#
|
95
|
+
def configure
|
96
|
+
yield @config if block_given?
|
97
|
+
@config
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# The effective universe domain
|
102
|
+
#
|
103
|
+
# @return [String]
|
104
|
+
#
|
105
|
+
def universe_domain
|
106
|
+
@builds_stub.universe_domain
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Create a new Builds client object.
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
#
|
114
|
+
# # Create a client using the default configuration
|
115
|
+
# client = ::Google::Cloud::Run::V2::Builds::Client.new
|
116
|
+
#
|
117
|
+
# # Create a client using a custom configuration
|
118
|
+
# client = ::Google::Cloud::Run::V2::Builds::Client.new do |config|
|
119
|
+
# config.timeout = 10.0
|
120
|
+
# end
|
121
|
+
#
|
122
|
+
# @yield [config] Configure the Builds client.
|
123
|
+
# @yieldparam config [Client::Configuration]
|
124
|
+
#
|
125
|
+
def initialize
|
126
|
+
# These require statements are intentionally placed here to initialize
|
127
|
+
# the gRPC module only when it's required.
|
128
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
129
|
+
require "gapic/grpc"
|
130
|
+
require "google/cloud/run/v2/build_services_pb"
|
131
|
+
|
132
|
+
# Create the configuration object
|
133
|
+
@config = Configuration.new Client.configure
|
134
|
+
|
135
|
+
# Yield the configuration if needed
|
136
|
+
yield @config if block_given?
|
137
|
+
|
138
|
+
# Create credentials
|
139
|
+
credentials = @config.credentials
|
140
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
141
|
+
# but only if the default endpoint does not have a region prefix.
|
142
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
143
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
144
|
+
!@config.endpoint.split(".").first.include?("-"))
|
145
|
+
credentials ||= Credentials.default scope: @config.scope,
|
146
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
147
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
148
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
149
|
+
end
|
150
|
+
@quota_project_id = @config.quota_project
|
151
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
152
|
+
|
153
|
+
@builds_stub = ::Gapic::ServiceStub.new(
|
154
|
+
::Google::Cloud::Run::V2::Builds::Stub,
|
155
|
+
credentials: credentials,
|
156
|
+
endpoint: @config.endpoint,
|
157
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
158
|
+
universe_domain: @config.universe_domain,
|
159
|
+
channel_args: @config.channel_args,
|
160
|
+
interceptors: @config.interceptors,
|
161
|
+
channel_pool_config: @config.channel_pool
|
162
|
+
)
|
163
|
+
|
164
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
165
|
+
config.credentials = credentials
|
166
|
+
config.quota_project = @quota_project_id
|
167
|
+
config.endpoint = @builds_stub.endpoint
|
168
|
+
config.universe_domain = @builds_stub.universe_domain
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
##
|
173
|
+
# Get the associated client for mix-in of the Locations.
|
174
|
+
#
|
175
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
176
|
+
#
|
177
|
+
attr_reader :location_client
|
178
|
+
|
179
|
+
# Service calls
|
180
|
+
|
181
|
+
##
|
182
|
+
# Submits a build in a given project.
|
183
|
+
#
|
184
|
+
# @overload submit_build(request, options = nil)
|
185
|
+
# Pass arguments to `submit_build` via a request object, either of type
|
186
|
+
# {::Google::Cloud::Run::V2::SubmitBuildRequest} or an equivalent Hash.
|
187
|
+
#
|
188
|
+
# @param request [::Google::Cloud::Run::V2::SubmitBuildRequest, ::Hash]
|
189
|
+
# A request object representing the call parameters. Required. To specify no
|
190
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
191
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
192
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
193
|
+
#
|
194
|
+
# @overload submit_build(parent: nil, storage_source: nil, image_uri: nil, buildpack_build: nil, docker_build: nil, service_account: nil, worker_pool: nil, tags: nil)
|
195
|
+
# Pass arguments to `submit_build` via keyword arguments. Note that at
|
196
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
197
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
198
|
+
#
|
199
|
+
# @param parent [::String]
|
200
|
+
# Required. The project and location to build in. Location must be a region,
|
201
|
+
# e.g., 'us-central1' or 'global' if the global builder is to be used.
|
202
|
+
# Format:
|
203
|
+
# `projects/{project}/locations/{location}`
|
204
|
+
# @param storage_source [::Google::Cloud::Run::V2::StorageSource, ::Hash]
|
205
|
+
# Required. Source for the build.
|
206
|
+
# @param image_uri [::String]
|
207
|
+
# Required. Artifact Registry URI to store the built image.
|
208
|
+
# @param buildpack_build [::Google::Cloud::Run::V2::SubmitBuildRequest::BuildpacksBuild, ::Hash]
|
209
|
+
# Build the source using Buildpacks.
|
210
|
+
# @param docker_build [::Google::Cloud::Run::V2::SubmitBuildRequest::DockerBuild, ::Hash]
|
211
|
+
# Build the source using Docker. This means the source has a Dockerfile.
|
212
|
+
# @param service_account [::String]
|
213
|
+
# Optional. The service account to use for the build. If not set, the default
|
214
|
+
# Cloud Build service account for the project will be used.
|
215
|
+
# @param worker_pool [::String]
|
216
|
+
# Optional. Name of the Cloud Build Custom Worker Pool that should be used to
|
217
|
+
# build the function. The format of this field is
|
218
|
+
# `projects/{project}/locations/{region}/workerPools/{workerPool}` where
|
219
|
+
# `{project}` and `{region}` are the project id and region respectively where
|
220
|
+
# the worker pool is defined and `{workerPool}` is the short name of the
|
221
|
+
# worker pool.
|
222
|
+
# @param tags [::Array<::String>]
|
223
|
+
# Optional. Additional tags to annotate the build.
|
224
|
+
#
|
225
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
226
|
+
# @yieldparam response [::Google::Cloud::Run::V2::SubmitBuildResponse]
|
227
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
228
|
+
#
|
229
|
+
# @return [::Google::Cloud::Run::V2::SubmitBuildResponse]
|
230
|
+
#
|
231
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
232
|
+
#
|
233
|
+
# @example Basic example
|
234
|
+
# require "google/cloud/run/v2"
|
235
|
+
#
|
236
|
+
# # Create a client object. The client can be reused for multiple calls.
|
237
|
+
# client = Google::Cloud::Run::V2::Builds::Client.new
|
238
|
+
#
|
239
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
240
|
+
# request = Google::Cloud::Run::V2::SubmitBuildRequest.new
|
241
|
+
#
|
242
|
+
# # Call the submit_build method.
|
243
|
+
# result = client.submit_build request
|
244
|
+
#
|
245
|
+
# # The returned object is of type Google::Cloud::Run::V2::SubmitBuildResponse.
|
246
|
+
# p result
|
247
|
+
#
|
248
|
+
def submit_build request, options = nil
|
249
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
250
|
+
|
251
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::SubmitBuildRequest
|
252
|
+
|
253
|
+
# Converts hash and nil to an options object
|
254
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
255
|
+
|
256
|
+
# Customize the options with defaults
|
257
|
+
metadata = @config.rpcs.submit_build.metadata.to_h
|
258
|
+
|
259
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
260
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
261
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
262
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
263
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
264
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
265
|
+
|
266
|
+
header_params = {}
|
267
|
+
if request.parent
|
268
|
+
header_params["parent"] = request.parent
|
269
|
+
end
|
270
|
+
|
271
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
272
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
273
|
+
|
274
|
+
options.apply_defaults timeout: @config.rpcs.submit_build.timeout,
|
275
|
+
metadata: metadata,
|
276
|
+
retry_policy: @config.rpcs.submit_build.retry_policy
|
277
|
+
|
278
|
+
options.apply_defaults timeout: @config.timeout,
|
279
|
+
metadata: @config.metadata,
|
280
|
+
retry_policy: @config.retry_policy
|
281
|
+
|
282
|
+
@builds_stub.call_rpc :submit_build, request, options: options do |response, operation|
|
283
|
+
yield response, operation if block_given?
|
284
|
+
return response
|
285
|
+
end
|
286
|
+
rescue ::GRPC::BadStatus => e
|
287
|
+
raise ::Google::Cloud::Error.from_error(e)
|
288
|
+
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# Configuration class for the Builds API.
|
292
|
+
#
|
293
|
+
# This class represents the configuration for Builds,
|
294
|
+
# providing control over timeouts, retry behavior, logging, transport
|
295
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
296
|
+
# applied individually to specific RPCs. See
|
297
|
+
# {::Google::Cloud::Run::V2::Builds::Client::Configuration::Rpcs}
|
298
|
+
# for a list of RPCs that can be configured independently.
|
299
|
+
#
|
300
|
+
# Configuration can be applied globally to all clients, or to a single client
|
301
|
+
# on construction.
|
302
|
+
#
|
303
|
+
# @example
|
304
|
+
#
|
305
|
+
# # Modify the global config, setting the timeout for
|
306
|
+
# # submit_build to 20 seconds,
|
307
|
+
# # and all remaining timeouts to 10 seconds.
|
308
|
+
# ::Google::Cloud::Run::V2::Builds::Client.configure do |config|
|
309
|
+
# config.timeout = 10.0
|
310
|
+
# config.rpcs.submit_build.timeout = 20.0
|
311
|
+
# end
|
312
|
+
#
|
313
|
+
# # Apply the above configuration only to a new client.
|
314
|
+
# client = ::Google::Cloud::Run::V2::Builds::Client.new do |config|
|
315
|
+
# config.timeout = 10.0
|
316
|
+
# config.rpcs.submit_build.timeout = 20.0
|
317
|
+
# end
|
318
|
+
#
|
319
|
+
# @!attribute [rw] endpoint
|
320
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
321
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
322
|
+
# @return [::String,nil]
|
323
|
+
# @!attribute [rw] credentials
|
324
|
+
# Credentials to send with calls. You may provide any of the following types:
|
325
|
+
# * (`String`) The path to a service account key file in JSON format
|
326
|
+
# * (`Hash`) A service account key as a Hash
|
327
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
328
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
329
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
330
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
331
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
332
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
333
|
+
# * (`nil`) indicating no credentials
|
334
|
+
# @return [::Object]
|
335
|
+
# @!attribute [rw] scope
|
336
|
+
# The OAuth scopes
|
337
|
+
# @return [::Array<::String>]
|
338
|
+
# @!attribute [rw] lib_name
|
339
|
+
# The library name as recorded in instrumentation and logging
|
340
|
+
# @return [::String]
|
341
|
+
# @!attribute [rw] lib_version
|
342
|
+
# The library version as recorded in instrumentation and logging
|
343
|
+
# @return [::String]
|
344
|
+
# @!attribute [rw] channel_args
|
345
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
346
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
347
|
+
# @return [::Hash]
|
348
|
+
# @!attribute [rw] interceptors
|
349
|
+
# An array of interceptors that are run before calls are executed.
|
350
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
351
|
+
# @!attribute [rw] timeout
|
352
|
+
# The call timeout in seconds.
|
353
|
+
# @return [::Numeric]
|
354
|
+
# @!attribute [rw] metadata
|
355
|
+
# Additional gRPC headers to be sent with the call.
|
356
|
+
# @return [::Hash{::Symbol=>::String}]
|
357
|
+
# @!attribute [rw] retry_policy
|
358
|
+
# The retry policy. The value is a hash with the following keys:
|
359
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
360
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
361
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
362
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
363
|
+
# trigger a retry.
|
364
|
+
# @return [::Hash]
|
365
|
+
# @!attribute [rw] quota_project
|
366
|
+
# A separate project against which to charge quota.
|
367
|
+
# @return [::String]
|
368
|
+
# @!attribute [rw] universe_domain
|
369
|
+
# The universe domain within which to make requests. This determines the
|
370
|
+
# default endpoint URL. The default value of nil uses the environment
|
371
|
+
# universe (usually the default "googleapis.com" universe).
|
372
|
+
# @return [::String,nil]
|
373
|
+
#
|
374
|
+
class Configuration
|
375
|
+
extend ::Gapic::Config
|
376
|
+
|
377
|
+
# @private
|
378
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
379
|
+
DEFAULT_ENDPOINT = "run.googleapis.com"
|
380
|
+
|
381
|
+
config_attr :endpoint, nil, ::String, nil
|
382
|
+
config_attr :credentials, nil do |value|
|
383
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
384
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
385
|
+
allowed.any? { |klass| klass === value }
|
386
|
+
end
|
387
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
388
|
+
config_attr :lib_name, nil, ::String, nil
|
389
|
+
config_attr :lib_version, nil, ::String, nil
|
390
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
391
|
+
config_attr :interceptors, nil, ::Array, nil
|
392
|
+
config_attr :timeout, nil, ::Numeric, nil
|
393
|
+
config_attr :metadata, nil, ::Hash, nil
|
394
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
395
|
+
config_attr :quota_project, nil, ::String, nil
|
396
|
+
config_attr :universe_domain, nil, ::String, nil
|
397
|
+
|
398
|
+
# @private
|
399
|
+
def initialize parent_config = nil
|
400
|
+
@parent_config = parent_config unless parent_config.nil?
|
401
|
+
|
402
|
+
yield self if block_given?
|
403
|
+
end
|
404
|
+
|
405
|
+
##
|
406
|
+
# Configurations for individual RPCs
|
407
|
+
# @return [Rpcs]
|
408
|
+
#
|
409
|
+
def rpcs
|
410
|
+
@rpcs ||= begin
|
411
|
+
parent_rpcs = nil
|
412
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
413
|
+
Rpcs.new parent_rpcs
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
##
|
418
|
+
# Configuration for the channel pool
|
419
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
420
|
+
#
|
421
|
+
def channel_pool
|
422
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
423
|
+
end
|
424
|
+
|
425
|
+
##
|
426
|
+
# Configuration RPC class for the Builds API.
|
427
|
+
#
|
428
|
+
# Includes fields providing the configuration for each RPC in this service.
|
429
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
430
|
+
# the following configuration fields:
|
431
|
+
#
|
432
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
433
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
434
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
435
|
+
# include the following keys:
|
436
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
437
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
438
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
439
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
440
|
+
# trigger a retry.
|
441
|
+
#
|
442
|
+
class Rpcs
|
443
|
+
##
|
444
|
+
# RPC-specific configuration for `submit_build`
|
445
|
+
# @return [::Gapic::Config::Method]
|
446
|
+
#
|
447
|
+
attr_reader :submit_build
|
448
|
+
|
449
|
+
# @private
|
450
|
+
def initialize parent_rpcs = nil
|
451
|
+
submit_build_config = parent_rpcs.submit_build if parent_rpcs.respond_to? :submit_build
|
452
|
+
@submit_build = ::Gapic::Config::Method.new submit_build_config
|
453
|
+
|
454
|
+
yield self if block_given?
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
end
|
460
|
+
end
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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 Builds
|
26
|
+
# Credentials for the Builds API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
33
|
+
"GOOGLE_CLOUD_KEYFILE",
|
34
|
+
"GCLOUD_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
37
|
+
"GCLOUD_KEYFILE_JSON"
|
38
|
+
]
|
39
|
+
self.paths = [
|
40
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
41
|
+
]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|