grafeas 0.1.1 → 1.0.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -3
  3. data/LICENSE.md +203 -0
  4. data/MIGRATING.md +366 -0
  5. data/README.md +28 -25
  6. data/lib/grafeas.rb +37 -118
  7. data/lib/grafeas/version.rb +6 -2
  8. metadata +49 -78
  9. data/AUTHENTICATION.md +0 -177
  10. data/LICENSE +0 -201
  11. data/lib/grafeas/v1.rb +0 -155
  12. data/lib/grafeas/v1/attestation_pb.rb +0 -27
  13. data/lib/grafeas/v1/build_pb.rb +0 -23
  14. data/lib/grafeas/v1/common_pb.rb +0 -34
  15. data/lib/grafeas/v1/credentials.rb +0 -37
  16. data/lib/grafeas/v1/cvss_pb.rb +0 -67
  17. data/lib/grafeas/v1/deployment_pb.rb +0 -35
  18. data/lib/grafeas/v1/discovery_pb.rb +0 -40
  19. data/lib/grafeas/v1/doc/google/protobuf/any.rb +0 -131
  20. data/lib/grafeas/v1/doc/google/protobuf/empty.rb +0 -29
  21. data/lib/grafeas/v1/doc/google/protobuf/field_mask.rb +0 -222
  22. data/lib/grafeas/v1/doc/google/protobuf/timestamp.rb +0 -113
  23. data/lib/grafeas/v1/doc/google/rpc/status.rb +0 -87
  24. data/lib/grafeas/v1/doc/grafeas/v1/attestation.rb +0 -64
  25. data/lib/grafeas/v1/doc/grafeas/v1/build.rb +0 -44
  26. data/lib/grafeas/v1/doc/grafeas/v1/common.rb +0 -105
  27. data/lib/grafeas/v1/doc/grafeas/v1/cvss.rb +0 -104
  28. data/lib/grafeas/v1/doc/grafeas/v1/deployment.rb +0 -64
  29. data/lib/grafeas/v1/doc/grafeas/v1/discovery.rb +0 -76
  30. data/lib/grafeas/v1/doc/grafeas/v1/grafeas.rb +0 -322
  31. data/lib/grafeas/v1/doc/grafeas/v1/image.rb +0 -79
  32. data/lib/grafeas/v1/doc/grafeas/v1/package.rb +0 -125
  33. data/lib/grafeas/v1/doc/grafeas/v1/provenance.rb +0 -248
  34. data/lib/grafeas/v1/doc/grafeas/v1/vulnerability.rb +0 -214
  35. data/lib/grafeas/v1/grafeas_client.rb +0 -961
  36. data/lib/grafeas/v1/grafeas_client_config.json +0 -96
  37. data/lib/grafeas/v1/grafeas_pb.rb +0 -163
  38. data/lib/grafeas/v1/grafeas_services_pb.rb +0 -86
  39. data/lib/grafeas/v1/image_pb.rb +0 -36
  40. data/lib/grafeas/v1/package_pb.rb +0 -59
  41. data/lib/grafeas/v1/provenance_pb.rb +0 -116
  42. data/lib/grafeas/v1/vulnerability_pb.rb +0 -81
