google-cloud-monitoring 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -5
  3. data/lib/google/cloud/monitoring.rb +164 -6
  4. data/lib/google/cloud/monitoring/credentials.rb +1 -1
  5. data/lib/google/cloud/monitoring/v3.rb +167 -26
  6. data/lib/google/cloud/monitoring/v3/alert_policy_service_client.rb +486 -0
  7. data/lib/google/cloud/monitoring/v3/alert_policy_service_client_config.json +51 -0
  8. data/lib/google/cloud/monitoring/v3/doc/google/api/distribution.rb +1 -1
  9. data/lib/google/cloud/monitoring/v3/doc/google/api/label.rb +1 -1
  10. data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +1 -1
  11. data/lib/google/cloud/monitoring/v3/doc/google/api/monitored_resource.rb +1 -1
  12. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +326 -0
  13. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/common.rb +91 -3
  14. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group.rb +1 -1
  15. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +1 -1
  16. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/mutation_record.rb +28 -0
  17. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification.rb +152 -0
  18. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +223 -0
  19. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/duration.rb +1 -1
  20. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/field_mask.rb +223 -0
  21. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/timestamp.rb +1 -1
  22. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/wrappers.rb +89 -0
  23. data/lib/google/cloud/monitoring/v3/doc/overview.rb +8 -7
  24. data/lib/google/cloud/monitoring/v3/group_service_client.rb +13 -21
  25. data/lib/google/cloud/monitoring/v3/metric_service_client.rb +19 -21
  26. data/lib/google/cloud/monitoring/v3/notification_channel_service_client.rb +557 -0
  27. data/lib/google/cloud/monitoring/v3/notification_channel_service_client_config.json +61 -0
  28. data/lib/google/cloud/monitoring/v3/uptime_check_service_client.rb +476 -0
  29. data/lib/google/cloud/monitoring/v3/uptime_check_service_client_config.json +56 -0
  30. data/lib/google/monitoring/v3/alert_pb.rb +78 -0
  31. data/lib/google/monitoring/v3/alert_service_pb.rb +49 -0
  32. data/lib/google/monitoring/v3/alert_service_services_pb.rb +62 -0
  33. data/lib/google/monitoring/v3/common_pb.rb +20 -0
  34. data/lib/google/monitoring/v3/group_service_services_pb.rb +1 -1
  35. data/lib/google/monitoring/v3/metric_service_services_pb.rb +1 -1
  36. data/lib/google/monitoring/v3/mutation_record_pb.rb +20 -0
  37. data/lib/google/monitoring/v3/notification_pb.rb +44 -0
  38. data/lib/google/monitoring/v3/notification_service_pb.rb +85 -0
  39. data/lib/google/monitoring/v3/notification_service_services_pb.rb +93 -0
  40. data/lib/google/monitoring/v3/uptime_pb.rb +89 -0
  41. data/lib/google/monitoring/v3/uptime_service_pb.rb +57 -0
  42. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +66 -0
  43. metadata +31 -9
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -0,0 +1,28 @@
1
+ # Copyright 2018 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
+ module Google
16
+ module Monitoring
17
+ module V3
18
+ # Describes a change made to a configuration.
19
+ # @!attribute [rw] mutate_time
20
+ # @return [Google::Protobuf::Timestamp]
21
+ # When the change occurred.
22
+ # @!attribute [rw] mutated_by
23
+ # @return [String]
24
+ # The email address of the user making the change.
25
+ class MutationRecord; end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,152 @@
1
+ # Copyright 2018 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
+ module Google
16
+ module Monitoring
17
+ module V3
18
+ # A description of a notification channel. The descriptor includes
19
+ # the properties of the channel and the set of labels or fields that
20
+ # must be specified to configure channels of a given type.
21
+ # @!attribute [rw] name
22
+ # @return [String]
23
+ # The full REST resource name for this descriptor. The syntax is:
24
+ #
25
+ # projects/[PROJECT_ID]/notificationChannelDescriptors/[TYPE]
26
+ #
27
+ # In the above, +[TYPE]+ is the value of the +type+ field.
28
+ # @!attribute [rw] type
29
+ # @return [String]
30
+ # The type of notification channel, such as "email", "sms", etc.
31
+ # Notification channel types are globally unique.
32
+ # @!attribute [rw] display_name
33
+ # @return [String]
34
+ # A human-readable name for the notification channel type. This
35
+ # form of the name is suitable for a user interface.
36
+ # @!attribute [rw] description
37
+ # @return [String]
38
+ # A human-readable description of the notification channel
39
+ # type. The description may include a description of the properties
40
+ # of the channel and pointers to external documentation.
41
+ # @!attribute [rw] labels
42
+ # @return [Array<Google::Api::LabelDescriptor>]
43
+ # The set of labels that must be defined to identify a particular
44
+ # channel of the corresponding type. Each label includes a
45
+ # description for how that field should be populated.
46
+ # @!attribute [rw] supported_tiers
47
+ # @return [Array<Google::Monitoring::V3::ServiceTier>]
48
+ # The tiers that support this notification channel; the project service tier
49
+ # must be one of the supported_tiers.
50
+ class NotificationChannelDescriptor; end
51
+
52
+ # A +NotificationChannel+ is a medium through which an alert is
53
+ # delivered when a policy violation is detected. Examples of channels
54
+ # include email, SMS, and third-party messaging applications. Fields
55
+ # containing sensitive information like authentication tokens or
56
+ # contact info are only partially populated on retrieval.
57
+ # @!attribute [rw] type
58
+ # @return [String]
59
+ # The type of the notification channel. This field matches the
60
+ # value of the {Google::Monitoring::V3::NotificationChannelDescriptor#type NotificationChannelDescriptor#type} field.
61
+ # @!attribute [rw] name
62
+ # @return [String]
63
+ # The full REST resource name for this channel. The syntax is:
64
+ #
65
+ # projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
66
+ #
67
+ # The +[CHANNEL_ID]+ is automatically assigned by the server on creation.
68
+ # @!attribute [rw] display_name
69
+ # @return [String]
70
+ # An optional human-readable name for this notification channel. It is
71
+ # recommended that you specify a non-empty and unique name in order to
72
+ # make it easier to identify the channels in your project, though this is
73
+ # not enforced. The display name is limited to 512 Unicode characters.
74
+ # @!attribute [rw] description
75
+ # @return [String]
76
+ # An optional human-readable description of this notification channel. This
77
+ # description may provide additional details, beyond the display
78
+ # name, for the channel. This may not exceeed 1024 Unicode characters.
79
+ # @!attribute [rw] labels
80
+ # @return [Hash{String => String}]
81
+ # Configuration fields that define the channel and its behavior. The
82
+ # permissible and required labels are specified in the
83
+ # {Google::Monitoring::V3::NotificationChannelDescriptor#labels NotificationChannelDescriptor#labels} of the
84
+ # +NotificationChannelDescriptor+ corresponding to the +type+ field.
85
+ # @!attribute [rw] user_labels
86
+ # @return [Hash{String => String}]
87
+ # User-supplied key/value data that does not need to conform to
88
+ # the corresponding +NotificationChannelDescriptor+'s schema, unlike
89
+ # the +labels+ field. This field is intended to be used for organizing
90
+ # and identifying the +NotificationChannel+ objects.
91
+ #
92
+ # The field can contain up to 64 entries. Each key and value is limited to
93
+ # 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
94
+ # values can contain only lowercase letters, numerals, underscores, and
95
+ # dashes. Keys must begin with a letter.
96
+ # @!attribute [rw] verification_status
97
+ # @return [Google::Monitoring::V3::NotificationChannel::VerificationStatus]
98
+ # Indicates whether this channel has been verified or not. On a
99
+ # {Google::Monitoring::V3::NotificationChannelService::ListNotificationChannels +ListNotificationChannels+}
100
+ # or
101
+ # {Google::Monitoring::V3::NotificationChannelService::GetNotificationChannel +GetNotificationChannel+}
102
+ # operation, this field is expected to be populated.
103
+ #
104
+ # If the value is +UNVERIFIED+, then it indicates that the channel is
105
+ # non-functioning (it both requires verification and lacks verification);
106
+ # otherwise, it is assumed that the channel works.
107
+ #
108
+ # If the channel is neither +VERIFIED+ nor +UNVERIFIED+, it implies that
109
+ # the channel is of a type that does not require verification or that
110
+ # this specific channel has been exempted from verification because it was
111
+ # created prior to verification being required for channels of this type.
112
+ #
113
+ # This field cannot be modified using a standard
114
+ # {Google::Monitoring::V3::NotificationChannelService::UpdateNotificationChannel +UpdateNotificationChannel+}
115
+ # operation. To change the value of this field, you must call
116
+ # {Google::Monitoring::V3::NotificationChannelService::VerifyNotificationChannel +VerifyNotificationChannel+}.
117
+ # @!attribute [rw] enabled
118
+ # @return [Google::Protobuf::BoolValue]
119
+ # Whether notifications are forwarded to the described channel. This makes
120
+ # it possible to disable delivery of notifications to a particular channel
121
+ # without removing the channel from all alerting policies that reference
122
+ # the channel. This is a more convenient approach when the change is
123
+ # temporary and you want to receive notifications from the same set
124
+ # of alerting policies on the channel at some point in the future.
125
+ class NotificationChannel
126
+ # Indicates whether the channel has been verified or not. It is illegal
127
+ # to specify this field in a
128
+ # {Google::Monitoring::V3::NotificationChannelService::CreateNotificationChannel +CreateNotificationChannel+}
129
+ # or an
130
+ # {Google::Monitoring::V3::NotificationChannelService::UpdateNotificationChannel +UpdateNotificationChannel+}
131
+ # operation.
132
+ module VerificationStatus
133
+ # Sentinel value used to indicate that the state is unknown, omitted, or
134
+ # is not applicable (as in the case of channels that neither support
135
+ # nor require verification in order to function).
136
+ VERIFICATION_STATUS_UNSPECIFIED = 0
137
+
138
+ # The channel has yet to be verified and requires verification to function.
139
+ # Note that this state also applies to the case where the verification
140
+ # process has been initiated by sending a verification code but where
141
+ # the verification code has not been submitted to complete the process.
142
+ UNVERIFIED = 1
143
+
144
+ # It has been proven that notifications can be received on this
145
+ # notification channel and that someone on the project has access
146
+ # to messages that are delivered to that channel.
147
+ VERIFIED = 2
148
+ end
149
+ end
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,223 @@
1
+ # Copyright 2018 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
+ module Google
16
+ module Monitoring
17
+ module V3
18
+ # This message configures which resources and services to monitor for
19
+ # availability.
20
+ # @!attribute [rw] name
21
+ # @return [String]
22
+ # A unique resource name for this UptimeCheckConfig. The format is:
23
+ #
24
+ #
25
+ # +projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]+.
26
+ #
27
+ # This field should be omitted when creating the uptime check configuration;
28
+ # on create, the resource name is assigned by the server and included in the
29
+ # response.
30
+ # @!attribute [rw] display_name
31
+ # @return [String]
32
+ # A human-friendly name for the uptime check configuration. The display name
33
+ # should be unique within a Stackdriver Account in order to make it easier
34
+ # to identify; however, uniqueness is not enforced. Required.
35
+ # @!attribute [rw] monitored_resource
36
+ # @return [Google::Api::MonitoredResource]
37
+ # The monitored resource associated with the configuration.
38
+ # @!attribute [rw] resource_group
39
+ # @return [Google::Monitoring::V3::UptimeCheckConfig::ResourceGroup]
40
+ # The group resource associated with the configuration.
41
+ # @!attribute [rw] http_check
42
+ # @return [Google::Monitoring::V3::UptimeCheckConfig::HttpCheck]
43
+ # Contains information needed to make an HTTP or HTTPS check.
44
+ # @!attribute [rw] tcp_check
45
+ # @return [Google::Monitoring::V3::UptimeCheckConfig::TcpCheck]
46
+ # Contains information needed to make a TCP check.
47
+ # @!attribute [rw] period
48
+ # @return [Google::Protobuf::Duration]
49
+ # How often the uptime check is performed.
50
+ # Currently, only 1, 5, 10, and 15 minutes are supported. Required.
51
+ # @!attribute [rw] timeout
52
+ # @return [Google::Protobuf::Duration]
53
+ # The maximum amount of time to wait for the request to complete (must be
54
+ # between 1 and 60 seconds). Required.
55
+ # @!attribute [rw] content_matchers
56
+ # @return [Array<Google::Monitoring::V3::UptimeCheckConfig::ContentMatcher>]
57
+ # The expected content on the page the check is run against.
58
+ # Currently, only the first entry in the list is supported, and other entries
59
+ # will be ignored. The server will look for an exact match of the string in
60
+ # the page response's content. This field is optional and should only be
61
+ # specified if a content match is required.
62
+ # @!attribute [rw] selected_regions
63
+ # @return [Array<Google::Monitoring::V3::UptimeCheckRegion>]
64
+ # The list of regions from which the check will be run.
65
+ # If this field is specified, enough regions to include a minimum of
66
+ # 3 locations must be provided, or an error message is returned.
67
+ # Not specifying this field will result in uptime checks running from all
68
+ # regions.
69
+ # @!attribute [rw] internal_checkers
70
+ # @return [Array<Google::Monitoring::V3::UptimeCheckConfig::InternalChecker>]
71
+ # The internal checkers that this check will egress from.
72
+ class UptimeCheckConfig
73
+ # The resource submessage for group checks. It can be used instead of a
74
+ # monitored resource, when multiple resources are being monitored.
75
+ # @!attribute [rw] group_id
76
+ # @return [String]
77
+ # The group of resources being monitored. Should be only the
78
+ # group_id, not projects/<project_id>/groups/<group_id>.
79
+ # @!attribute [rw] resource_type
80
+ # @return [Google::Monitoring::V3::GroupResourceType]
81
+ # The resource type of the group members.
82
+ class ResourceGroup; end
83
+
84
+ # Information involved in an HTTP/HTTPS uptime check request.
85
+ # @!attribute [rw] use_ssl
86
+ # @return [true, false]
87
+ # If true, use HTTPS instead of HTTP to run the check.
88
+ # @!attribute [rw] path
89
+ # @return [String]
90
+ # The path to the page to run the check against. Will be combined with the
91
+ # host (specified within the MonitoredResource) and port to construct the
92
+ # full URL. Optional (defaults to "/").
93
+ # @!attribute [rw] port
94
+ # @return [Integer]
95
+ # The port to the page to run the check against. Will be combined with host
96
+ # (specified within the MonitoredResource) and path to construct the full
97
+ # URL. Optional (defaults to 80 without SSL, or 443 with SSL).
98
+ # @!attribute [rw] auth_info
99
+ # @return [Google::Monitoring::V3::UptimeCheckConfig::HttpCheck::BasicAuthentication]
100
+ # The authentication information. Optional when creating an HTTP check;
101
+ # defaults to empty.
102
+ # @!attribute [rw] mask_headers
103
+ # @return [true, false]
104
+ # Boolean specifiying whether to encrypt the header information.
105
+ # Encryption should be specified for any headers related to authentication
106
+ # that you do not wish to be seen when retrieving the configuration. The
107
+ # server will be responsible for encrypting the headers.
108
+ # On Get/List calls, if mask_headers is set to True then the headers
109
+ # will be obscured with ******.
110
+ # @!attribute [rw] headers
111
+ # @return [Hash{String => String}]
112
+ # The list of headers to send as part of the uptime check request.
113
+ # If two headers have the same key and different values, they should
114
+ # be entered as a single header, with the value being a comma-separated
115
+ # list of all the desired values as described at
116
+ # https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31).
117
+ # Entering two separate headers with the same key in a Create call will
118
+ # cause the first to be overwritten by the second.
119
+ class HttpCheck
120
+ # A type of authentication to perform against the specified resource or URL
121
+ # that uses username and password.
122
+ # Currently, only Basic authentication is supported in Uptime Monitoring.
123
+ # @!attribute [rw] username
124
+ # @return [String]
125
+ # The username to authenticate.
126
+ # @!attribute [rw] password
127
+ # @return [String]
128
+ # The password to authenticate.
129
+ class BasicAuthentication; end
130
+ end
131
+
132
+ # Information required for a TCP uptime check request.
133
+ # @!attribute [rw] port
134
+ # @return [Integer]
135
+ # The port to the page to run the check against. Will be combined with host
136
+ # (specified within the MonitoredResource) to construct the full URL.
137
+ # Required.
138
+ class TcpCheck; end
139
+
140
+ # Used to perform string matching. Currently, this matches on the exact
141
+ # content. In the future, it can be expanded to allow for regular expressions
142
+ # and more complex matching.
143
+ # @!attribute [rw] content
144
+ # @return [String]
145
+ # String content to match
146
+ class ContentMatcher; end
147
+
148
+ # Nimbus InternalCheckers.
149
+ # @!attribute [rw] project_id
150
+ # @return [String]
151
+ # The GCP project ID. Not necessarily the same as the project_id for the config.
152
+ # @!attribute [rw] network
153
+ # @return [String]
154
+ # The internal network to perform this uptime check on.
155
+ # @!attribute [rw] gcp_zone
156
+ # @return [String]
157
+ # The GCP zone the uptime check should egress from. Only respected for
158
+ # internal uptime checks, where internal_network is specified.
159
+ # @!attribute [rw] checker_id
160
+ # @return [String]
161
+ # The checker ID.
162
+ # @!attribute [rw] display_name
163
+ # @return [String]
164
+ # The checker's human-readable name.
165
+ class InternalChecker; end
166
+ end
167
+
168
+ # Contains the region, location, and list of IP
169
+ # addresses where checkers in the location run from.
170
+ # @!attribute [rw] region
171
+ # @return [Google::Monitoring::V3::UptimeCheckRegion]
172
+ # A broad region category in which the IP address is located.
173
+ # @!attribute [rw] location
174
+ # @return [String]
175
+ # A more specific location within the region that typically encodes
176
+ # a particular city/town/metro (and its containing state/province or country)
177
+ # within the broader umbrella region category.
178
+ # @!attribute [rw] ip_address
179
+ # @return [String]
180
+ # The IP address from which the uptime check originates. This is a full
181
+ # IP address (not an IP address range). Most IP addresses, as of this
182
+ # publication, are in IPv4 format; however, one should not rely on the
183
+ # IP addresses being in IPv4 format indefinitely and should support
184
+ # interpreting this field in either IPv4 or IPv6 format.
185
+ class UptimeCheckIp; end
186
+
187
+ # The regions from which an uptime check can be run.
188
+ module UptimeCheckRegion
189
+ # Default value if no region is specified. Will result in uptime checks
190
+ # running from all regions.
191
+ REGION_UNSPECIFIED = 0
192
+
193
+ # Allows checks to run from locations within the United States of America.
194
+ USA = 1
195
+
196
+ # Allows checks to run from locations within the continent of Europe.
197
+ EUROPE = 2
198
+
199
+ # Allows checks to run from locations within the continent of South
200
+ # America.
201
+ SOUTH_AMERICA = 3
202
+
203
+ # Allows checks to run from locations within the Asia Pacific area (ex:
204
+ # Singapore).
205
+ ASIA_PACIFIC = 4
206
+ end
207
+
208
+ # The supported resource types that can be used as values of
209
+ # group_resource.resource_type. gae_app and uptime_url are not allowed
210
+ # because group checks on App Engine modules and URLs are not allowed.
211
+ module GroupResourceType
212
+ # Default value (not valid).
213
+ RESOURCE_TYPE_UNSPECIFIED = 0
214
+
215
+ # A group of instances (could be either GCE or AWS_EC2).
216
+ INSTANCE = 1
217
+
218
+ # A group of AWS load balancers.
219
+ AWS_ELB_LOAD_BALANCER = 2
220
+ end
221
+ end
222
+ end
223
+ end
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -0,0 +1,223 @@
1
+ # Copyright 2018 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
+ 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