google-cloud-container_analysis-v1 0.4.3 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/AUTHENTICATION.md +7 -25
- data/README.md +1 -1
- data/lib/google/cloud/container_analysis/v1/container_analysis/client.rb +81 -13
- data/lib/google/cloud/container_analysis/v1/version.rb +1 -1
- data/lib/google/devtools/containeranalysis/v1/containeranalysis_pb.rb +5 -3
- data/lib/google/devtools/containeranalysis/v1/containeranalysis_services_pb.rb +1 -1
- data/proto_docs/google/api/resource.rb +10 -71
- data/proto_docs/google/devtools/containeranalysis/v1/containeranalysis.rb +1 -1
- data/proto_docs/google/protobuf/any.rb +141 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- data/proto_docs/grafeas/v1/attestation.rb +98 -0
- data/proto_docs/grafeas/v1/build.rb +64 -0
- data/proto_docs/grafeas/v1/common.rb +31 -2
- data/proto_docs/grafeas/v1/compliance.rb +98 -0
- data/proto_docs/grafeas/v1/cvss.rb +105 -0
- data/proto_docs/grafeas/v1/deployment.rb +74 -0
- data/proto_docs/grafeas/v1/discovery.rb +95 -0
- data/proto_docs/grafeas/v1/dsse_attestation.rb +59 -0
- data/proto_docs/grafeas/v1/grafeas.rb +419 -0
- data/proto_docs/grafeas/v1/image.rb +95 -0
- data/proto_docs/grafeas/v1/intoto_provenance.rb +134 -0
- data/proto_docs/grafeas/v1/intoto_statement.rb +65 -0
- data/proto_docs/grafeas/v1/package.rb +8 -0
- data/proto_docs/grafeas/v1/provenance.rb +318 -0
- data/proto_docs/grafeas/v1/severity.rb +43 -0
- data/proto_docs/grafeas/v1/slsa_provenance.rb +152 -0
- data/proto_docs/grafeas/v1/upgrade.rb +148 -0
- data/proto_docs/grafeas/v1/vulnerability.rb +25 -21
- metadata +31 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c43a62e17050d537cff4b2c65944b2b1923099f6c06a0ae8dd3d2ecf782daacc
|
4
|
+
data.tar.gz: 8b637b5e0210af995d7edcd781b09290e9e74515b327ad48f2344e77e7795a4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ee8eea2784b9b8900dfbb34a7071e6b17388a5036960488fb09136bd1a43a224f476b82586c1c707ca1778dffa73c3d572c8ab5222998965dc0827031faa79d
|
7
|
+
data.tar.gz: 5ae886224b1a0ce679044b2838887219655eac14f1131328dfc4d6fee584bbdfe76172006ff21f215b4e8095820b34ffd6be04e9ab860f4faa53be652974b689
|
data/.yardopts
CHANGED
data/AUTHENTICATION.md
CHANGED
@@ -120,15 +120,6 @@ To configure your system for this, simply:
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
121
121
|
*should* only be used during development.
|
122
122
|
|
123
|
-
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
|
124
|
-
[dev-console]: https://console.cloud.google.com/project
|
125
|
-
|
126
|
-
[enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
|
127
|
-
|
128
|
-
[create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
|
129
|
-
[create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
|
130
|
-
[reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
|
131
|
-
|
132
123
|
## Creating a Service Account
|
133
124
|
|
134
125
|
Google Cloud requires **Service Account Credentials** to
|
@@ -139,31 +130,22 @@ If you are not running this client within
|
|
139
130
|
[Google Cloud Platform environments](#google-cloud-platform-environments), you
|
140
131
|
need a Google Developers service account.
|
141
132
|
|
142
|
-
1. Visit the [Google
|
133
|
+
1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
|
143
134
|
2. Create a new project or click on an existing project.
|
144
|
-
3. Activate the
|
135
|
+
3. Activate the menu in the upper left and select **APIs & Services**. From
|
145
136
|
here, you will enable the APIs that your application requires.
|
146
137
|
|
147
|
-
![Enable the APIs that your application requires][enable-apis]
|
148
|
-
|
149
138
|
*Note: You may need to enable billing in order to use these services.*
|
150
139
|
|
151
140
|
4. Select **Credentials** from the side navigation.
|
152
141
|
|
153
|
-
|
154
|
-
|
155
|
-
![Create a new service account][create-new-service-account]
|
156
|
-
|
157
|
-
![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
|
158
|
-
|
159
|
-
Find the "Add credentials" drop down and select "Service account" to be
|
160
|
-
guided through downloading a new JSON key file.
|
142
|
+
Find the "Create credentials" drop down near the top of the page, and select
|
143
|
+
"Service account" to be guided through downloading a new JSON key file.
|
161
144
|
|
162
145
|
If you want to re-use an existing service account, you can easily generate a
|
163
|
-
new key file. Just select the account you wish to re-use,
|
164
|
-
|
165
|
-
|
166
|
-
![Re-use an existing service account][reuse-service-account]
|
146
|
+
new key file. Just select the account you wish to re-use, click the pencil
|
147
|
+
tool on the right side to edit the service account, select the **Keys** tab,
|
148
|
+
and then select **Add Key**.
|
167
149
|
|
168
150
|
The key file you download will be used by this library to authenticate API
|
169
151
|
requests and should be stored in a secure location.
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ request = ::Google::Iam::V1::SetIamPolicyRequest.new # (request fields as keywor
|
|
37
37
|
response = client.set_iam_policy request
|
38
38
|
```
|
39
39
|
|
40
|
-
View the [Client Library Documentation](https://
|
40
|
+
View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest)
|
41
41
|
for class and method documentation.
|
42
42
|
|
43
43
|
See also the [Product Documentation](https://cloud.google.com/container-registry/docs/container-analysis)
|
@@ -204,6 +204,21 @@ module Google
|
|
204
204
|
#
|
205
205
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
206
206
|
#
|
207
|
+
# @example Basic example
|
208
|
+
# require "google/cloud/container_analysis/v1"
|
209
|
+
#
|
210
|
+
# # Create a client object. The client can be reused for multiple calls.
|
211
|
+
# client = Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.new
|
212
|
+
#
|
213
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
214
|
+
# request = Google::Iam::V1::SetIamPolicyRequest.new
|
215
|
+
#
|
216
|
+
# # Call the set_iam_policy method.
|
217
|
+
# result = client.set_iam_policy request
|
218
|
+
#
|
219
|
+
# # The returned object is of type Google::Iam::V1::Policy.
|
220
|
+
# p result
|
221
|
+
#
|
207
222
|
def set_iam_policy request, options = nil
|
208
223
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
209
224
|
|
@@ -221,9 +236,11 @@ module Google
|
|
221
236
|
gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION
|
222
237
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
223
238
|
|
224
|
-
header_params = {
|
225
|
-
|
226
|
-
|
239
|
+
header_params = {}
|
240
|
+
if request.resource
|
241
|
+
header_params["resource"] = request.resource
|
242
|
+
end
|
243
|
+
|
227
244
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
228
245
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
229
246
|
|
@@ -283,6 +300,21 @@ module Google
|
|
283
300
|
#
|
284
301
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
285
302
|
#
|
303
|
+
# @example Basic example
|
304
|
+
# require "google/cloud/container_analysis/v1"
|
305
|
+
#
|
306
|
+
# # Create a client object. The client can be reused for multiple calls.
|
307
|
+
# client = Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.new
|
308
|
+
#
|
309
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
310
|
+
# request = Google::Iam::V1::GetIamPolicyRequest.new
|
311
|
+
#
|
312
|
+
# # Call the get_iam_policy method.
|
313
|
+
# result = client.get_iam_policy request
|
314
|
+
#
|
315
|
+
# # The returned object is of type Google::Iam::V1::Policy.
|
316
|
+
# p result
|
317
|
+
#
|
286
318
|
def get_iam_policy request, options = nil
|
287
319
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
288
320
|
|
@@ -300,9 +332,11 @@ module Google
|
|
300
332
|
gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION
|
301
333
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
302
334
|
|
303
|
-
header_params = {
|
304
|
-
|
305
|
-
|
335
|
+
header_params = {}
|
336
|
+
if request.resource
|
337
|
+
header_params["resource"] = request.resource
|
338
|
+
end
|
339
|
+
|
306
340
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
307
341
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
308
342
|
|
@@ -363,6 +397,21 @@ module Google
|
|
363
397
|
#
|
364
398
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
365
399
|
#
|
400
|
+
# @example Basic example
|
401
|
+
# require "google/cloud/container_analysis/v1"
|
402
|
+
#
|
403
|
+
# # Create a client object. The client can be reused for multiple calls.
|
404
|
+
# client = Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.new
|
405
|
+
#
|
406
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
407
|
+
# request = Google::Iam::V1::TestIamPermissionsRequest.new
|
408
|
+
#
|
409
|
+
# # Call the test_iam_permissions method.
|
410
|
+
# result = client.test_iam_permissions request
|
411
|
+
#
|
412
|
+
# # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
|
413
|
+
# p result
|
414
|
+
#
|
366
415
|
def test_iam_permissions request, options = nil
|
367
416
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
368
417
|
|
@@ -380,9 +429,11 @@ module Google
|
|
380
429
|
gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION
|
381
430
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
382
431
|
|
383
|
-
header_params = {
|
384
|
-
|
385
|
-
|
432
|
+
header_params = {}
|
433
|
+
if request.resource
|
434
|
+
header_params["resource"] = request.resource
|
435
|
+
end
|
436
|
+
|
386
437
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
387
438
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
388
439
|
|
@@ -421,7 +472,7 @@ module Google
|
|
421
472
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
422
473
|
#
|
423
474
|
# @param parent [::String]
|
424
|
-
# The name of the project to get a vulnerability summary for in the form of
|
475
|
+
# Required. The name of the project to get a vulnerability summary for in the form of
|
425
476
|
# `projects/[PROJECT_ID]`.
|
426
477
|
# @param filter [::String]
|
427
478
|
# The filter expression.
|
@@ -434,6 +485,21 @@ module Google
|
|
434
485
|
#
|
435
486
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
436
487
|
#
|
488
|
+
# @example Basic example
|
489
|
+
# require "google/cloud/container_analysis/v1"
|
490
|
+
#
|
491
|
+
# # Create a client object. The client can be reused for multiple calls.
|
492
|
+
# client = Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.new
|
493
|
+
#
|
494
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
495
|
+
# request = Google::Cloud::ContainerAnalysis::V1::GetVulnerabilityOccurrencesSummaryRequest.new
|
496
|
+
#
|
497
|
+
# # Call the get_vulnerability_occurrences_summary method.
|
498
|
+
# result = client.get_vulnerability_occurrences_summary request
|
499
|
+
#
|
500
|
+
# # The returned object is of type Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary.
|
501
|
+
# p result
|
502
|
+
#
|
437
503
|
def get_vulnerability_occurrences_summary request, options = nil
|
438
504
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
439
505
|
|
@@ -451,9 +517,11 @@ module Google
|
|
451
517
|
gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION
|
452
518
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
453
519
|
|
454
|
-
header_params = {
|
455
|
-
|
456
|
-
|
520
|
+
header_params = {}
|
521
|
+
if request.parent
|
522
|
+
header_params["parent"] = request.parent
|
523
|
+
end
|
524
|
+
|
457
525
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
458
526
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
459
527
|
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# source: google/devtools/containeranalysis/v1/containeranalysis.proto
|
3
3
|
|
4
|
-
require 'google/protobuf'
|
5
|
-
|
6
4
|
require 'google/api/annotations_pb'
|
7
5
|
require 'google/api/client_pb'
|
8
6
|
require 'google/api/field_behavior_pb'
|
@@ -10,7 +8,11 @@ require 'google/api/resource_pb'
|
|
10
8
|
require 'google/iam/v1/iam_policy_pb'
|
11
9
|
require 'google/iam/v1/policy_pb'
|
12
10
|
require 'google/protobuf/timestamp_pb'
|
13
|
-
require 'grafeas/v1/
|
11
|
+
require 'grafeas/v1/common_pb'
|
12
|
+
require 'grafeas/v1/grafeas_pb'
|
13
|
+
require 'grafeas/v1/severity_pb'
|
14
|
+
require 'google/protobuf'
|
15
|
+
|
14
16
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
15
17
|
add_file("google/devtools/containeranalysis/v1/containeranalysis.proto", :syntax => :proto3) do
|
16
18
|
add_message "google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest" do
|
@@ -33,11 +33,7 @@ module Google
|
|
33
33
|
# // For Kubernetes resources, the format is {api group}/{kind}.
|
34
34
|
# option (google.api.resource) = {
|
35
35
|
# type: "pubsub.googleapis.com/Topic"
|
36
|
-
#
|
37
|
-
# pattern: "projects/{project}/topics/{topic}"
|
38
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Project"
|
39
|
-
# parent_name_extractor: "projects/{project}"
|
40
|
-
# }
|
36
|
+
# pattern: "projects/{project}/topics/{topic}"
|
41
37
|
# };
|
42
38
|
# }
|
43
39
|
#
|
@@ -45,10 +41,7 @@ module Google
|
|
45
41
|
#
|
46
42
|
# resources:
|
47
43
|
# - type: "pubsub.googleapis.com/Topic"
|
48
|
-
#
|
49
|
-
# - pattern: "projects/{project}/topics/{topic}"
|
50
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Project"
|
51
|
-
# parent_name_extractor: "projects/{project}"
|
44
|
+
# pattern: "projects/{project}/topics/{topic}"
|
52
45
|
#
|
53
46
|
# Sometimes, resources have multiple patterns, typically because they can
|
54
47
|
# live under multiple parents.
|
@@ -58,26 +51,10 @@ module Google
|
|
58
51
|
# message LogEntry {
|
59
52
|
# option (google.api.resource) = {
|
60
53
|
# type: "logging.googleapis.com/LogEntry"
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
# }
|
66
|
-
# name_descriptor: {
|
67
|
-
# pattern: "folders/{folder}/logs/{log}"
|
68
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Folder"
|
69
|
-
# parent_name_extractor: "folders/{folder}"
|
70
|
-
# }
|
71
|
-
# name_descriptor: {
|
72
|
-
# pattern: "organizations/{organization}/logs/{log}"
|
73
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Organization"
|
74
|
-
# parent_name_extractor: "organizations/{organization}"
|
75
|
-
# }
|
76
|
-
# name_descriptor: {
|
77
|
-
# pattern: "billingAccounts/{billing_account}/logs/{log}"
|
78
|
-
# parent_type: "billing.googleapis.com/BillingAccount"
|
79
|
-
# parent_name_extractor: "billingAccounts/{billing_account}"
|
80
|
-
# }
|
54
|
+
# pattern: "projects/{project}/logs/{log}"
|
55
|
+
# pattern: "folders/{folder}/logs/{log}"
|
56
|
+
# pattern: "organizations/{organization}/logs/{log}"
|
57
|
+
# pattern: "billingAccounts/{billing_account}/logs/{log}"
|
81
58
|
# };
|
82
59
|
# }
|
83
60
|
#
|
@@ -85,48 +62,10 @@ module Google
|
|
85
62
|
#
|
86
63
|
# resources:
|
87
64
|
# - type: 'logging.googleapis.com/LogEntry'
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
# - pattern: "folders/{folder}/logs/{log}"
|
93
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Folder"
|
94
|
-
# parent_name_extractor: "folders/{folder}"
|
95
|
-
# - pattern: "organizations/{organization}/logs/{log}"
|
96
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Organization"
|
97
|
-
# parent_name_extractor: "organizations/{organization}"
|
98
|
-
# - pattern: "billingAccounts/{billing_account}/logs/{log}"
|
99
|
-
# parent_type: "billing.googleapis.com/BillingAccount"
|
100
|
-
# parent_name_extractor: "billingAccounts/{billing_account}"
|
101
|
-
#
|
102
|
-
# For flexible resources, the resource name doesn't contain parent names, but
|
103
|
-
# the resource itself has parents for policy evaluation.
|
104
|
-
#
|
105
|
-
# Example:
|
106
|
-
#
|
107
|
-
# message Shelf {
|
108
|
-
# option (google.api.resource) = {
|
109
|
-
# type: "library.googleapis.com/Shelf"
|
110
|
-
# name_descriptor: {
|
111
|
-
# pattern: "shelves/{shelf}"
|
112
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Project"
|
113
|
-
# }
|
114
|
-
# name_descriptor: {
|
115
|
-
# pattern: "shelves/{shelf}"
|
116
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Folder"
|
117
|
-
# }
|
118
|
-
# };
|
119
|
-
# }
|
120
|
-
#
|
121
|
-
# The ResourceDescriptor Yaml config will look like:
|
122
|
-
#
|
123
|
-
# resources:
|
124
|
-
# - type: 'library.googleapis.com/Shelf'
|
125
|
-
# name_descriptor:
|
126
|
-
# - pattern: "shelves/{shelf}"
|
127
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Project"
|
128
|
-
# - pattern: "shelves/{shelf}"
|
129
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Folder"
|
65
|
+
# pattern: "projects/{project}/logs/{log}"
|
66
|
+
# pattern: "folders/{folder}/logs/{log}"
|
67
|
+
# pattern: "organizations/{organization}/logs/{log}"
|
68
|
+
# pattern: "billingAccounts/{billing_account}/logs/{log}"
|
130
69
|
# @!attribute [rw] type
|
131
70
|
# @return [::String]
|
132
71
|
# The resource type. It must be in the format of
|
@@ -24,7 +24,7 @@ module Google
|
|
24
24
|
# Request to get a vulnerability summary for some set of occurrences.
|
25
25
|
# @!attribute [rw] parent
|
26
26
|
# @return [::String]
|
27
|
-
# The name of the project to get a vulnerability summary for in the form of
|
27
|
+
# Required. The name of the project to get a vulnerability summary for in the form of
|
28
28
|
# `projects/[PROJECT_ID]`.
|
29
29
|
# @!attribute [rw] filter
|
30
30
|
# @return [::String]
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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
|
+
|
20
|
+
module Google
|
21
|
+
module Protobuf
|
22
|
+
# `Any` contains an arbitrary serialized protocol buffer message along with a
|
23
|
+
# URL that describes the type of the serialized message.
|
24
|
+
#
|
25
|
+
# Protobuf library provides support to pack/unpack Any values in the form
|
26
|
+
# of utility functions or additional generated methods of the Any type.
|
27
|
+
#
|
28
|
+
# Example 1: Pack and unpack a message in C++.
|
29
|
+
#
|
30
|
+
# Foo foo = ...;
|
31
|
+
# Any any;
|
32
|
+
# any.PackFrom(foo);
|
33
|
+
# ...
|
34
|
+
# if (any.UnpackTo(&foo)) {
|
35
|
+
# ...
|
36
|
+
# }
|
37
|
+
#
|
38
|
+
# Example 2: Pack and unpack a message in Java.
|
39
|
+
#
|
40
|
+
# Foo foo = ...;
|
41
|
+
# Any any = Any.pack(foo);
|
42
|
+
# ...
|
43
|
+
# if (any.is(Foo.class)) {
|
44
|
+
# foo = any.unpack(Foo.class);
|
45
|
+
# }
|
46
|
+
#
|
47
|
+
# Example 3: Pack and unpack a message in Python.
|
48
|
+
#
|
49
|
+
# foo = Foo(...)
|
50
|
+
# any = Any()
|
51
|
+
# any.Pack(foo)
|
52
|
+
# ...
|
53
|
+
# if any.Is(Foo.DESCRIPTOR):
|
54
|
+
# any.Unpack(foo)
|
55
|
+
# ...
|
56
|
+
#
|
57
|
+
# Example 4: Pack and unpack a message in Go
|
58
|
+
#
|
59
|
+
# foo := &pb.Foo{...}
|
60
|
+
# any, err := anypb.New(foo)
|
61
|
+
# if err != nil {
|
62
|
+
# ...
|
63
|
+
# }
|
64
|
+
# ...
|
65
|
+
# foo := &pb.Foo{}
|
66
|
+
# if err := any.UnmarshalTo(foo); err != nil {
|
67
|
+
# ...
|
68
|
+
# }
|
69
|
+
#
|
70
|
+
# The pack methods provided by protobuf library will by default use
|
71
|
+
# 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
72
|
+
# methods only use the fully qualified type name after the last '/'
|
73
|
+
# in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
74
|
+
# name "y.z".
|
75
|
+
#
|
76
|
+
#
|
77
|
+
# JSON
|
78
|
+
# ====
|
79
|
+
# The JSON representation of an `Any` value uses the regular
|
80
|
+
# representation of the deserialized, embedded message, with an
|
81
|
+
# additional field `@type` which contains the type URL. Example:
|
82
|
+
#
|
83
|
+
# package google.profile;
|
84
|
+
# message Person {
|
85
|
+
# string first_name = 1;
|
86
|
+
# string last_name = 2;
|
87
|
+
# }
|
88
|
+
#
|
89
|
+
# {
|
90
|
+
# "@type": "type.googleapis.com/google.profile.Person",
|
91
|
+
# "firstName": <string>,
|
92
|
+
# "lastName": <string>
|
93
|
+
# }
|
94
|
+
#
|
95
|
+
# If the embedded message type is well-known and has a custom JSON
|
96
|
+
# representation, that representation will be embedded adding a field
|
97
|
+
# `value` which holds the custom JSON in addition to the `@type`
|
98
|
+
# field. Example (for message [google.protobuf.Duration][]):
|
99
|
+
#
|
100
|
+
# {
|
101
|
+
# "@type": "type.googleapis.com/google.protobuf.Duration",
|
102
|
+
# "value": "1.212s"
|
103
|
+
# }
|
104
|
+
# @!attribute [rw] type_url
|
105
|
+
# @return [::String]
|
106
|
+
# A URL/resource name that uniquely identifies the type of the serialized
|
107
|
+
# protocol buffer message. This string must contain at least
|
108
|
+
# one "/" character. The last segment of the URL's path must represent
|
109
|
+
# the fully qualified name of the type (as in
|
110
|
+
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
111
|
+
# (e.g., leading "." is not accepted).
|
112
|
+
#
|
113
|
+
# In practice, teams usually precompile into the binary all types that they
|
114
|
+
# expect it to use in the context of Any. However, for URLs which use the
|
115
|
+
# scheme `http`, `https`, or no scheme, one can optionally set up a type
|
116
|
+
# server that maps type URLs to message definitions as follows:
|
117
|
+
#
|
118
|
+
# * If no scheme is provided, `https` is assumed.
|
119
|
+
# * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
120
|
+
# value in binary format, or produce an error.
|
121
|
+
# * Applications are allowed to cache lookup results based on the
|
122
|
+
# URL, or have them precompiled into a binary to avoid any
|
123
|
+
# lookup. Therefore, binary compatibility needs to be preserved
|
124
|
+
# on changes to types. (Use versioned type names to manage
|
125
|
+
# breaking changes.)
|
126
|
+
#
|
127
|
+
# Note: this functionality is not currently available in the official
|
128
|
+
# protobuf release, and it is not used for type URLs beginning with
|
129
|
+
# type.googleapis.com.
|
130
|
+
#
|
131
|
+
# Schemes other than `http`, `https` (or the empty scheme) might be
|
132
|
+
# used with implementation specific semantics.
|
133
|
+
# @!attribute [rw] value
|
134
|
+
# @return [::String]
|
135
|
+
# Must be a valid serialized protocol buffer of the above specified type.
|
136
|
+
class Any
|
137
|
+
include ::Google::Protobuf::MessageExts
|
138
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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
|
+
|
20
|
+
module Google
|
21
|
+
module Protobuf
|
22
|
+
# A generic empty message that you can re-use to avoid defining duplicated
|
23
|
+
# empty messages in your APIs. A typical example is to use it as the request
|
24
|
+
# or the response type of an API method. For instance:
|
25
|
+
#
|
26
|
+
# service Foo {
|
27
|
+
# rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
28
|
+
# }
|
29
|
+
#
|
30
|
+
# The JSON representation for `Empty` is empty JSON object `{}`.
|
31
|
+
class Empty
|
32
|
+
include ::Google::Protobuf::MessageExts
|
33
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|