google-cloud-asset 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/asset.rb +2 -2
- data/lib/google/cloud/asset/v1.rb +138 -0
- data/lib/google/cloud/asset/v1/asset_service_client.rb +385 -0
- data/lib/google/cloud/asset/v1/asset_service_client_config.json +36 -0
- data/lib/google/cloud/asset/v1/asset_service_pb.rb +63 -0
- data/lib/google/cloud/asset/v1/asset_service_services_pb.rb +58 -0
- data/lib/google/cloud/asset/v1/assets_pb.rb +49 -0
- data/lib/google/cloud/asset/v1/credentials.rb +41 -0
- data/lib/google/cloud/asset/v1/doc/google/cloud/asset/v1/asset_service.rb +129 -0
- data/lib/google/cloud/asset/v1/doc/google/cloud/asset/v1/assets.rb +108 -0
- data/lib/google/cloud/asset/v1/doc/google/iam/v1/policy.rb +104 -0
- data/lib/google/cloud/asset/v1/doc/google/longrunning/operations.rb +51 -0
- data/lib/google/cloud/asset/v1/doc/google/protobuf/any.rb +130 -0
- data/lib/google/cloud/asset/v1/doc/google/protobuf/struct.rb +74 -0
- data/lib/google/cloud/asset/v1/doc/google/protobuf/timestamp.rb +109 -0
- data/lib/google/cloud/asset/v1/doc/google/rpc/status.rb +87 -0
- data/lib/google/cloud/asset/v1/helpers.rb +29 -0
- data/lib/google/cloud/asset/v1beta1.rb +1 -0
- data/lib/google/cloud/asset/v1beta1/asset_service_client.rb +9 -7
- data/lib/google/cloud/asset/v1beta1/asset_service_services_pb.rb +3 -2
- data/lib/google/cloud/asset/v1beta1/doc/google/cloud/asset/v1beta1/asset_service.rb +6 -3
- data/lib/google/cloud/asset/v1beta1/doc/google/cloud/asset/v1beta1/assets.rb +10 -6
- data/lib/google/cloud/asset/v1beta1/doc/google/longrunning/operations.rb +1 -1
- data/lib/google/cloud/asset/v1beta1/doc/google/rpc/status.rb +17 -14
- data/lib/google/cloud/asset/v1beta1/helpers.rb +29 -0
- metadata +22 -6
@@ -0,0 +1,104 @@
|
|
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 Iam
|
18
|
+
module V1
|
19
|
+
# Defines an Identity and Access Management (IAM) policy. It is used to
|
20
|
+
# specify access control policies for Cloud Platform resources.
|
21
|
+
#
|
22
|
+
#
|
23
|
+
# A `Policy` consists of a list of `bindings`. A `Binding` binds a list of
|
24
|
+
# `members` to a `role`, where the members can be user accounts, Google groups,
|
25
|
+
# Google domains, and service accounts. A `role` is a named list of permissions
|
26
|
+
# defined by IAM.
|
27
|
+
#
|
28
|
+
# **Example**
|
29
|
+
#
|
30
|
+
# {
|
31
|
+
# "bindings": [
|
32
|
+
# {
|
33
|
+
# "role": "roles/owner",
|
34
|
+
# "members": [
|
35
|
+
# "user:mike@example.com",
|
36
|
+
# "group:admins@example.com",
|
37
|
+
# "domain:google.com",
|
38
|
+
# "serviceAccount:my-other-app@appspot.gserviceaccount.com",
|
39
|
+
# ]
|
40
|
+
# },
|
41
|
+
# {
|
42
|
+
# "role": "roles/viewer",
|
43
|
+
# "members": ["user:sean@example.com"]
|
44
|
+
# }
|
45
|
+
# ]
|
46
|
+
# }
|
47
|
+
#
|
48
|
+
# For a description of IAM and its features, see the
|
49
|
+
# [IAM developer's guide](https://cloud.google.com/iam).
|
50
|
+
# @!attribute [rw] version
|
51
|
+
# @return [Integer]
|
52
|
+
# Version of the `Policy`. The default version is 0.
|
53
|
+
# @!attribute [rw] bindings
|
54
|
+
# @return [Array<Google::Iam::V1::Binding>]
|
55
|
+
# Associates a list of `members` to a `role`.
|
56
|
+
# Multiple `bindings` must not be specified for the same `role`.
|
57
|
+
# `bindings` with no members will result in an error.
|
58
|
+
# @!attribute [rw] etag
|
59
|
+
# @return [String]
|
60
|
+
# `etag` is used for optimistic concurrency control as a way to help
|
61
|
+
# prevent simultaneous updates of a policy from overwriting each other.
|
62
|
+
# It is strongly suggested that systems make use of the `etag` in the
|
63
|
+
# read-modify-write cycle to perform policy updates in order to avoid race
|
64
|
+
# conditions: An `etag` is returned in the response to `getIamPolicy`, and
|
65
|
+
# systems are expected to put that etag in the request to `setIamPolicy` to
|
66
|
+
# ensure that their change will be applied to the same version of the policy.
|
67
|
+
#
|
68
|
+
# If no `etag` is provided in the call to `setIamPolicy`, then the existing
|
69
|
+
# policy is overwritten blindly.
|
70
|
+
class Policy; end
|
71
|
+
|
72
|
+
# Associates `members` with a `role`.
|
73
|
+
# @!attribute [rw] role
|
74
|
+
# @return [String]
|
75
|
+
# Role that is assigned to `members`.
|
76
|
+
# For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
|
77
|
+
# Required
|
78
|
+
# @!attribute [rw] members
|
79
|
+
# @return [Array<String>]
|
80
|
+
# Specifies the identities requesting access for a Cloud Platform resource.
|
81
|
+
# `members` can have the following values:
|
82
|
+
#
|
83
|
+
# * `allUsers`: A special identifier that represents anyone who is
|
84
|
+
# on the internet; with or without a Google account.
|
85
|
+
#
|
86
|
+
# * `allAuthenticatedUsers`: A special identifier that represents anyone
|
87
|
+
# who is authenticated with a Google account or a service account.
|
88
|
+
#
|
89
|
+
# * `user:{emailid}`: An email address that represents a specific Google
|
90
|
+
# account. For example, `alice@gmail.com` or `joe@example.com`.
|
91
|
+
#
|
92
|
+
#
|
93
|
+
# * `serviceAccount:{emailid}`: An email address that represents a service
|
94
|
+
# account. For example, `my-other-app@appspot.gserviceaccount.com`.
|
95
|
+
#
|
96
|
+
# * `group:{emailid}`: An email address that represents a Google group.
|
97
|
+
# For example, `admins@example.com`.
|
98
|
+
#
|
99
|
+
# * `domain:{domain}`: A Google Apps domain name that represents all the
|
100
|
+
# users of that domain. For example, `google.com` or `example.com`.
|
101
|
+
class Binding; end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,51 @@
|
|
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 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
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,130 @@
|
|
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. 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 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
|
+
# `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 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 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
|