google-cloud-asset 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +9 -0
- data/LICENSE +201 -0
- data/README.md +68 -0
- data/lib/google/cloud/asset.rb +140 -0
- data/lib/google/cloud/asset/v1beta1.rb +137 -0
- data/lib/google/cloud/asset/v1beta1/asset_service_client.rb +370 -0
- data/lib/google/cloud/asset/v1beta1/asset_service_client_config.json +36 -0
- data/lib/google/cloud/asset/v1beta1/asset_service_pb.rb +61 -0
- data/lib/google/cloud/asset/v1beta1/asset_service_services_pb.rb +56 -0
- data/lib/google/cloud/asset/v1beta1/assets_pb.rb +49 -0
- data/lib/google/cloud/asset/v1beta1/credentials.rb +41 -0
- data/lib/google/cloud/asset/v1beta1/doc/google/cloud/asset/v1beta1/asset_service.rb +118 -0
- data/lib/google/cloud/asset/v1beta1/doc/google/cloud/asset/v1beta1/assets.rb +104 -0
- data/lib/google/cloud/asset/v1beta1/doc/google/iam/v1/policy.rb +128 -0
- data/lib/google/cloud/asset/v1beta1/doc/google/longrunning/operations.rb +93 -0
- data/lib/google/cloud/asset/v1beta1/doc/google/protobuf/any.rb +130 -0
- data/lib/google/cloud/asset/v1beta1/doc/google/protobuf/struct.rb +74 -0
- data/lib/google/cloud/asset/v1beta1/doc/google/protobuf/timestamp.rb +109 -0
- data/lib/google/cloud/asset/v1beta1/doc/google/rpc/status.rb +84 -0
- metadata +160 -0
@@ -0,0 +1,93 @@
|
|
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
|
+
|
16
|
+
module Google
|
17
|
+
module Longrunning
|
18
|
+
# This resource represents a long-running operation that is the result of a
|
19
|
+
# network API call.
|
20
|
+
# @!attribute [rw] name
|
21
|
+
# @return [String]
|
22
|
+
# The server-assigned name, which is only unique within the same service that
|
23
|
+
# originally returns it. If you use the default HTTP mapping, the
|
24
|
+
# `name` should have the format of `operations/some/unique/name`.
|
25
|
+
# @!attribute [rw] metadata
|
26
|
+
# @return [Google::Protobuf::Any]
|
27
|
+
# Service-specific metadata associated with the operation. It typically
|
28
|
+
# contains progress information and common metadata such as create time.
|
29
|
+
# Some services might not provide such metadata. Any method that returns a
|
30
|
+
# long-running operation should document the metadata type, if any.
|
31
|
+
# @!attribute [rw] done
|
32
|
+
# @return [true, false]
|
33
|
+
# If the value is `false`, it means the operation is still in progress.
|
34
|
+
# If true, the operation is completed, and either `error` or `response` is
|
35
|
+
# available.
|
36
|
+
# @!attribute [rw] error
|
37
|
+
# @return [Google::Rpc::Status]
|
38
|
+
# The error result of the operation in case of failure or cancellation.
|
39
|
+
# @!attribute [rw] response
|
40
|
+
# @return [Google::Protobuf::Any]
|
41
|
+
# The normal response of the operation in case of success. If the original
|
42
|
+
# method returns no data on success, such as `Delete`, the response is
|
43
|
+
# `google.protobuf.Empty`. If the original method is standard
|
44
|
+
# `Get`/`Create`/`Update`, the response should be the resource. For other
|
45
|
+
# methods, the response should have the type `XxxResponse`, where `Xxx`
|
46
|
+
# is the original method name. For example, if the original method name
|
47
|
+
# is `TakeSnapshot()`, the inferred response type is
|
48
|
+
# `TakeSnapshotResponse`.
|
49
|
+
class Operation; end
|
50
|
+
|
51
|
+
# The request message for {Google::Longrunning::Operations::GetOperation Operations::GetOperation}.
|
52
|
+
# @!attribute [rw] name
|
53
|
+
# @return [String]
|
54
|
+
# The name of the operation resource.
|
55
|
+
class GetOperationRequest; end
|
56
|
+
|
57
|
+
# The request message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
|
58
|
+
# @!attribute [rw] name
|
59
|
+
# @return [String]
|
60
|
+
# The name of the operation collection.
|
61
|
+
# @!attribute [rw] filter
|
62
|
+
# @return [String]
|
63
|
+
# The standard list filter.
|
64
|
+
# @!attribute [rw] page_size
|
65
|
+
# @return [Integer]
|
66
|
+
# The standard list page size.
|
67
|
+
# @!attribute [rw] page_token
|
68
|
+
# @return [String]
|
69
|
+
# The standard list page token.
|
70
|
+
class ListOperationsRequest; end
|
71
|
+
|
72
|
+
# The response message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
|
73
|
+
# @!attribute [rw] operations
|
74
|
+
# @return [Array<Google::Longrunning::Operation>]
|
75
|
+
# A list of operations that matches the specified filter in the request.
|
76
|
+
# @!attribute [rw] next_page_token
|
77
|
+
# @return [String]
|
78
|
+
# The standard List next-page token.
|
79
|
+
class ListOperationsResponse; end
|
80
|
+
|
81
|
+
# The request message for {Google::Longrunning::Operations::CancelOperation Operations::CancelOperation}.
|
82
|
+
# @!attribute [rw] name
|
83
|
+
# @return [String]
|
84
|
+
# The name of the operation resource to be cancelled.
|
85
|
+
class CancelOperationRequest; end
|
86
|
+
|
87
|
+
# The request message for {Google::Longrunning::Operations::DeleteOperation Operations::DeleteOperation}.
|
88
|
+
# @!attribute [rw] name
|
89
|
+
# @return [String]
|
90
|
+
# The name of the operation resource to be deleted.
|
91
|
+
class DeleteOperationRequest; end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,130 @@
|
|
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
|
+
|
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. The last segment of the URL's path must represent
|
101
|
+
# the fully qualified name of the type (as in
|
102
|
+
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
103
|
+
# (e.g., leading "." is not accepted).
|
104
|
+
#
|
105
|
+
# In practice, teams usually precompile into the binary all types that they
|
106
|
+
# expect it to use in the context of Any. However, for URLs which use the
|
107
|
+
# scheme `http`, `https`, or no scheme, one can optionally set up a type
|
108
|
+
# server that maps type URLs to message definitions as follows:
|
109
|
+
#
|
110
|
+
# * If no scheme is provided, `https` is assumed.
|
111
|
+
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
112
|
+
# value in binary format, or produce an error.
|
113
|
+
# * Applications are allowed to cache lookup results based on the
|
114
|
+
# URL, or have them precompiled into a binary to avoid any
|
115
|
+
# lookup. Therefore, binary compatibility needs to be preserved
|
116
|
+
# on changes to types. (Use versioned type names to manage
|
117
|
+
# breaking changes.)
|
118
|
+
#
|
119
|
+
# Note: this functionality is not currently available in the official
|
120
|
+
# protobuf release, and it is not used for type URLs beginning with
|
121
|
+
# type.googleapis.com.
|
122
|
+
#
|
123
|
+
# Schemes other than `http`, `https` (or the empty scheme) might be
|
124
|
+
# used with implementation specific semantics.
|
125
|
+
# @!attribute [rw] value
|
126
|
+
# @return [String]
|
127
|
+
# Must be a valid serialized protocol buffer of the above specified type.
|
128
|
+
class Any; end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,74 @@
|
|
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
|
+
|
16
|
+
module Google
|
17
|
+
module Protobuf
|
18
|
+
# `Struct` represents a structured data value, consisting of fields
|
19
|
+
# which map to dynamically typed values. In some languages, `Struct`
|
20
|
+
# might be supported by a native representation. For example, in
|
21
|
+
# scripting languages like JS a struct is represented as an
|
22
|
+
# object. The details of that representation are described together
|
23
|
+
# with the proto support for the language.
|
24
|
+
#
|
25
|
+
# The JSON representation for `Struct` is JSON object.
|
26
|
+
# @!attribute [rw] fields
|
27
|
+
# @return [Hash{String => Google::Protobuf::Value}]
|
28
|
+
# Unordered map of dynamically typed values.
|
29
|
+
class Struct; end
|
30
|
+
|
31
|
+
# `Value` represents a dynamically typed value which can be either
|
32
|
+
# null, a number, a string, a boolean, a recursive struct value, or a
|
33
|
+
# list of values. A producer of value is expected to set one of that
|
34
|
+
# variants, absence of any variant indicates an error.
|
35
|
+
#
|
36
|
+
# The JSON representation for `Value` is JSON value.
|
37
|
+
# @!attribute [rw] null_value
|
38
|
+
# @return [Google::Protobuf::NullValue]
|
39
|
+
# Represents a null value.
|
40
|
+
# @!attribute [rw] number_value
|
41
|
+
# @return [Float]
|
42
|
+
# Represents a double value.
|
43
|
+
# @!attribute [rw] string_value
|
44
|
+
# @return [String]
|
45
|
+
# Represents a string value.
|
46
|
+
# @!attribute [rw] bool_value
|
47
|
+
# @return [true, false]
|
48
|
+
# Represents a boolean value.
|
49
|
+
# @!attribute [rw] struct_value
|
50
|
+
# @return [Google::Protobuf::Struct]
|
51
|
+
# Represents a structured value.
|
52
|
+
# @!attribute [rw] list_value
|
53
|
+
# @return [Google::Protobuf::ListValue]
|
54
|
+
# Represents a repeated `Value`.
|
55
|
+
class Value; end
|
56
|
+
|
57
|
+
# `ListValue` is a wrapper around a repeated field of values.
|
58
|
+
#
|
59
|
+
# The JSON representation for `ListValue` is JSON array.
|
60
|
+
# @!attribute [rw] values
|
61
|
+
# @return [Array<Google::Protobuf::Value>]
|
62
|
+
# Repeated field of dynamically typed values.
|
63
|
+
class ListValue; end
|
64
|
+
|
65
|
+
# `NullValue` is a singleton enumeration to represent the null value for the
|
66
|
+
# `Value` type union.
|
67
|
+
#
|
68
|
+
# The JSON representation for `NullValue` is JSON `null`.
|
69
|
+
module NullValue
|
70
|
+
# Null value.
|
71
|
+
NULL_VALUE = 0
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,109 @@
|
|
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
|
+
|
16
|
+
module Google
|
17
|
+
module Protobuf
|
18
|
+
# A Timestamp represents a point in time independent of any time zone
|
19
|
+
# or calendar, represented as seconds and fractions of seconds at
|
20
|
+
# nanosecond resolution in UTC Epoch time. It is encoded using the
|
21
|
+
# Proleptic Gregorian Calendar which extends the Gregorian calendar
|
22
|
+
# backwards to year one. It is encoded assuming all minutes are 60
|
23
|
+
# seconds long, i.e. leap seconds are "smeared" so that no leap second
|
24
|
+
# table is needed for interpretation. Range is from
|
25
|
+
# 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
26
|
+
# By restricting to that range, we ensure that we can convert to
|
27
|
+
# and from RFC 3339 date strings.
|
28
|
+
# See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
|
29
|
+
#
|
30
|
+
# = Examples
|
31
|
+
#
|
32
|
+
# Example 1: Compute Timestamp from POSIX `time()`.
|
33
|
+
#
|
34
|
+
# Timestamp timestamp;
|
35
|
+
# timestamp.set_seconds(time(NULL));
|
36
|
+
# timestamp.set_nanos(0);
|
37
|
+
#
|
38
|
+
# Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
39
|
+
#
|
40
|
+
# struct timeval tv;
|
41
|
+
# gettimeofday(&tv, NULL);
|
42
|
+
#
|
43
|
+
# Timestamp timestamp;
|
44
|
+
# timestamp.set_seconds(tv.tv_sec);
|
45
|
+
# timestamp.set_nanos(tv.tv_usec * 1000);
|
46
|
+
#
|
47
|
+
# Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
48
|
+
#
|
49
|
+
# FILETIME ft;
|
50
|
+
# GetSystemTimeAsFileTime(&ft);
|
51
|
+
# UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
52
|
+
#
|
53
|
+
# // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
54
|
+
# // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
55
|
+
# Timestamp timestamp;
|
56
|
+
# timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
57
|
+
# timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
58
|
+
#
|
59
|
+
# Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
60
|
+
#
|
61
|
+
# long millis = System.currentTimeMillis();
|
62
|
+
#
|
63
|
+
# Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
64
|
+
# .setNanos((int) ((millis % 1000) * 1000000)).build();
|
65
|
+
#
|
66
|
+
#
|
67
|
+
# Example 5: Compute Timestamp from current time in Python.
|
68
|
+
#
|
69
|
+
# timestamp = Timestamp()
|
70
|
+
# timestamp.GetCurrentTime()
|
71
|
+
#
|
72
|
+
# = JSON Mapping
|
73
|
+
#
|
74
|
+
# In JSON format, the Timestamp type is encoded as a string in the
|
75
|
+
# [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
76
|
+
# format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
|
77
|
+
# where \\{year} is always expressed using four digits while \\{month}, \\{day},
|
78
|
+
# \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
|
79
|
+
# seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
80
|
+
# are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
81
|
+
# is required. A proto3 JSON serializer should always use UTC (as indicated by
|
82
|
+
# "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
83
|
+
# able to accept both UTC and other timezones (as indicated by an offset).
|
84
|
+
#
|
85
|
+
# For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
86
|
+
# 01:30 UTC on January 15, 2017.
|
87
|
+
#
|
88
|
+
# In JavaScript, one can convert a Date object to this format using the
|
89
|
+
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
|
90
|
+
# method. In Python, a standard `datetime.datetime` object can be converted
|
91
|
+
# to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
92
|
+
# with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
93
|
+
# can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
94
|
+
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
|
95
|
+
# ) to obtain a formatter capable of generating timestamps in this format.
|
96
|
+
# @!attribute [rw] seconds
|
97
|
+
# @return [Integer]
|
98
|
+
# Represents seconds of UTC time since Unix epoch
|
99
|
+
# 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
100
|
+
# 9999-12-31T23:59:59Z inclusive.
|
101
|
+
# @!attribute [rw] nanos
|
102
|
+
# @return [Integer]
|
103
|
+
# Non-negative fractions of a second at nanosecond resolution. Negative
|
104
|
+
# second values with fractions must still have non-negative nanos values
|
105
|
+
# that count forward in time. Must be from 0 to 999,999,999
|
106
|
+
# inclusive.
|
107
|
+
class Timestamp; end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,84 @@
|
|
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
|
+
|
16
|
+
module Google
|
17
|
+
module Rpc
|
18
|
+
# The `Status` type defines a logical error model that is suitable for different
|
19
|
+
# programming environments, including REST APIs and RPC APIs. It is used by
|
20
|
+
# [gRPC](https://github.com/grpc). The error model is designed to be:
|
21
|
+
#
|
22
|
+
# * Simple to use and understand for most users
|
23
|
+
# * Flexible enough to meet unexpected needs
|
24
|
+
#
|
25
|
+
# = Overview
|
26
|
+
#
|
27
|
+
# The `Status` message contains three pieces of data: error code, error message,
|
28
|
+
# and error details. The error code should be an enum value of
|
29
|
+
# {Google::Rpc::Code}, but it may accept additional error codes if needed. The
|
30
|
+
# error message should be a developer-facing English message that helps
|
31
|
+
# developers *understand* and *resolve* the error. If a localized user-facing
|
32
|
+
# error message is needed, put the localized message in the error details or
|
33
|
+
# localize it in the client. The optional error details may contain arbitrary
|
34
|
+
# information about the error. There is a predefined set of error detail types
|
35
|
+
# in the package `google.rpc` that can be used for common error conditions.
|
36
|
+
#
|
37
|
+
# = Language mapping
|
38
|
+
#
|
39
|
+
# The `Status` message is the logical representation of the error model, but it
|
40
|
+
# is not necessarily the actual wire format. When the `Status` message is
|
41
|
+
# exposed in different client libraries and different wire protocols, it can be
|
42
|
+
# mapped differently. For example, it will likely be mapped to some exceptions
|
43
|
+
# in Java, but more likely mapped to some error codes in C.
|
44
|
+
#
|
45
|
+
# = Other uses
|
46
|
+
#
|
47
|
+
# The error model and the `Status` message can be used in a variety of
|
48
|
+
# environments, either with or without APIs, to provide a
|
49
|
+
# consistent developer experience across different environments.
|
50
|
+
#
|
51
|
+
# Example uses of this error model include:
|
52
|
+
#
|
53
|
+
# * Partial errors. If a service needs to return partial errors to the client,
|
54
|
+
# it may embed the `Status` in the normal response to indicate the partial
|
55
|
+
# errors.
|
56
|
+
#
|
57
|
+
# * Workflow errors. A typical workflow has multiple steps. Each step may
|
58
|
+
# have a `Status` message for error reporting.
|
59
|
+
#
|
60
|
+
# * Batch operations. If a client uses batch request and batch response, the
|
61
|
+
# `Status` message should be used directly inside batch response, one for
|
62
|
+
# each error sub-response.
|
63
|
+
#
|
64
|
+
# * Asynchronous operations. If an API call embeds asynchronous operation
|
65
|
+
# results in its response, the status of those operations should be
|
66
|
+
# represented directly using the `Status` message.
|
67
|
+
#
|
68
|
+
# * Logging. If some API errors are stored in logs, the message `Status` could
|
69
|
+
# be used directly after any stripping needed for security/privacy reasons.
|
70
|
+
# @!attribute [rw] code
|
71
|
+
# @return [Integer]
|
72
|
+
# The status code, which should be an enum value of {Google::Rpc::Code}.
|
73
|
+
# @!attribute [rw] message
|
74
|
+
# @return [String]
|
75
|
+
# A developer-facing error message, which should be in English. Any
|
76
|
+
# user-facing error message should be localized and sent in the
|
77
|
+
# {Google::Rpc::Status#details} field, or localized by the client.
|
78
|
+
# @!attribute [rw] details
|
79
|
+
# @return [Array<Google::Protobuf::Any>]
|
80
|
+
# A list of messages that carry the error details. There is a common set of
|
81
|
+
# message types for APIs to use.
|
82
|
+
class Status; end
|
83
|
+
end
|
84
|
+
end
|