google-cloud-confidential_computing-v1 0.a → 0.2.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/.yardopts +12 -0
- data/AUTHENTICATION.md +149 -0
- data/README.md +144 -8
- data/lib/google/cloud/confidential_computing/v1/bindings_override.rb +102 -0
- data/lib/google/cloud/confidential_computing/v1/confidential_computing/client.rb +519 -0
- data/lib/google/cloud/confidential_computing/v1/confidential_computing/credentials.rb +47 -0
- data/lib/google/cloud/confidential_computing/v1/confidential_computing/paths.rb +69 -0
- data/lib/google/cloud/confidential_computing/v1/confidential_computing/rest/client.rb +461 -0
- data/lib/google/cloud/confidential_computing/v1/confidential_computing/rest/service_stub.rb +168 -0
- data/lib/google/cloud/confidential_computing/v1/confidential_computing/rest.rb +53 -0
- data/lib/google/cloud/confidential_computing/v1/confidential_computing.rb +55 -0
- data/lib/google/cloud/confidential_computing/v1/rest.rb +38 -0
- data/lib/google/cloud/confidential_computing/v1/version.rb +7 -2
- data/lib/google/cloud/confidential_computing/v1.rb +45 -0
- data/lib/google/cloud/confidentialcomputing/v1/service_pb.rb +55 -0
- data/lib/google/cloud/confidentialcomputing/v1/service_services_pb.rb +47 -0
- data/lib/google-cloud-confidential_computing-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +381 -0
- data/proto_docs/google/api/field_behavior.rb +71 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +222 -0
- data/proto_docs/google/cloud/confidentialcomputing/v1/service.rb +159 -0
- data/proto_docs/google/protobuf/any.rb +144 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- metadata +202 -12
@@ -0,0 +1,461 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/confidentialcomputing/v1/service_pb"
|
21
|
+
require "google/cloud/confidential_computing/v1/confidential_computing/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module ConfidentialComputing
|
27
|
+
module V1
|
28
|
+
module ConfidentialComputing
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the ConfidentialComputing service.
|
32
|
+
#
|
33
|
+
# Service describing handlers for resources
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :confidential_computing_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the ConfidentialComputing Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all ConfidentialComputing clients
|
50
|
+
# ::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @yield [config] Configure the Client client.
|
55
|
+
# @yieldparam config [Client::Configuration]
|
56
|
+
#
|
57
|
+
# @return [Client::Configuration]
|
58
|
+
#
|
59
|
+
def self.configure
|
60
|
+
@configure ||= begin
|
61
|
+
namespace = ["Google", "Cloud", "ConfidentialComputing", "V1"]
|
62
|
+
parent_config = while namespace.any?
|
63
|
+
parent_name = namespace.join "::"
|
64
|
+
parent_const = const_get parent_name
|
65
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
|
+
namespace.pop
|
67
|
+
end
|
68
|
+
default_config = Client::Configuration.new parent_config
|
69
|
+
|
70
|
+
default_config.timeout = 60.0
|
71
|
+
|
72
|
+
default_config.rpcs.create_challenge.timeout = 60.0
|
73
|
+
default_config.rpcs.create_challenge.retry_policy = {
|
74
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
75
|
+
}
|
76
|
+
|
77
|
+
default_config.rpcs.verify_attestation.timeout = 60.0
|
78
|
+
default_config.rpcs.verify_attestation.retry_policy = {
|
79
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
80
|
+
}
|
81
|
+
|
82
|
+
default_config
|
83
|
+
end
|
84
|
+
yield @configure if block_given?
|
85
|
+
@configure
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# Configure the ConfidentialComputing Client instance.
|
90
|
+
#
|
91
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
92
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
93
|
+
# should be made on {Client.configure}.
|
94
|
+
#
|
95
|
+
# See {::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::Client::Configuration}
|
96
|
+
# for a description of the configuration fields.
|
97
|
+
#
|
98
|
+
# @yield [config] Configure the Client client.
|
99
|
+
# @yieldparam config [Client::Configuration]
|
100
|
+
#
|
101
|
+
# @return [Client::Configuration]
|
102
|
+
#
|
103
|
+
def configure
|
104
|
+
yield @config if block_given?
|
105
|
+
@config
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Create a new ConfidentialComputing REST client object.
|
110
|
+
#
|
111
|
+
# @example
|
112
|
+
#
|
113
|
+
# # Create a client using the default configuration
|
114
|
+
# client = ::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::Client.new
|
115
|
+
#
|
116
|
+
# # Create a client using a custom configuration
|
117
|
+
# client = ::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::Client.new do |config|
|
118
|
+
# config.timeout = 10.0
|
119
|
+
# end
|
120
|
+
#
|
121
|
+
# @yield [config] Configure the ConfidentialComputing client.
|
122
|
+
# @yieldparam config [Client::Configuration]
|
123
|
+
#
|
124
|
+
def initialize
|
125
|
+
# Create the configuration object
|
126
|
+
@config = Configuration.new Client.configure
|
127
|
+
|
128
|
+
# Yield the configuration if needed
|
129
|
+
yield @config if block_given?
|
130
|
+
|
131
|
+
# Create credentials
|
132
|
+
credentials = @config.credentials
|
133
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
134
|
+
# but only if the default endpoint does not have a region prefix.
|
135
|
+
enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
136
|
+
!@config.endpoint.split(".").first.include?("-")
|
137
|
+
credentials ||= Credentials.default scope: @config.scope,
|
138
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
139
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
140
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
141
|
+
end
|
142
|
+
|
143
|
+
@quota_project_id = @config.quota_project
|
144
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
145
|
+
|
146
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
147
|
+
config.credentials = credentials
|
148
|
+
config.quota_project = @quota_project_id
|
149
|
+
config.endpoint = @config.endpoint
|
150
|
+
config.bindings_override = @config.bindings_override
|
151
|
+
end
|
152
|
+
|
153
|
+
@confidential_computing_stub = ::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
154
|
+
end
|
155
|
+
|
156
|
+
##
|
157
|
+
# Get the associated client for mix-in of the Locations.
|
158
|
+
#
|
159
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
160
|
+
#
|
161
|
+
attr_reader :location_client
|
162
|
+
|
163
|
+
# Service calls
|
164
|
+
|
165
|
+
##
|
166
|
+
# Creates a new Challenge in a given project and location.
|
167
|
+
#
|
168
|
+
# @overload create_challenge(request, options = nil)
|
169
|
+
# Pass arguments to `create_challenge` via a request object, either of type
|
170
|
+
# {::Google::Cloud::ConfidentialComputing::V1::CreateChallengeRequest} or an equivalent Hash.
|
171
|
+
#
|
172
|
+
# @param request [::Google::Cloud::ConfidentialComputing::V1::CreateChallengeRequest, ::Hash]
|
173
|
+
# A request object representing the call parameters. Required. To specify no
|
174
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
175
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
176
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
177
|
+
#
|
178
|
+
# @overload create_challenge(parent: nil, challenge: nil)
|
179
|
+
# Pass arguments to `create_challenge` via keyword arguments. Note that at
|
180
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
181
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
182
|
+
#
|
183
|
+
# @param parent [::String]
|
184
|
+
# Required. The resource name of the location where the Challenge will be
|
185
|
+
# used, in the format `projects/*/locations/*`.
|
186
|
+
# @param challenge [::Google::Cloud::ConfidentialComputing::V1::Challenge, ::Hash]
|
187
|
+
# Required. The Challenge to be created. Currently this field can be empty as
|
188
|
+
# all the Challenge fields are set by the server.
|
189
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
190
|
+
# @yieldparam result [::Google::Cloud::ConfidentialComputing::V1::Challenge]
|
191
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
192
|
+
#
|
193
|
+
# @return [::Google::Cloud::ConfidentialComputing::V1::Challenge]
|
194
|
+
#
|
195
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
196
|
+
def create_challenge request, options = nil
|
197
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
198
|
+
|
199
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ConfidentialComputing::V1::CreateChallengeRequest
|
200
|
+
|
201
|
+
# Converts hash and nil to an options object
|
202
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
203
|
+
|
204
|
+
# Customize the options with defaults
|
205
|
+
call_metadata = @config.rpcs.create_challenge.metadata.to_h
|
206
|
+
|
207
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
208
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
209
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
210
|
+
gapic_version: ::Google::Cloud::ConfidentialComputing::V1::VERSION,
|
211
|
+
transports_version_send: [:rest]
|
212
|
+
|
213
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
214
|
+
|
215
|
+
options.apply_defaults timeout: @config.rpcs.create_challenge.timeout,
|
216
|
+
metadata: call_metadata,
|
217
|
+
retry_policy: @config.rpcs.create_challenge.retry_policy
|
218
|
+
|
219
|
+
options.apply_defaults timeout: @config.timeout,
|
220
|
+
metadata: @config.metadata,
|
221
|
+
retry_policy: @config.retry_policy
|
222
|
+
|
223
|
+
@confidential_computing_stub.create_challenge request, options do |result, operation|
|
224
|
+
yield result, operation if block_given?
|
225
|
+
return result
|
226
|
+
end
|
227
|
+
rescue ::Gapic::Rest::Error => e
|
228
|
+
raise ::Google::Cloud::Error.from_error(e)
|
229
|
+
end
|
230
|
+
|
231
|
+
##
|
232
|
+
# Verifies the provided attestation info, returning a signed OIDC token.
|
233
|
+
#
|
234
|
+
# @overload verify_attestation(request, options = nil)
|
235
|
+
# Pass arguments to `verify_attestation` via a request object, either of type
|
236
|
+
# {::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationRequest} or an equivalent Hash.
|
237
|
+
#
|
238
|
+
# @param request [::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationRequest, ::Hash]
|
239
|
+
# A request object representing the call parameters. Required. To specify no
|
240
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
241
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
242
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
243
|
+
#
|
244
|
+
# @overload verify_attestation(challenge: nil, gcp_credentials: nil, tpm_attestation: nil)
|
245
|
+
# Pass arguments to `verify_attestation` via keyword arguments. Note that at
|
246
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
247
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
248
|
+
#
|
249
|
+
# @param challenge [::String]
|
250
|
+
# Required. The name of the Challenge whose nonce was used to generate the
|
251
|
+
# attestation, in the format `projects/*/locations/*/challenges/*`. The
|
252
|
+
# provided Challenge will be consumed, and cannot be used again.
|
253
|
+
# @param gcp_credentials [::Google::Cloud::ConfidentialComputing::V1::GcpCredentials, ::Hash]
|
254
|
+
# Optional. Credentials used to populate the "emails" claim in the
|
255
|
+
# claims_token.
|
256
|
+
# @param tpm_attestation [::Google::Cloud::ConfidentialComputing::V1::TpmAttestation, ::Hash]
|
257
|
+
# Required. The TPM-specific data provided by the attesting platform, used to
|
258
|
+
# populate any of the claims regarding platform state.
|
259
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
260
|
+
# @yieldparam result [::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationResponse]
|
261
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
262
|
+
#
|
263
|
+
# @return [::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationResponse]
|
264
|
+
#
|
265
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
266
|
+
def verify_attestation request, options = nil
|
267
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
268
|
+
|
269
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationRequest
|
270
|
+
|
271
|
+
# Converts hash and nil to an options object
|
272
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
273
|
+
|
274
|
+
# Customize the options with defaults
|
275
|
+
call_metadata = @config.rpcs.verify_attestation.metadata.to_h
|
276
|
+
|
277
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
278
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
279
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
280
|
+
gapic_version: ::Google::Cloud::ConfidentialComputing::V1::VERSION,
|
281
|
+
transports_version_send: [:rest]
|
282
|
+
|
283
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
284
|
+
|
285
|
+
options.apply_defaults timeout: @config.rpcs.verify_attestation.timeout,
|
286
|
+
metadata: call_metadata,
|
287
|
+
retry_policy: @config.rpcs.verify_attestation.retry_policy
|
288
|
+
|
289
|
+
options.apply_defaults timeout: @config.timeout,
|
290
|
+
metadata: @config.metadata,
|
291
|
+
retry_policy: @config.retry_policy
|
292
|
+
|
293
|
+
@confidential_computing_stub.verify_attestation request, options do |result, operation|
|
294
|
+
yield result, operation if block_given?
|
295
|
+
return result
|
296
|
+
end
|
297
|
+
rescue ::Gapic::Rest::Error => e
|
298
|
+
raise ::Google::Cloud::Error.from_error(e)
|
299
|
+
end
|
300
|
+
|
301
|
+
##
|
302
|
+
# Configuration class for the ConfidentialComputing REST API.
|
303
|
+
#
|
304
|
+
# This class represents the configuration for ConfidentialComputing REST,
|
305
|
+
# providing control over timeouts, retry behavior, logging, transport
|
306
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
307
|
+
# applied individually to specific RPCs. See
|
308
|
+
# {::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::Client::Configuration::Rpcs}
|
309
|
+
# for a list of RPCs that can be configured independently.
|
310
|
+
#
|
311
|
+
# Configuration can be applied globally to all clients, or to a single client
|
312
|
+
# on construction.
|
313
|
+
#
|
314
|
+
# @example
|
315
|
+
#
|
316
|
+
# # Modify the global config, setting the timeout for
|
317
|
+
# # create_challenge to 20 seconds,
|
318
|
+
# # and all remaining timeouts to 10 seconds.
|
319
|
+
# ::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::Client.configure do |config|
|
320
|
+
# config.timeout = 10.0
|
321
|
+
# config.rpcs.create_challenge.timeout = 20.0
|
322
|
+
# end
|
323
|
+
#
|
324
|
+
# # Apply the above configuration only to a new client.
|
325
|
+
# client = ::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::Client.new do |config|
|
326
|
+
# config.timeout = 10.0
|
327
|
+
# config.rpcs.create_challenge.timeout = 20.0
|
328
|
+
# end
|
329
|
+
#
|
330
|
+
# @!attribute [rw] endpoint
|
331
|
+
# The hostname or hostname:port of the service endpoint.
|
332
|
+
# Defaults to `"confidentialcomputing.googleapis.com"`.
|
333
|
+
# @return [::String]
|
334
|
+
# @!attribute [rw] credentials
|
335
|
+
# Credentials to send with calls. You may provide any of the following types:
|
336
|
+
# * (`String`) The path to a service account key file in JSON format
|
337
|
+
# * (`Hash`) A service account key as a Hash
|
338
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
339
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
340
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
341
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
342
|
+
# * (`nil`) indicating no credentials
|
343
|
+
# @return [::Object]
|
344
|
+
# @!attribute [rw] scope
|
345
|
+
# The OAuth scopes
|
346
|
+
# @return [::Array<::String>]
|
347
|
+
# @!attribute [rw] lib_name
|
348
|
+
# The library name as recorded in instrumentation and logging
|
349
|
+
# @return [::String]
|
350
|
+
# @!attribute [rw] lib_version
|
351
|
+
# The library version as recorded in instrumentation and logging
|
352
|
+
# @return [::String]
|
353
|
+
# @!attribute [rw] timeout
|
354
|
+
# The call timeout in seconds.
|
355
|
+
# @return [::Numeric]
|
356
|
+
# @!attribute [rw] metadata
|
357
|
+
# Additional headers to be sent with the call.
|
358
|
+
# @return [::Hash{::Symbol=>::String}]
|
359
|
+
# @!attribute [rw] retry_policy
|
360
|
+
# The retry policy. The value is a hash with the following keys:
|
361
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
362
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
363
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
364
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
365
|
+
# trigger a retry.
|
366
|
+
# @return [::Hash]
|
367
|
+
# @!attribute [rw] quota_project
|
368
|
+
# A separate project against which to charge quota.
|
369
|
+
# @return [::String]
|
370
|
+
#
|
371
|
+
class Configuration
|
372
|
+
extend ::Gapic::Config
|
373
|
+
|
374
|
+
DEFAULT_ENDPOINT = "confidentialcomputing.googleapis.com"
|
375
|
+
|
376
|
+
config_attr :endpoint, DEFAULT_ENDPOINT, ::String
|
377
|
+
config_attr :credentials, nil do |value|
|
378
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
379
|
+
allowed.any? { |klass| klass === value }
|
380
|
+
end
|
381
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
382
|
+
config_attr :lib_name, nil, ::String, nil
|
383
|
+
config_attr :lib_version, nil, ::String, nil
|
384
|
+
config_attr :timeout, nil, ::Numeric, nil
|
385
|
+
config_attr :metadata, nil, ::Hash, nil
|
386
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
387
|
+
config_attr :quota_project, nil, ::String, nil
|
388
|
+
|
389
|
+
# @private
|
390
|
+
# Overrides for http bindings for the RPCs of this service
|
391
|
+
# are only used when this service is used as mixin, and only
|
392
|
+
# by the host service.
|
393
|
+
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
394
|
+
config_attr :bindings_override, {}, ::Hash, nil
|
395
|
+
|
396
|
+
# @private
|
397
|
+
def initialize parent_config = nil
|
398
|
+
@parent_config = parent_config unless parent_config.nil?
|
399
|
+
|
400
|
+
yield self if block_given?
|
401
|
+
end
|
402
|
+
|
403
|
+
##
|
404
|
+
# Configurations for individual RPCs
|
405
|
+
# @return [Rpcs]
|
406
|
+
#
|
407
|
+
def rpcs
|
408
|
+
@rpcs ||= begin
|
409
|
+
parent_rpcs = nil
|
410
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
411
|
+
Rpcs.new parent_rpcs
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
##
|
416
|
+
# Configuration RPC class for the ConfidentialComputing API.
|
417
|
+
#
|
418
|
+
# Includes fields providing the configuration for each RPC in this service.
|
419
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
420
|
+
# the following configuration fields:
|
421
|
+
#
|
422
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
423
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
424
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
425
|
+
# include the following keys:
|
426
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
427
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
428
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
429
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
430
|
+
# trigger a retry.
|
431
|
+
#
|
432
|
+
class Rpcs
|
433
|
+
##
|
434
|
+
# RPC-specific configuration for `create_challenge`
|
435
|
+
# @return [::Gapic::Config::Method]
|
436
|
+
#
|
437
|
+
attr_reader :create_challenge
|
438
|
+
##
|
439
|
+
# RPC-specific configuration for `verify_attestation`
|
440
|
+
# @return [::Gapic::Config::Method]
|
441
|
+
#
|
442
|
+
attr_reader :verify_attestation
|
443
|
+
|
444
|
+
# @private
|
445
|
+
def initialize parent_rpcs = nil
|
446
|
+
create_challenge_config = parent_rpcs.create_challenge if parent_rpcs.respond_to? :create_challenge
|
447
|
+
@create_challenge = ::Gapic::Config::Method.new create_challenge_config
|
448
|
+
verify_attestation_config = parent_rpcs.verify_attestation if parent_rpcs.respond_to? :verify_attestation
|
449
|
+
@verify_attestation = ::Gapic::Config::Method.new verify_attestation_config
|
450
|
+
|
451
|
+
yield self if block_given?
|
452
|
+
end
|
453
|
+
end
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
end
|
460
|
+
end
|
461
|
+
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/confidentialcomputing/v1/service_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module ConfidentialComputing
|
24
|
+
module V1
|
25
|
+
module ConfidentialComputing
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the ConfidentialComputing service.
|
29
|
+
# Service stub contains baseline method implementations
|
30
|
+
# including transcoding, making the REST call, and deserialing the response.
|
31
|
+
#
|
32
|
+
class ServiceStub
|
33
|
+
def initialize endpoint:, credentials:
|
34
|
+
# These require statements are intentionally placed here to initialize
|
35
|
+
# the REST modules only when it's required.
|
36
|
+
require "gapic/rest"
|
37
|
+
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
|
39
|
+
numeric_enums: true,
|
40
|
+
raise_faraday_errors: false
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Baseline implementation for the create_challenge REST call
|
45
|
+
#
|
46
|
+
# @param request_pb [::Google::Cloud::ConfidentialComputing::V1::CreateChallengeRequest]
|
47
|
+
# A request object representing the call parameters. Required.
|
48
|
+
# @param options [::Gapic::CallOptions]
|
49
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
50
|
+
#
|
51
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
52
|
+
# @yieldparam result [::Google::Cloud::ConfidentialComputing::V1::Challenge]
|
53
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
54
|
+
#
|
55
|
+
# @return [::Google::Cloud::ConfidentialComputing::V1::Challenge]
|
56
|
+
# A result object deserialized from the server's reply
|
57
|
+
def create_challenge request_pb, options = nil
|
58
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
59
|
+
|
60
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_create_challenge_request request_pb
|
61
|
+
query_string_params = if query_string_params.any?
|
62
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
63
|
+
else
|
64
|
+
{}
|
65
|
+
end
|
66
|
+
|
67
|
+
response = @client_stub.make_http_request(
|
68
|
+
verb,
|
69
|
+
uri: uri,
|
70
|
+
body: body || "",
|
71
|
+
params: query_string_params,
|
72
|
+
options: options
|
73
|
+
)
|
74
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
75
|
+
result = ::Google::Cloud::ConfidentialComputing::V1::Challenge.decode_json response.body, ignore_unknown_fields: true
|
76
|
+
|
77
|
+
yield result, operation if block_given?
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Baseline implementation for the verify_attestation REST call
|
83
|
+
#
|
84
|
+
# @param request_pb [::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationRequest]
|
85
|
+
# A request object representing the call parameters. Required.
|
86
|
+
# @param options [::Gapic::CallOptions]
|
87
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
88
|
+
#
|
89
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
90
|
+
# @yieldparam result [::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationResponse]
|
91
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
92
|
+
#
|
93
|
+
# @return [::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationResponse]
|
94
|
+
# A result object deserialized from the server's reply
|
95
|
+
def verify_attestation request_pb, options = nil
|
96
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
97
|
+
|
98
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_verify_attestation_request request_pb
|
99
|
+
query_string_params = if query_string_params.any?
|
100
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
101
|
+
else
|
102
|
+
{}
|
103
|
+
end
|
104
|
+
|
105
|
+
response = @client_stub.make_http_request(
|
106
|
+
verb,
|
107
|
+
uri: uri,
|
108
|
+
body: body || "",
|
109
|
+
params: query_string_params,
|
110
|
+
options: options
|
111
|
+
)
|
112
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
113
|
+
result = ::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationResponse.decode_json response.body, ignore_unknown_fields: true
|
114
|
+
|
115
|
+
yield result, operation if block_given?
|
116
|
+
result
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# @private
|
121
|
+
#
|
122
|
+
# GRPC transcoding helper method for the create_challenge REST call
|
123
|
+
#
|
124
|
+
# @param request_pb [::Google::Cloud::ConfidentialComputing::V1::CreateChallengeRequest]
|
125
|
+
# A request object representing the call parameters. Required.
|
126
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
127
|
+
# Uri, Body, Query string parameters
|
128
|
+
def self.transcode_create_challenge_request request_pb
|
129
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
130
|
+
.with_bindings(
|
131
|
+
uri_method: :post,
|
132
|
+
uri_template: "/v1/{parent}/challenges",
|
133
|
+
body: "challenge",
|
134
|
+
matches: [
|
135
|
+
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
|
136
|
+
]
|
137
|
+
)
|
138
|
+
transcoder.transcode request_pb
|
139
|
+
end
|
140
|
+
|
141
|
+
##
|
142
|
+
# @private
|
143
|
+
#
|
144
|
+
# GRPC transcoding helper method for the verify_attestation REST call
|
145
|
+
#
|
146
|
+
# @param request_pb [::Google::Cloud::ConfidentialComputing::V1::VerifyAttestationRequest]
|
147
|
+
# A request object representing the call parameters. Required.
|
148
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
149
|
+
# Uri, Body, Query string parameters
|
150
|
+
def self.transcode_verify_attestation_request request_pb
|
151
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
152
|
+
.with_bindings(
|
153
|
+
uri_method: :post,
|
154
|
+
uri_template: "/v1/{challenge}:verifyAttestation",
|
155
|
+
body: "*",
|
156
|
+
matches: [
|
157
|
+
["challenge", %r{^projects/[^/]+/locations/[^/]+/challenges/[^/]+/?$}, false]
|
158
|
+
]
|
159
|
+
)
|
160
|
+
transcoder.transcode request_pb
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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 "gapic/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/confidential_computing/v1/version"
|
24
|
+
require "google/cloud/confidential_computing/v1/bindings_override"
|
25
|
+
|
26
|
+
require "google/cloud/confidential_computing/v1/confidential_computing/credentials"
|
27
|
+
require "google/cloud/confidential_computing/v1/confidential_computing/paths"
|
28
|
+
require "google/cloud/confidential_computing/v1/confidential_computing/rest/client"
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module ConfidentialComputing
|
33
|
+
module V1
|
34
|
+
##
|
35
|
+
# Service describing handlers for resources
|
36
|
+
#
|
37
|
+
# To load this service and instantiate a REST client:
|
38
|
+
#
|
39
|
+
# require "google/cloud/confidential_computing/v1/confidential_computing/rest"
|
40
|
+
# client = ::Google::Cloud::ConfidentialComputing::V1::ConfidentialComputing::Rest::Client.new
|
41
|
+
#
|
42
|
+
module ConfidentialComputing
|
43
|
+
# Client for the REST transport
|
44
|
+
module Rest
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
53
|
+
require "google/cloud/confidential_computing/v1/confidential_computing/rest/helpers" if ::File.file? helper_path
|