@@ -1,27 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: grafeas/v1/attestation.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'grafeas/v1/common_pb'
8
- Google::Protobuf::DescriptorPool.generated_pool.build do
9
- add_message "grafeas.v1.AttestationNote" do
10
- optional :hint, :message, 1, "grafeas.v1.AttestationNote.Hint"
11
- end
12
- add_message "grafeas.v1.AttestationNote.Hint" do
13
- optional :human_readable_name, :string, 1
14
- end
15
- add_message "grafeas.v1.AttestationOccurrence" do
16
- optional :serialized_payload, :bytes, 1
17
- repeated :signatures, :message, 2, "grafeas.v1.Signature"
18
- end
19
- end
20
-
21
- module Grafeas
22
- module V1
23
- AttestationNote = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.AttestationNote").msgclass
24
- AttestationNote::Hint = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.AttestationNote.Hint").msgclass
25
- AttestationOccurrence = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.AttestationOccurrence").msgclass
26
- end
27
- end
@@ -1,23 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: grafeas/v1/build.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'grafeas/v1/provenance_pb'
8
- Google::Protobuf::DescriptorPool.generated_pool.build do
9
- add_message "grafeas.v1.BuildNote" do
10
- optional :builder_version, :string, 1
11
- end
12
- add_message "grafeas.v1.BuildOccurrence" do
13
- optional :provenance, :message, 1, "grafeas.v1.BuildProvenance"
14
- optional :provenance_bytes, :string, 2
15
- end
16
- end
17
-
18
- module Grafeas
19
- module V1
20
- BuildNote = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.BuildNote").msgclass
21
- BuildOccurrence = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.BuildOccurrence").msgclass
22
- end
23
- end
@@ -1,34 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: grafeas/v1/common.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- Google::Protobuf::DescriptorPool.generated_pool.build do
8
- add_message "grafeas.v1.RelatedUrl" do
9
- optional :url, :string, 1
10
- optional :label, :string, 2
11
- end
12
- add_message "grafeas.v1.Signature" do
13
- optional :signature, :bytes, 1
14
- optional :public_key_id, :string, 2
15
- end
16
- add_enum "grafeas.v1.NoteKind" do
17
- value :NOTE_KIND_UNSPECIFIED, 0
18
- value :VULNERABILITY, 1
19
- value :BUILD, 2
20
- value :IMAGE, 3
21
- value :PACKAGE, 4
22
- value :DEPLOYMENT, 5
23
- value :DISCOVERY, 6
24
- value :ATTESTATION, 7
25
- end
26
- end
27
-
28
- module Grafeas
29
- module V1
30
- RelatedUrl = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.RelatedUrl").msgclass
31
- Signature = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.Signature").msgclass
32
- NoteKind = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.NoteKind").enummodule
33
- end
34
- end
@@ -1,37 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- require "googleauth"
17
-
18
- module Grafeas
19
- module V1
20
- class Credentials < Google::Auth::Credentials
21
- SCOPE = [
22
- "https://www.googleapis.com/auth/cloud-platform"
23
- ].freeze
24
- PATH_ENV_VARS = %w(GRAFEAS_CREDENTIALS
25
- GRAFEAS_KEYFILE
26
- GOOGLE_CLOUD_CREDENTIALS
27
- GOOGLE_CLOUD_KEYFILE
28
- GCLOUD_KEYFILE)
29
- JSON_ENV_VARS = %w(GRAFEAS_CREDENTIALS_JSON
30
- GRAFEAS_KEYFILE_JSON
31
- GOOGLE_CLOUD_CREDENTIALS_JSON
32
- GOOGLE_CLOUD_KEYFILE_JSON
33
- GCLOUD_KEYFILE_JSON)
34
- DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
35
- end
36
- end
37
- end
@@ -1,67 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: grafeas/v1/cvss.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- Google::Protobuf::DescriptorPool.generated_pool.build do
8
- add_message "grafeas.v1.CVSSv3" do
9
- optional :base_score, :float, 1
10
- optional :exploitability_score, :float, 2
11
- optional :impact_score, :float, 3
12
- optional :attack_vector, :enum, 5, "grafeas.v1.CVSSv3.AttackVector"
13
- optional :attack_complexity, :enum, 6, "grafeas.v1.CVSSv3.AttackComplexity"
14
- optional :privileges_required, :enum, 7, "grafeas.v1.CVSSv3.PrivilegesRequired"
15
- optional :user_interaction, :enum, 8, "grafeas.v1.CVSSv3.UserInteraction"
16
- optional :scope, :enum, 9, "grafeas.v1.CVSSv3.Scope"
17
- optional :confidentiality_impact, :enum, 10, "grafeas.v1.CVSSv3.Impact"
18
- optional :integrity_impact, :enum, 11, "grafeas.v1.CVSSv3.Impact"
19
- optional :availability_impact, :enum, 12, "grafeas.v1.CVSSv3.Impact"
20
- end
21
- add_enum "grafeas.v1.CVSSv3.AttackVector" do
22
- value :ATTACK_VECTOR_UNSPECIFIED, 0
23
- value :ATTACK_VECTOR_NETWORK, 1
24
- value :ATTACK_VECTOR_ADJACENT, 2
25
- value :ATTACK_VECTOR_LOCAL, 3
26
- value :ATTACK_VECTOR_PHYSICAL, 4
27
- end
28
- add_enum "grafeas.v1.CVSSv3.AttackComplexity" do
29
- value :ATTACK_COMPLEXITY_UNSPECIFIED, 0
30
- value :ATTACK_COMPLEXITY_LOW, 1
31
- value :ATTACK_COMPLEXITY_HIGH, 2
32
- end
33
- add_enum "grafeas.v1.CVSSv3.PrivilegesRequired" do
34
- value :PRIVILEGES_REQUIRED_UNSPECIFIED, 0
35
- value :PRIVILEGES_REQUIRED_NONE, 1
36
- value :PRIVILEGES_REQUIRED_LOW, 2
37
- value :PRIVILEGES_REQUIRED_HIGH, 3
38
- end
39
- add_enum "grafeas.v1.CVSSv3.UserInteraction" do
40
- value :USER_INTERACTION_UNSPECIFIED, 0
41
- value :USER_INTERACTION_NONE, 1
42
- value :USER_INTERACTION_REQUIRED, 2
43
- end
44
- add_enum "grafeas.v1.CVSSv3.Scope" do
45
- value :SCOPE_UNSPECIFIED, 0
46
- value :SCOPE_UNCHANGED, 1
47
- value :SCOPE_CHANGED, 2
48
- end
49
- add_enum "grafeas.v1.CVSSv3.Impact" do
50
- value :IMPACT_UNSPECIFIED, 0
51
- value :IMPACT_HIGH, 1
52
- value :IMPACT_LOW, 2
53
- value :IMPACT_NONE, 3
54
- end
55
- end
56
-
57
- module Grafeas
58
- module V1
59
- CVSSv3 = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3").msgclass
60
- CVSSv3::AttackVector = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.AttackVector").enummodule
61
- CVSSv3::AttackComplexity = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.AttackComplexity").enummodule
62
- CVSSv3::PrivilegesRequired = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.PrivilegesRequired").enummodule
63
- CVSSv3::UserInteraction = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.UserInteraction").enummodule
64
- CVSSv3::Scope = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.Scope").enummodule
65
- CVSSv3::Impact = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.Impact").enummodule
66
- end
67
- end
@@ -1,35 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: grafeas/v1/deployment.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/protobuf/timestamp_pb'
8
- Google::Protobuf::DescriptorPool.generated_pool.build do
9
- add_message "grafeas.v1.DeploymentNote" do
10
- repeated :resource_uri, :string, 1
11
- end
12
- add_message "grafeas.v1.DeploymentOccurrence" do
13
- optional :user_email, :string, 1
14
- optional :deploy_time, :message, 2, "google.protobuf.Timestamp"
15
- optional :undeploy_time, :message, 3, "google.protobuf.Timestamp"
16
- optional :config, :string, 4
17
- optional :address, :string, 5
18
- repeated :resource_uri, :string, 6
19
- optional :platform, :enum, 7, "grafeas.v1.DeploymentOccurrence.Platform"
20
- end
21
- add_enum "grafeas.v1.DeploymentOccurrence.Platform" do
22
- value :PLATFORM_UNSPECIFIED, 0
23
- value :GKE, 1
24
- value :FLEX, 2
25
- value :CUSTOM, 3
26
- end
27
- end
28
-
29
- module Grafeas
30
- module V1
31
- DeploymentNote = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.DeploymentNote").msgclass
32
- DeploymentOccurrence = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.DeploymentOccurrence").msgclass
33
- DeploymentOccurrence::Platform = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.DeploymentOccurrence.Platform").enummodule
34
- end
35
- end
@@ -1,40 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: grafeas/v1/discovery.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/rpc/status_pb'
8
- require 'grafeas/v1/common_pb'
9
- Google::Protobuf::DescriptorPool.generated_pool.build do
10
- add_message "grafeas.v1.DiscoveryNote" do
11
- optional :analysis_kind, :enum, 1, "grafeas.v1.NoteKind"
12
- end
13
- add_message "grafeas.v1.DiscoveryOccurrence" do
14
- optional :continuous_analysis, :enum, 1, "grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis"
15
- optional :analysis_status, :enum, 2, "grafeas.v1.DiscoveryOccurrence.AnalysisStatus"
16
- optional :analysis_status_error, :message, 3, "google.rpc.Status"
17
- end
18
- add_enum "grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis" do
19
- value :CONTINUOUS_ANALYSIS_UNSPECIFIED, 0
20
- value :ACTIVE, 1
21
- value :INACTIVE, 2
22
- end
23
- add_enum "grafeas.v1.DiscoveryOccurrence.AnalysisStatus" do
24
- value :ANALYSIS_STATUS_UNSPECIFIED, 0
25
- value :PENDING, 1
26
- value :SCANNING, 2
27
- value :FINISHED_SUCCESS, 3
28
- value :FINISHED_FAILED, 4
29
- value :FINISHED_UNSUPPORTED, 5
30
- end
31
- end
32
-
33
- module Grafeas
34
- module V1
35
- DiscoveryNote = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.DiscoveryNote").msgclass
36
- DiscoveryOccurrence = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.DiscoveryOccurrence").msgclass
37
- DiscoveryOccurrence::ContinuousAnalysis = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis").enummodule
38
- DiscoveryOccurrence::AnalysisStatus = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.DiscoveryOccurrence.AnalysisStatus").enummodule
39
- end
40
- end
@@ -1,131 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # `Any` contains an arbitrary serialized protocol buffer message along with a
19
- # URL that describes the type of the serialized message.
20
- #
21
- # Protobuf library provides support to pack/unpack Any values in the form
22
- # of utility functions or additional generated methods of the Any type.
23
- #
24
- # Example 1: Pack and unpack a message in C++.
25
- #
26
- # Foo foo = ...;
27
- # Any any;
28
- # any.PackFrom(foo);
29
- # ...
30
- # if (any.UnpackTo(&foo)) {
31
- # ...
32
- # }
33
- #
34
- # Example 2: Pack and unpack a message in Java.
35
- #
36
- # Foo foo = ...;
37
- # Any any = Any.pack(foo);
38
- # ...
39
- # if (any.is(Foo.class)) {
40
- # foo = any.unpack(Foo.class);
41
- # }
42
- #
43
- # Example 3: Pack and unpack a message in Python.
44
- #
45
- # foo = Foo(...)
46
- # any = Any()
47
- # any.Pack(foo)
48
- # ...
49
- # if any.Is(Foo.DESCRIPTOR):
50
- # any.Unpack(foo)
51
- # ...
52
- #
53
- # Example 4: Pack and unpack a message in Go
54
- #
55
- # foo := &pb.Foo{...}
56
- # any, err := ptypes.MarshalAny(foo)
57
- # ...
58
- # foo := &pb.Foo{}
59
- # if err := ptypes.UnmarshalAny(any, foo); err != nil {
60
- # ...
61
- # }
62
- #
63
- # The pack methods provided by protobuf library will by default use
64
- # 'type.googleapis.com/full.type.name' as the type URL and the unpack
65
- # methods only use the fully qualified type name after the last '/'
66
- # in the type URL, for example "foo.bar.com/x/y.z" will yield type
67
- # name "y.z".
68
- #
69
- #
70
- # = JSON
71
- #
72
- # The JSON representation of an `Any` value uses the regular
73
- # representation of the deserialized, embedded message, with an
74
- # additional field `@type` which contains the type URL. Example:
75
- #
76
- # package google.profile;
77
- # message Person {
78
- # string first_name = 1;
79
- # string last_name = 2;
80
- # }
81
- #
82
- # {
83
- # "@type": "type.googleapis.com/google.profile.Person",
84
- # "firstName": <string>,
85
- # "lastName": <string>
86
- # }
87
- #
88
- # If the embedded message type is well-known and has a custom JSON
89
- # representation, that representation will be embedded adding a field
90
- # `value` which holds the custom JSON in addition to the `@type`
91
- # field. Example (for message {Google::Protobuf::Duration}):
92
- #
93
- # {
94
- # "@type": "type.googleapis.com/google.protobuf.Duration",
95
- # "value": "1.212s"
96
- # }
97
- # @!attribute [rw] type_url
98
- # @return [String]
99
- # A URL/resource name that uniquely identifies the type of the serialized
100
- # protocol buffer message. This string must contain at least
101
- # one "/" character. The last segment of the URL's path must represent
102
- # the fully qualified name of the type (as in
103
- # `path/google.protobuf.Duration`). The name should be in a canonical form
104
- # (e.g., leading "." is not accepted).
105
- #
106
- # In practice, teams usually precompile into the binary all types that they
107
- # expect it to use in the context of Any. However, for URLs which use the
108
- # scheme `http`, `https`, or no scheme, one can optionally set up a type
109
- # server that maps type URLs to message definitions as follows:
110
- #
111
- # * If no scheme is provided, `https` is assumed.
112
- # * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
113
- # value in binary format, or produce an error.
114
- # * Applications are allowed to cache lookup results based on the
115
- # URL, or have them precompiled into a binary to avoid any
116
- # lookup. Therefore, binary compatibility needs to be preserved
117
- # on changes to types. (Use versioned type names to manage
118
- # breaking changes.)
119
- #
120
- # Note: this functionality is not currently available in the official
121
- # protobuf release, and it is not used for type URLs beginning with
122
- # type.googleapis.com.
123
- #
124
- # Schemes other than `http`, `https` (or the empty scheme) might be
125
- # used with implementation specific semantics.
126
- # @!attribute [rw] value
127
- # @return [String]
128
- # Must be a valid serialized protocol buffer of the above specified type.
129
- class Any; end
130
- end
131
- end
@@ -1,29 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # A generic empty message that you can re-use to avoid defining duplicated
19
- # empty messages in your APIs. A typical example is to use it as the request
20
- # or the response type of an API method. For instance:
21
- #
22
- # service Foo {
23
- # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
24
- # }
25
- #
26
- # The JSON representation for `Empty` is empty JSON object `{}`.
27
- class Empty; end
28
- end
29
- end
@@ -1,222 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # `FieldMask` represents a set of symbolic field paths, for example:
19
- #
20
- # paths: "f.a"
21
- # paths: "f.b.d"
22
- #
23
- # Here `f` represents a field in some root message, `a` and `b`
24
- # fields in the message found in `f`, and `d` a field found in the
25
- # message in `f.b`.
26
- #
27
- # Field masks are used to specify a subset of fields that should be
28
- # returned by a get operation or modified by an update operation.
29
- # Field masks also have a custom JSON encoding (see below).
30
- #
31
- # = Field Masks in Projections
32
- #
33
- # When used in the context of a projection, a response message or
34
- # sub-message is filtered by the API to only contain those fields as
35
- # specified in the mask. For example, if the mask in the previous
36
- # example is applied to a response message as follows:
37
- #
38
- # f {
39
- # a : 22
40
- # b {
41
- # d : 1
42
- # x : 2
43
- # }
44
- # y : 13
45
- # }
46
- # z: 8
47
- #
48
- # The result will not contain specific values for fields x,y and z
49
- # (their value will be set to the default, and omitted in proto text
50
- # output):
51
- #
52
- #
53
- # f {
54
- # a : 22
55
- # b {
56
- # d : 1
57
- # }
58
- # }
59
- #
60
- # A repeated field is not allowed except at the last position of a
61
- # paths string.
62
- #
63
- # If a FieldMask object is not present in a get operation, the
64
- # operation applies to all fields (as if a FieldMask of all fields
65
- # had been specified).
66
- #
67
- # Note that a field mask does not necessarily apply to the
68
- # top-level response message. In case of a REST get operation, the
69
- # field mask applies directly to the response, but in case of a REST
70
- # list operation, the mask instead applies to each individual message
71
- # in the returned resource list. In case of a REST custom method,
72
- # other definitions may be used. Where the mask applies will be
73
- # clearly documented together with its declaration in the API. In
74
- # any case, the effect on the returned resource/resources is required
75
- # behavior for APIs.
76
- #
77
- # = Field Masks in Update Operations
78
- #
79
- # A field mask in update operations specifies which fields of the
80
- # targeted resource are going to be updated. The API is required
81
- # to only change the values of the fields as specified in the mask
82
- # and leave the others untouched. If a resource is passed in to
83
- # describe the updated values, the API ignores the values of all
84
- # fields not covered by the mask.
85
- #
86
- # If a repeated field is specified for an update operation, new values will
87
- # be appended to the existing repeated field in the target resource. Note that
88
- # a repeated field is only allowed in the last position of a `paths` string.
89
- #
90
- # If a sub-message is specified in the last position of the field mask for an
91
- # update operation, then new value will be merged into the existing sub-message
92
- # in the target resource.
93
- #
94
- # For example, given the target message:
95
- #
96
- # f {
97
- # b {
98
- # d: 1
99
- # x: 2
100
- # }
101
- # c: [1]
102
- # }
103
- #
104
- # And an update message:
105
- #
106
- # f {
107
- # b {
108
- # d: 10
109
- # }
110
- # c: [2]
111
- # }
112
- #
113
- # then if the field mask is:
114
- #
115
- # paths: ["f.b", "f.c"]
116
- #
117
- # then the result will be:
118
- #
119
- # f {
120
- # b {
121
- # d: 10
122
- # x: 2
123
- # }
124
- # c: [1, 2]
125
- # }
126
- #
127
- # An implementation may provide options to override this default behavior for
128
- # repeated and message fields.
129
- #
130
- # In order to reset a field's value to the default, the field must
131
- # be in the mask and set to the default value in the provided resource.
132
- # Hence, in order to reset all fields of a resource, provide a default
133
- # instance of the resource and set all fields in the mask, or do
134
- # not provide a mask as described below.
135
- #
136
- # If a field mask is not present on update, the operation applies to
137
- # all fields (as if a field mask of all fields has been specified).
138
- # Note that in the presence of schema evolution, this may mean that
139
- # fields the client does not know and has therefore not filled into
140
- # the request will be reset to their default. If this is unwanted
141
- # behavior, a specific service may require a client to always specify
142
- # a field mask, producing an error if not.
143
- #
144
- # As with get operations, the location of the resource which
145
- # describes the updated values in the request message depends on the
146
- # operation kind. In any case, the effect of the field mask is
147
- # required to be honored by the API.
148
- #
149
- # == Considerations for HTTP REST
150
- #
151
- # The HTTP kind of an update operation which uses a field mask must
152
- # be set to PATCH instead of PUT in order to satisfy HTTP semantics
153
- # (PUT must only be used for full updates).
154
- #
155
- # = JSON Encoding of Field Masks
156
- #
157
- # In JSON, a field mask is encoded as a single string where paths are
158
- # separated by a comma. Fields name in each path are converted
159
- # to/from lower-camel naming conventions.
160
- #
161
- # As an example, consider the following message declarations:
162
- #
163
- # message Profile {
164
- # User user = 1;
165
- # Photo photo = 2;
166
- # }
167
- # message User {
168
- # string display_name = 1;
169
- # string address = 2;
170
- # }
171
- #
172
- # In proto a field mask for `Profile` may look as such:
173
- #
174
- # mask {
175
- # paths: "user.display_name"
176
- # paths: "photo"
177
- # }
178
- #
179
- # In JSON, the same mask is represented as below:
180
- #
181
- # {
182
- # mask: "user.displayName,photo"
183
- # }
184
- #
185
- # = Field Masks and Oneof Fields
186
- #
187
- # Field masks treat fields in oneofs just as regular fields. Consider the
188
- # following message:
189
- #
190
- # message SampleMessage {
191
- # oneof test_oneof {
192
- # string name = 4;
193
- # SubMessage sub_message = 9;
194
- # }
195
- # }
196
- #
197
- # The field mask can be:
198
- #
199
- # mask {
200
- # paths: "name"
201
- # }
202
- #
203
- # Or:
204
- #
205
- # mask {
206
- # paths: "sub_message"
207
- # }
208
- #
209
- # Note that oneof type names ("test_oneof" in this case) cannot be used in
210
- # paths.
211
- #
212
- # == Field Mask Verification
213
- #
214
- # The implementation of any API method which has a FieldMask type field in the
215
- # request should verify the included field paths, and return an
216
- # `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
217
- # @!attribute [rw] paths
218
- # @return [Array<String>]
219
- # The set of field mask paths.
220
- class FieldMask; end
221
- end
222
- end