google-cloud-spanner 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/google-cloud-spanner.rb +106 -0
- data/lib/google/cloud/spanner.rb +382 -0
- data/lib/google/cloud/spanner/admin/database/v1.rb +17 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +703 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +73 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +139 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +114 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +188 -0
- data/lib/google/cloud/spanner/admin/instance/v1.rb +17 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +139 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +114 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +223 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +268 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +868 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json +78 -0
- data/lib/google/cloud/spanner/client.rb +1034 -0
- data/lib/google/cloud/spanner/commit.rb +351 -0
- data/lib/google/cloud/spanner/convert.rb +311 -0
- data/lib/google/cloud/spanner/credentials.rb +32 -0
- data/lib/google/cloud/spanner/data.rb +199 -0
- data/lib/google/cloud/spanner/database.rb +377 -0
- data/lib/google/cloud/spanner/database/job.rb +179 -0
- data/lib/google/cloud/spanner/database/list.rb +171 -0
- data/lib/google/cloud/spanner/errors.rb +73 -0
- data/lib/google/cloud/spanner/fields.rb +252 -0
- data/lib/google/cloud/spanner/instance.rb +472 -0
- data/lib/google/cloud/spanner/instance/config.rb +99 -0
- data/lib/google/cloud/spanner/instance/config/list.rb +171 -0
- data/lib/google/cloud/spanner/instance/job.rb +197 -0
- data/lib/google/cloud/spanner/instance/list.rb +167 -0
- data/lib/google/cloud/spanner/policy.rb +201 -0
- data/lib/google/cloud/spanner/pool.rb +279 -0
- data/lib/google/cloud/spanner/project.rb +480 -0
- data/lib/google/cloud/spanner/range.rb +99 -0
- data/lib/google/cloud/spanner/results.rb +280 -0
- data/lib/google/cloud/spanner/service.rb +458 -0
- data/lib/google/cloud/spanner/session.rb +565 -0
- data/lib/google/cloud/spanner/snapshot.rb +260 -0
- data/lib/google/cloud/spanner/transaction.rb +533 -0
- data/lib/google/cloud/spanner/v1.rb +17 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +77 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +73 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +81 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +148 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +80 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +120 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +175 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +206 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +351 -0
- data/lib/google/cloud/spanner/v1/spanner_client.rb +850 -0
- data/lib/google/cloud/spanner/v1/spanner_client_config.json +78 -0
- data/lib/google/cloud/spanner/version.rb +22 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +85 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +95 -0
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +106 -0
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +180 -0
- data/lib/google/spanner/v1/keys_pb.rb +33 -0
- data/lib/google/spanner/v1/mutation_pb.rb +38 -0
- data/lib/google/spanner/v1/query_plan_pb.rb +47 -0
- data/lib/google/spanner/v1/result_set_pb.rb +43 -0
- data/lib/google/spanner/v1/spanner_pb.rb +90 -0
- data/lib/google/spanner/v1/spanner_services_pb.rb +131 -0
- data/lib/google/spanner/v1/transaction_pb.rb +51 -0
- data/lib/google/spanner/v1/type_pb.rb +43 -0
- metadata +309 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
# Copyright 2016 Google Inc. All rights reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
|
17
|
+
require "google/cloud/spanner/admin/instance/v1/instance_admin_client"
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
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
|
+
# http://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
|
+
module Google
|
16
|
+
module Iam
|
17
|
+
module V1
|
18
|
+
# Defines an Identity and Access Management (IAM) policy. It is used to
|
19
|
+
# specify access control policies for Cloud Platform resources.
|
20
|
+
#
|
21
|
+
#
|
22
|
+
# A +Policy+ consists of a list of +bindings+. A +Binding+ binds a list of
|
23
|
+
# +members+ to a +role+, where the members can be user accounts, Google groups,
|
24
|
+
# Google domains, and service accounts. A +role+ is a named list of permissions
|
25
|
+
# defined by IAM.
|
26
|
+
#
|
27
|
+
# **Example**
|
28
|
+
#
|
29
|
+
# {
|
30
|
+
# "bindings": [
|
31
|
+
# {
|
32
|
+
# "role": "roles/owner",
|
33
|
+
# "members": [
|
34
|
+
# "user:mike@example.com",
|
35
|
+
# "group:admins@example.com",
|
36
|
+
# "domain:google.com",
|
37
|
+
# "serviceAccount:my-other-app@appspot.gserviceaccount.com",
|
38
|
+
# ]
|
39
|
+
# },
|
40
|
+
# {
|
41
|
+
# "role": "roles/viewer",
|
42
|
+
# "members": ["user:sean@example.com"]
|
43
|
+
# }
|
44
|
+
# ]
|
45
|
+
# }
|
46
|
+
#
|
47
|
+
# For a description of IAM and its features, see the
|
48
|
+
# {IAM developer's guide}[https://cloud.google.com/iam].
|
49
|
+
# @!attribute [rw] version
|
50
|
+
# @return [Integer]
|
51
|
+
# Version of the +Policy+. The default version is 0.
|
52
|
+
# @!attribute [rw] bindings
|
53
|
+
# @return [Array<Google::Iam::V1::Binding>]
|
54
|
+
# Associates a list of +members+ to a +role+.
|
55
|
+
# Multiple +bindings+ must not be specified for the same +role+.
|
56
|
+
# +bindings+ with no members will result in an error.
|
57
|
+
# @!attribute [rw] etag
|
58
|
+
# @return [String]
|
59
|
+
# +etag+ is used for optimistic concurrency control as a way to help
|
60
|
+
# prevent simultaneous updates of a policy from overwriting each other.
|
61
|
+
# It is strongly suggested that systems make use of the +etag+ in the
|
62
|
+
# read-modify-write cycle to perform policy updates in order to avoid race
|
63
|
+
# conditions: An +etag+ is returned in the response to +getIamPolicy+, and
|
64
|
+
# systems are expected to put that etag in the request to +setIamPolicy+ to
|
65
|
+
# ensure that their change will be applied to the same version of the policy.
|
66
|
+
#
|
67
|
+
# If no +etag+ is provided in the call to +setIamPolicy+, then the existing
|
68
|
+
# policy is overwritten blindly.
|
69
|
+
class Policy; end
|
70
|
+
|
71
|
+
# Associates +members+ with a +role+.
|
72
|
+
# @!attribute [rw] role
|
73
|
+
# @return [String]
|
74
|
+
# Role that is assigned to +members+.
|
75
|
+
# For example, +roles/viewer+, +roles/editor+, or +roles/owner+.
|
76
|
+
# Required
|
77
|
+
# @!attribute [rw] members
|
78
|
+
# @return [Array<String>]
|
79
|
+
# Specifies the identities requesting access for a Cloud Platform resource.
|
80
|
+
# +members+ can have the following values:
|
81
|
+
#
|
82
|
+
# * +allUsers+: A special identifier that represents anyone who is
|
83
|
+
# on the internet; with or without a Google account.
|
84
|
+
#
|
85
|
+
# * +allAuthenticatedUsers+: A special identifier that represents anyone
|
86
|
+
# who is authenticated with a Google account or a service account.
|
87
|
+
#
|
88
|
+
# * +user:{emailid}+: An email address that represents a specific Google
|
89
|
+
# account. For example, +alice@gmail.com+ or +joe@example.com+.
|
90
|
+
#
|
91
|
+
#
|
92
|
+
# * +serviceAccount:{emailid}+: An email address that represents a service
|
93
|
+
# account. For example, +my-other-app@appspot.gserviceaccount.com+.
|
94
|
+
#
|
95
|
+
# * +group:{emailid}+: An email address that represents a Google group.
|
96
|
+
# For example, +admins@example.com+.
|
97
|
+
#
|
98
|
+
# * +domain:{domain}+: A Google Apps domain name that represents all the
|
99
|
+
# users of that domain. For example, +google.com+ or +example.com+.
|
100
|
+
class Binding; end
|
101
|
+
|
102
|
+
# The difference delta between two policies.
|
103
|
+
# @!attribute [rw] binding_deltas
|
104
|
+
# @return [Array<Google::Iam::V1::BindingDelta>]
|
105
|
+
# The delta for Bindings between two policies.
|
106
|
+
class PolicyDelta; end
|
107
|
+
|
108
|
+
# One delta entry for Binding. Each individual change (only one member in each
|
109
|
+
# entry) to a binding will be a separate entry.
|
110
|
+
# @!attribute [rw] action
|
111
|
+
# @return [Google::Iam::V1::BindingDelta::Action]
|
112
|
+
# The action that was performed on a Binding.
|
113
|
+
# Required
|
114
|
+
# @!attribute [rw] role
|
115
|
+
# @return [String]
|
116
|
+
# Role that is assigned to +members+.
|
117
|
+
# For example, +roles/viewer+, +roles/editor+, or +roles/owner+.
|
118
|
+
# Required
|
119
|
+
# @!attribute [rw] member
|
120
|
+
# @return [String]
|
121
|
+
# A single identity requesting access for a Cloud Platform resource.
|
122
|
+
# Follows the same format of Binding.members.
|
123
|
+
# Required
|
124
|
+
class BindingDelta
|
125
|
+
# The type of action performed on a Binding in a policy.
|
126
|
+
module Action
|
127
|
+
# Unspecified.
|
128
|
+
ACTION_UNSPECIFIED = 0
|
129
|
+
|
130
|
+
# Addition of a Binding.
|
131
|
+
ADD = 1
|
132
|
+
|
133
|
+
# Removal of a Binding.
|
134
|
+
REMOVE = 2
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
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
|
+
# http://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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# +Any+ contains an arbitrary serialized protocol buffer message along with a
|
18
|
+
# URL that describes the type of the serialized message.
|
19
|
+
#
|
20
|
+
# Protobuf library provides support to pack/unpack Any values in the form
|
21
|
+
# of utility functions or additional generated methods of the Any type.
|
22
|
+
#
|
23
|
+
# Example 1: Pack and unpack a message in C++.
|
24
|
+
#
|
25
|
+
# Foo foo = ...;
|
26
|
+
# Any any;
|
27
|
+
# any.PackFrom(foo);
|
28
|
+
# ...
|
29
|
+
# if (any.UnpackTo(&foo)) {
|
30
|
+
# ...
|
31
|
+
# }
|
32
|
+
#
|
33
|
+
# Example 2: Pack and unpack a message in Java.
|
34
|
+
#
|
35
|
+
# Foo foo = ...;
|
36
|
+
# Any any = Any.pack(foo);
|
37
|
+
# ...
|
38
|
+
# if (any.is(Foo.class)) {
|
39
|
+
# foo = any.unpack(Foo.class);
|
40
|
+
# }
|
41
|
+
#
|
42
|
+
# Example 3: Pack and unpack a message in Python.
|
43
|
+
#
|
44
|
+
# foo = Foo(...)
|
45
|
+
# any = Any()
|
46
|
+
# any.Pack(foo)
|
47
|
+
# ...
|
48
|
+
# if any.Is(Foo.DESCRIPTOR):
|
49
|
+
# any.Unpack(foo)
|
50
|
+
# ...
|
51
|
+
#
|
52
|
+
# The pack methods provided by protobuf library will by default use
|
53
|
+
# 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
54
|
+
# methods only use the fully qualified type name after the last '/'
|
55
|
+
# in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
56
|
+
# name "y.z".
|
57
|
+
#
|
58
|
+
#
|
59
|
+
# = JSON
|
60
|
+
#
|
61
|
+
# The JSON representation of an +Any+ value uses the regular
|
62
|
+
# representation of the deserialized, embedded message, with an
|
63
|
+
# additional field +@type+ which contains the type URL. Example:
|
64
|
+
#
|
65
|
+
# package google.profile;
|
66
|
+
# message Person {
|
67
|
+
# string first_name = 1;
|
68
|
+
# string last_name = 2;
|
69
|
+
# }
|
70
|
+
#
|
71
|
+
# {
|
72
|
+
# "@type": "type.googleapis.com/google.profile.Person",
|
73
|
+
# "firstName": <string>,
|
74
|
+
# "lastName": <string>
|
75
|
+
# }
|
76
|
+
#
|
77
|
+
# If the embedded message type is well-known and has a custom JSON
|
78
|
+
# representation, that representation will be embedded adding a field
|
79
|
+
# +value+ which holds the custom JSON in addition to the +@type+
|
80
|
+
# field. Example (for message Google::Protobuf::Duration):
|
81
|
+
#
|
82
|
+
# {
|
83
|
+
# "@type": "type.googleapis.com/google.protobuf.Duration",
|
84
|
+
# "value": "1.212s"
|
85
|
+
# }
|
86
|
+
# @!attribute [rw] type_url
|
87
|
+
# @return [String]
|
88
|
+
# A URL/resource name whose content describes the type of the
|
89
|
+
# serialized protocol buffer message.
|
90
|
+
#
|
91
|
+
# For URLs which use the scheme +http+, +https+, or no scheme, the
|
92
|
+
# following restrictions and interpretations apply:
|
93
|
+
#
|
94
|
+
# * If no scheme is provided, +https+ is assumed.
|
95
|
+
# * The last segment of the URL's path must represent the fully
|
96
|
+
# qualified name of the type (as in +path/google.protobuf.Duration+).
|
97
|
+
# The name should be in a canonical form (e.g., leading "." is
|
98
|
+
# not accepted).
|
99
|
+
# * An HTTP GET on the URL must yield a Google::Protobuf::Type
|
100
|
+
# value in binary format, or produce an error.
|
101
|
+
# * Applications are allowed to cache lookup results based on the
|
102
|
+
# URL, or have them precompiled into a binary to avoid any
|
103
|
+
# lookup. Therefore, binary compatibility needs to be preserved
|
104
|
+
# on changes to types. (Use versioned type names to manage
|
105
|
+
# breaking changes.)
|
106
|
+
#
|
107
|
+
# Schemes other than +http+, +https+ (or the empty scheme) might be
|
108
|
+
# used with implementation specific semantics.
|
109
|
+
# @!attribute [rw] value
|
110
|
+
# @return [String]
|
111
|
+
# Must be a valid serialized protocol buffer of the above specified type.
|
112
|
+
class Any; end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,223 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
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
|
+
# http://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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# +FieldMask+ represents a set of symbolic field paths, for example:
|
18
|
+
#
|
19
|
+
# paths: "f.a"
|
20
|
+
# paths: "f.b.d"
|
21
|
+
#
|
22
|
+
# Here +f+ represents a field in some root message, +a+ and +b+
|
23
|
+
# fields in the message found in +f+, and +d+ a field found in the
|
24
|
+
# message in +f.b+.
|
25
|
+
#
|
26
|
+
# Field masks are used to specify a subset of fields that should be
|
27
|
+
# returned by a get operation or modified by an update operation.
|
28
|
+
# Field masks also have a custom JSON encoding (see below).
|
29
|
+
#
|
30
|
+
# = Field Masks in Projections
|
31
|
+
#
|
32
|
+
# When used in the context of a projection, a response message or
|
33
|
+
# sub-message is filtered by the API to only contain those fields as
|
34
|
+
# specified in the mask. For example, if the mask in the previous
|
35
|
+
# example is applied to a response message as follows:
|
36
|
+
#
|
37
|
+
# f {
|
38
|
+
# a : 22
|
39
|
+
# b {
|
40
|
+
# d : 1
|
41
|
+
# x : 2
|
42
|
+
# }
|
43
|
+
# y : 13
|
44
|
+
# }
|
45
|
+
# z: 8
|
46
|
+
#
|
47
|
+
# The result will not contain specific values for fields x,y and z
|
48
|
+
# (their value will be set to the default, and omitted in proto text
|
49
|
+
# output):
|
50
|
+
#
|
51
|
+
#
|
52
|
+
# f {
|
53
|
+
# a : 22
|
54
|
+
# b {
|
55
|
+
# d : 1
|
56
|
+
# }
|
57
|
+
# }
|
58
|
+
#
|
59
|
+
# A repeated field is not allowed except at the last position of a
|
60
|
+
# paths string.
|
61
|
+
#
|
62
|
+
# If a FieldMask object is not present in a get operation, the
|
63
|
+
# operation applies to all fields (as if a FieldMask of all fields
|
64
|
+
# had been specified).
|
65
|
+
#
|
66
|
+
# Note that a field mask does not necessarily apply to the
|
67
|
+
# top-level response message. In case of a REST get operation, the
|
68
|
+
# field mask applies directly to the response, but in case of a REST
|
69
|
+
# list operation, the mask instead applies to each individual message
|
70
|
+
# in the returned resource list. In case of a REST custom method,
|
71
|
+
# other definitions may be used. Where the mask applies will be
|
72
|
+
# clearly documented together with its declaration in the API. In
|
73
|
+
# any case, the effect on the returned resource/resources is required
|
74
|
+
# behavior for APIs.
|
75
|
+
#
|
76
|
+
# = Field Masks in Update Operations
|
77
|
+
#
|
78
|
+
# A field mask in update operations specifies which fields of the
|
79
|
+
# targeted resource are going to be updated. The API is required
|
80
|
+
# to only change the values of the fields as specified in the mask
|
81
|
+
# and leave the others untouched. If a resource is passed in to
|
82
|
+
# describe the updated values, the API ignores the values of all
|
83
|
+
# fields not covered by the mask.
|
84
|
+
#
|
85
|
+
# If a repeated field is specified for an update operation, the existing
|
86
|
+
# repeated values in the target resource will be overwritten by the new values.
|
87
|
+
# Note that a repeated field is only allowed in the last position of a +paths+
|
88
|
+
# string.
|
89
|
+
#
|
90
|
+
# If a sub-message is specified in the last position of the field mask for an
|
91
|
+
# update operation, then the existing sub-message in the target resource is
|
92
|
+
# overwritten. Given the target message:
|
93
|
+
#
|
94
|
+
# f {
|
95
|
+
# b {
|
96
|
+
# d : 1
|
97
|
+
# x : 2
|
98
|
+
# }
|
99
|
+
# c : 1
|
100
|
+
# }
|
101
|
+
#
|
102
|
+
# And an update message:
|
103
|
+
#
|
104
|
+
# f {
|
105
|
+
# b {
|
106
|
+
# d : 10
|
107
|
+
# }
|
108
|
+
# }
|
109
|
+
#
|
110
|
+
# then if the field mask is:
|
111
|
+
#
|
112
|
+
# paths: "f.b"
|
113
|
+
#
|
114
|
+
# then the result will be:
|
115
|
+
#
|
116
|
+
# f {
|
117
|
+
# b {
|
118
|
+
# d : 10
|
119
|
+
# }
|
120
|
+
# c : 1
|
121
|
+
# }
|
122
|
+
#
|
123
|
+
# However, if the update mask was:
|
124
|
+
#
|
125
|
+
# paths: "f.b.d"
|
126
|
+
#
|
127
|
+
# then the result would be:
|
128
|
+
#
|
129
|
+
# f {
|
130
|
+
# b {
|
131
|
+
# d : 10
|
132
|
+
# x : 2
|
133
|
+
# }
|
134
|
+
# c : 1
|
135
|
+
# }
|
136
|
+
#
|
137
|
+
# In order to reset a field's value to the default, the field must
|
138
|
+
# be in the mask and set to the default value in the provided resource.
|
139
|
+
# Hence, in order to reset all fields of a resource, provide a default
|
140
|
+
# instance of the resource and set all fields in the mask, or do
|
141
|
+
# not provide a mask as described below.
|
142
|
+
#
|
143
|
+
# If a field mask is not present on update, the operation applies to
|
144
|
+
# all fields (as if a field mask of all fields has been specified).
|
145
|
+
# Note that in the presence of schema evolution, this may mean that
|
146
|
+
# fields the client does not know and has therefore not filled into
|
147
|
+
# the request will be reset to their default. If this is unwanted
|
148
|
+
# behavior, a specific service may require a client to always specify
|
149
|
+
# a field mask, producing an error if not.
|
150
|
+
#
|
151
|
+
# As with get operations, the location of the resource which
|
152
|
+
# describes the updated values in the request message depends on the
|
153
|
+
# operation kind. In any case, the effect of the field mask is
|
154
|
+
# required to be honored by the API.
|
155
|
+
#
|
156
|
+
# == Considerations for HTTP REST
|
157
|
+
#
|
158
|
+
# The HTTP kind of an update operation which uses a field mask must
|
159
|
+
# be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
160
|
+
# (PUT must only be used for full updates).
|
161
|
+
#
|
162
|
+
# = JSON Encoding of Field Masks
|
163
|
+
#
|
164
|
+
# In JSON, a field mask is encoded as a single string where paths are
|
165
|
+
# separated by a comma. Fields name in each path are converted
|
166
|
+
# to/from lower-camel naming conventions.
|
167
|
+
#
|
168
|
+
# As an example, consider the following message declarations:
|
169
|
+
#
|
170
|
+
# message Profile {
|
171
|
+
# User user = 1;
|
172
|
+
# Photo photo = 2;
|
173
|
+
# }
|
174
|
+
# message User {
|
175
|
+
# string display_name = 1;
|
176
|
+
# string address = 2;
|
177
|
+
# }
|
178
|
+
#
|
179
|
+
# In proto a field mask for +Profile+ may look as such:
|
180
|
+
#
|
181
|
+
# mask {
|
182
|
+
# paths: "user.display_name"
|
183
|
+
# paths: "photo"
|
184
|
+
# }
|
185
|
+
#
|
186
|
+
# In JSON, the same mask is represented as below:
|
187
|
+
#
|
188
|
+
# {
|
189
|
+
# mask: "user.displayName,photo"
|
190
|
+
# }
|
191
|
+
#
|
192
|
+
# = Field Masks and Oneof Fields
|
193
|
+
#
|
194
|
+
# Field masks treat fields in oneofs just as regular fields. Consider the
|
195
|
+
# following message:
|
196
|
+
#
|
197
|
+
# message SampleMessage {
|
198
|
+
# oneof test_oneof {
|
199
|
+
# string name = 4;
|
200
|
+
# SubMessage sub_message = 9;
|
201
|
+
# }
|
202
|
+
# }
|
203
|
+
#
|
204
|
+
# The field mask can be:
|
205
|
+
#
|
206
|
+
# mask {
|
207
|
+
# paths: "name"
|
208
|
+
# }
|
209
|
+
#
|
210
|
+
# Or:
|
211
|
+
#
|
212
|
+
# mask {
|
213
|
+
# paths: "sub_message"
|
214
|
+
# }
|
215
|
+
#
|
216
|
+
# Note that oneof type names ("test_oneof" in this case) cannot be used in
|
217
|
+
# paths.
|
218
|
+
# @!attribute [rw] paths
|
219
|
+
# @return [Array<String>]
|
220
|
+
# The set of field mask paths.
|
221
|
+
class FieldMask; end
|
222
|
+
end
|
223
|
+
end
|