google-cloud-channel-v1 0.1.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/LICENSE.md +188 -190
- data/README.md +68 -4
- data/lib/google/cloud/channel/v1/cloud_channel_service/client.rb +466 -210
- data/lib/google/cloud/channel/v1/cloud_channel_service/operations.rb +95 -10
- data/lib/google/cloud/channel/v1/entitlements_pb.rb +0 -2
- data/lib/google/cloud/channel/v1/offers_pb.rb +1 -0
- data/lib/google/cloud/channel/v1/service_pb.rb +30 -1
- data/lib/google/cloud/channel/v1/service_services_pb.rb +191 -167
- data/lib/google/cloud/channel/v1/subscriber_event_pb.rb +56 -0
- data/lib/google/cloud/channel/v1/version.rb +1 -1
- data/proto_docs/README.md +1 -1
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/cloud/channel/v1/customers.rb +1 -0
- data/proto_docs/google/cloud/channel/v1/entitlements.rb +0 -6
- data/proto_docs/google/cloud/channel/v1/offers.rb +4 -0
- data/proto_docs/google/cloud/channel/v1/service.rb +83 -5
- data/proto_docs/google/cloud/channel/v1/subscriber_event.rb +113 -0
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- metadata +14 -8
@@ -0,0 +1,56 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/channel/v1/subscriber_event.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/resource_pb'
|
7
|
+
require 'google/api/annotations_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("google/cloud/channel/v1/subscriber_event.proto", :syntax => :proto3) do
|
10
|
+
add_message "google.cloud.channel.v1.CustomerEvent" do
|
11
|
+
optional :customer, :string, 1
|
12
|
+
optional :event_type, :enum, 2, "google.cloud.channel.v1.CustomerEvent.Type"
|
13
|
+
end
|
14
|
+
add_enum "google.cloud.channel.v1.CustomerEvent.Type" do
|
15
|
+
value :TYPE_UNSPECIFIED, 0
|
16
|
+
end
|
17
|
+
add_message "google.cloud.channel.v1.EntitlementEvent" do
|
18
|
+
optional :entitlement, :string, 1
|
19
|
+
optional :event_type, :enum, 2, "google.cloud.channel.v1.EntitlementEvent.Type"
|
20
|
+
end
|
21
|
+
add_enum "google.cloud.channel.v1.EntitlementEvent.Type" do
|
22
|
+
value :TYPE_UNSPECIFIED, 0
|
23
|
+
value :CREATED, 1
|
24
|
+
value :PRICE_PLAN_SWITCHED, 3
|
25
|
+
value :COMMITMENT_CHANGED, 4
|
26
|
+
value :RENEWED, 5
|
27
|
+
value :SUSPENDED, 6
|
28
|
+
value :ACTIVATED, 7
|
29
|
+
value :CANCELLED, 8
|
30
|
+
value :SKU_CHANGED, 9
|
31
|
+
value :RENEWAL_SETTING_CHANGED, 10
|
32
|
+
value :PAID_SERVICE_STARTED, 11
|
33
|
+
value :LICENSE_ASSIGNMENT_CHANGED, 12
|
34
|
+
end
|
35
|
+
add_message "google.cloud.channel.v1.SubscriberEvent" do
|
36
|
+
oneof :event do
|
37
|
+
optional :customer_event, :message, 1, "google.cloud.channel.v1.CustomerEvent"
|
38
|
+
optional :entitlement_event, :message, 2, "google.cloud.channel.v1.EntitlementEvent"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module Google
|
45
|
+
module Cloud
|
46
|
+
module Channel
|
47
|
+
module V1
|
48
|
+
CustomerEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.channel.v1.CustomerEvent").msgclass
|
49
|
+
CustomerEvent::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.channel.v1.CustomerEvent.Type").enummodule
|
50
|
+
EntitlementEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.channel.v1.EntitlementEvent").msgclass
|
51
|
+
EntitlementEvent::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.channel.v1.EntitlementEvent.Type").enummodule
|
52
|
+
SubscriberEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.channel.v1.SubscriberEvent").msgclass
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/proto_docs/README.md
CHANGED
@@ -54,6 +54,12 @@ module Google
|
|
54
54
|
# This indicates that the field may be set once in a request to create a
|
55
55
|
# resource, but may not be changed thereafter.
|
56
56
|
IMMUTABLE = 5
|
57
|
+
|
58
|
+
# Denotes that a (repeated) field is an unordered list.
|
59
|
+
# This indicates that the service may provide the elements of the list
|
60
|
+
# in any arbitrary order, rather than the order the user originally
|
61
|
+
# provided. Additionally, the list's order may or may not be stable.
|
62
|
+
UNORDERED_LIST = 6
|
57
63
|
end
|
58
64
|
end
|
59
65
|
end
|
@@ -33,6 +33,7 @@ module Google
|
|
33
33
|
# @return [::Google::Type::PostalAddress]
|
34
34
|
# Required. Address of the organization of the customer entity.
|
35
35
|
# Region and zip codes are required to enforce US laws and embargoes.
|
36
|
+
# Valid address lines are required for all customers.
|
36
37
|
# Language code is discarded. Use the Customer-level language code to set the
|
37
38
|
# customer's language.
|
38
39
|
# @!attribute [rw] primary_contact_info
|
@@ -203,12 +203,6 @@ module Google
|
|
203
203
|
# TransferableSku represents information a reseller needs to view existing
|
204
204
|
# provisioned services for a customer that they do not own.
|
205
205
|
# Read-only.
|
206
|
-
# @!attribute [rw] is_commitment
|
207
|
-
# @return [::Google::Protobuf::BoolValue]
|
208
|
-
# Whether a transferable SKU is commitment-based or not.
|
209
|
-
# @!attribute [rw] commitment_end_timestamp
|
210
|
-
# @return [::Google::Protobuf::Timestamp]
|
211
|
-
# Commitment end timestamp.
|
212
206
|
# @!attribute [rw] transfer_eligibility
|
213
207
|
# @return [::Google::Cloud::Channel::V1::TransferEligibility]
|
214
208
|
# Describes the transfer eligibility of a SKU.
|
@@ -147,6 +147,10 @@ module Google
|
|
147
147
|
# For Regular Offers with a trial period, the regular pricing goes into
|
148
148
|
# effect when trial period ends, or if paid service is started before the end
|
149
149
|
# of the trial period.
|
150
|
+
# @!attribute [rw] billing_account
|
151
|
+
# @return [::String]
|
152
|
+
# Reseller Billing account to charge after an offer transaction.
|
153
|
+
# Only present for Google Cloud Platform offers.
|
150
154
|
class Plan
|
151
155
|
include ::Google::Protobuf::MessageExts
|
152
156
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -396,11 +396,6 @@ module Google
|
|
396
396
|
# Required. The channel partner link to create.
|
397
397
|
# Either channel_partner_link.reseller_cloud_identity_id or domain can be
|
398
398
|
# used to create a link.
|
399
|
-
# @!attribute [rw] domain
|
400
|
-
# @return [::String]
|
401
|
-
# Optional. The invited partner's domain. Either domain or
|
402
|
-
# channel_partner_link.reseller_cloud_identity_id can be used to create a
|
403
|
-
# link.
|
404
399
|
class CreateChannelPartnerLinkRequest
|
405
400
|
include ::Google::Protobuf::MessageExts
|
406
401
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -1007,6 +1002,89 @@ module Google
|
|
1007
1002
|
include ::Google::Protobuf::MessageExts
|
1008
1003
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1009
1004
|
end
|
1005
|
+
|
1006
|
+
# Request Message for RegisterSubscriber.
|
1007
|
+
# @!attribute [rw] account
|
1008
|
+
# @return [::String]
|
1009
|
+
# Required. Resource name of the account.
|
1010
|
+
# @!attribute [rw] service_account
|
1011
|
+
# @return [::String]
|
1012
|
+
# Required. Service account which will provide subscriber access to the
|
1013
|
+
# registered topic.
|
1014
|
+
class RegisterSubscriberRequest
|
1015
|
+
include ::Google::Protobuf::MessageExts
|
1016
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
# Response Message for RegisterSubscriber.
|
1020
|
+
# @!attribute [rw] topic
|
1021
|
+
# @return [::String]
|
1022
|
+
# Name of the topic to which the subscriber will listen to.
|
1023
|
+
class RegisterSubscriberResponse
|
1024
|
+
include ::Google::Protobuf::MessageExts
|
1025
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1026
|
+
end
|
1027
|
+
|
1028
|
+
# Request Message for UnregisterSubscriber.
|
1029
|
+
# @!attribute [rw] account
|
1030
|
+
# @return [::String]
|
1031
|
+
# Required. Resource name of the account.
|
1032
|
+
# @!attribute [rw] service_account
|
1033
|
+
# @return [::String]
|
1034
|
+
# Required. Service account which will be unregistered from getting subscriber access
|
1035
|
+
# to the topic.
|
1036
|
+
class UnregisterSubscriberRequest
|
1037
|
+
include ::Google::Protobuf::MessageExts
|
1038
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
# Response Message for UnregisterSubscriber.
|
1042
|
+
# @!attribute [rw] topic
|
1043
|
+
# @return [::String]
|
1044
|
+
# Name of the topic from which the service account subscriber access has been
|
1045
|
+
# removed.
|
1046
|
+
class UnregisterSubscriberResponse
|
1047
|
+
include ::Google::Protobuf::MessageExts
|
1048
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1049
|
+
end
|
1050
|
+
|
1051
|
+
# Request Message for ListSubscribers.
|
1052
|
+
# @!attribute [rw] account
|
1053
|
+
# @return [::String]
|
1054
|
+
# Required. Resource name of the account.
|
1055
|
+
# @!attribute [rw] page_size
|
1056
|
+
# @return [::Integer]
|
1057
|
+
# Optional. The maximum number of service accounts to return. The service may return
|
1058
|
+
# fewer than this value.
|
1059
|
+
# If unspecified, at most 100 service accounts will be returned.
|
1060
|
+
# The maximum value is 1000; values above 1000 will be coerced to 1000.
|
1061
|
+
# @!attribute [rw] page_token
|
1062
|
+
# @return [::String]
|
1063
|
+
# Optional. A page token, received from a previous `ListSubscribers` call.
|
1064
|
+
# Provide this to retrieve the subsequent page.
|
1065
|
+
#
|
1066
|
+
# When paginating, all other parameters provided to `ListSubscribers` must
|
1067
|
+
# match the call that provided the page token.
|
1068
|
+
class ListSubscribersRequest
|
1069
|
+
include ::Google::Protobuf::MessageExts
|
1070
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
# Response Message for ListSubscribers.
|
1074
|
+
# @!attribute [rw] topic
|
1075
|
+
# @return [::String]
|
1076
|
+
# Name of the topic registered with the reseller.
|
1077
|
+
# @!attribute [rw] service_accounts
|
1078
|
+
# @return [::Array<::String>]
|
1079
|
+
# List of service accounts which have subscriber access to the topic.
|
1080
|
+
# @!attribute [rw] next_page_token
|
1081
|
+
# @return [::String]
|
1082
|
+
# A token that can be sent as `page_token` to retrieve the next page.
|
1083
|
+
# If this field is omitted, there are no subsequent pages.
|
1084
|
+
class ListSubscribersResponse
|
1085
|
+
include ::Google::Protobuf::MessageExts
|
1086
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1087
|
+
end
|
1010
1088
|
end
|
1011
1089
|
end
|
1012
1090
|
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Channel
|
23
|
+
module V1
|
24
|
+
# Represents Pub/Sub message content describing customer update.
|
25
|
+
# @!attribute [rw] customer
|
26
|
+
# @return [::String]
|
27
|
+
# Resource name of the customer.
|
28
|
+
# Format: accounts/\\{account_id}/customers/\\{customer_id}
|
29
|
+
# @!attribute [rw] event_type
|
30
|
+
# @return [::Google::Cloud::Channel::V1::CustomerEvent::Type]
|
31
|
+
# Type of event which happened on the customer.
|
32
|
+
class CustomerEvent
|
33
|
+
include ::Google::Protobuf::MessageExts
|
34
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
35
|
+
|
36
|
+
# Type of customer event.
|
37
|
+
module Type
|
38
|
+
# Default value. This state doesn't show unless an error occurs.
|
39
|
+
TYPE_UNSPECIFIED = 0
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Represents Pub/Sub message content describing entitlement update.
|
44
|
+
# @!attribute [rw] entitlement
|
45
|
+
# @return [::String]
|
46
|
+
# Resource name of an entitlement of the form:
|
47
|
+
# accounts/\\{account_id}/customers/\\{customer_id}/entitlements/\\{entitlement_id}
|
48
|
+
# @!attribute [rw] event_type
|
49
|
+
# @return [::Google::Cloud::Channel::V1::EntitlementEvent::Type]
|
50
|
+
# Type of event which happened on the entitlement.
|
51
|
+
class EntitlementEvent
|
52
|
+
include ::Google::Protobuf::MessageExts
|
53
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
54
|
+
|
55
|
+
# Type of entitlement event.
|
56
|
+
module Type
|
57
|
+
# Default value. This state doesn't show unless an error occurs.
|
58
|
+
TYPE_UNSPECIFIED = 0
|
59
|
+
|
60
|
+
# A new entitlement was created.
|
61
|
+
CREATED = 1
|
62
|
+
|
63
|
+
# The offer type associated with an entitlement was changed.
|
64
|
+
# This is not triggered if an entitlement converts from a commit offer to a
|
65
|
+
# flexible offer as part of a renewal.
|
66
|
+
PRICE_PLAN_SWITCHED = 3
|
67
|
+
|
68
|
+
# Annual commitment for a commit plan was changed.
|
69
|
+
COMMITMENT_CHANGED = 4
|
70
|
+
|
71
|
+
# An annual entitlement was renewed.
|
72
|
+
RENEWED = 5
|
73
|
+
|
74
|
+
# Entitlement was suspended.
|
75
|
+
SUSPENDED = 6
|
76
|
+
|
77
|
+
# Entitlement was unsuspended.
|
78
|
+
ACTIVATED = 7
|
79
|
+
|
80
|
+
# Entitlement was cancelled.
|
81
|
+
CANCELLED = 8
|
82
|
+
|
83
|
+
# Entitlement was upgraded or downgraded (e.g. from Google Workspace
|
84
|
+
# Business Standard to Google Workspace Business Plus).
|
85
|
+
SKU_CHANGED = 9
|
86
|
+
|
87
|
+
# The renewal settings of an entitlement has changed.
|
88
|
+
RENEWAL_SETTING_CHANGED = 10
|
89
|
+
|
90
|
+
# Paid service has started on trial entitlement.
|
91
|
+
PAID_SERVICE_STARTED = 11
|
92
|
+
|
93
|
+
# License was assigned to or revoked from a user.
|
94
|
+
LICENSE_ASSIGNMENT_CHANGED = 12
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Represents information which resellers will get as part of notification from
|
99
|
+
# Cloud Pub/Sub.
|
100
|
+
# @!attribute [rw] customer_event
|
101
|
+
# @return [::Google::Cloud::Channel::V1::CustomerEvent]
|
102
|
+
# Customer event send as part of Pub/Sub event to partners.
|
103
|
+
# @!attribute [rw] entitlement_event
|
104
|
+
# @return [::Google::Cloud::Channel::V1::EntitlementEvent]
|
105
|
+
# Entitlement event send as part of Pub/Sub event to partners.
|
106
|
+
class SubscriberEvent
|
107
|
+
include ::Google::Protobuf::MessageExts
|
108
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -25,7 +25,7 @@ module Google
|
|
25
25
|
# @return [::String]
|
26
26
|
# The server-assigned name, which is only unique within the same service that
|
27
27
|
# originally returns it. If you use the default HTTP mapping, the
|
28
|
-
# `name` should
|
28
|
+
# `name` should be a resource name ending with `operations/{unique_id}`.
|
29
29
|
# @!attribute [rw] metadata
|
30
30
|
# @return [::Google::Protobuf::Any]
|
31
31
|
# Service-specific metadata associated with the operation. It typically
|
@@ -35,7 +35,7 @@ module Google
|
|
35
35
|
# @!attribute [rw] done
|
36
36
|
# @return [::Boolean]
|
37
37
|
# If the value is `false`, it means the operation is still in progress.
|
38
|
-
# If true
|
38
|
+
# If `true`, the operation is completed, and either `error` or `response` is
|
39
39
|
# available.
|
40
40
|
# @!attribute [rw] error
|
41
41
|
# @return [::Google::Rpc::Status]
|
@@ -67,7 +67,7 @@ module Google
|
|
67
67
|
# The request message for Operations.ListOperations.
|
68
68
|
# @!attribute [rw] name
|
69
69
|
# @return [::String]
|
70
|
-
# The name of the operation
|
70
|
+
# The name of the operation's parent resource.
|
71
71
|
# @!attribute [rw] filter
|
72
72
|
# @return [::String]
|
73
73
|
# The standard list filter.
|
@@ -112,6 +112,20 @@ module Google
|
|
112
112
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
113
113
|
end
|
114
114
|
|
115
|
+
# The request message for Operations.WaitOperation.
|
116
|
+
# @!attribute [rw] name
|
117
|
+
# @return [::String]
|
118
|
+
# The name of the operation resource to wait on.
|
119
|
+
# @!attribute [rw] timeout
|
120
|
+
# @return [::Google::Protobuf::Duration]
|
121
|
+
# The maximum duration to wait before timing out. If left blank, the wait
|
122
|
+
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
123
|
+
# If RPC context deadline is also specified, the shorter one will be used.
|
124
|
+
class WaitOperationRequest
|
125
|
+
include ::Google::Protobuf::MessageExts
|
126
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
127
|
+
end
|
128
|
+
|
115
129
|
# A message representing the message types used by a long-running operation.
|
116
130
|
#
|
117
131
|
# Example:
|
@@ -57,10 +57,13 @@ module Google
|
|
57
57
|
# Example 4: Pack and unpack a message in Go
|
58
58
|
#
|
59
59
|
# foo := &pb.Foo{...}
|
60
|
-
# any, err :=
|
60
|
+
# any, err := anypb.New(foo)
|
61
|
+
# if err != nil {
|
62
|
+
# ...
|
63
|
+
# }
|
61
64
|
# ...
|
62
65
|
# foo := &pb.Foo{}
|
63
|
-
# if err :=
|
66
|
+
# if err := any.UnmarshalTo(foo); err != nil {
|
64
67
|
# ...
|
65
68
|
# }
|
66
69
|
#
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Protobuf
|
22
|
+
# A Duration represents a signed, fixed-length span of time represented
|
23
|
+
# as a count of seconds and fractions of seconds at nanosecond
|
24
|
+
# resolution. It is independent of any calendar and concepts like "day"
|
25
|
+
# or "month". It is related to Timestamp in that the difference between
|
26
|
+
# two Timestamp values is a Duration and it can be added or subtracted
|
27
|
+
# from a Timestamp. Range is approximately +-10,000 years.
|
28
|
+
#
|
29
|
+
# # Examples
|
30
|
+
#
|
31
|
+
# Example 1: Compute Duration from two Timestamps in pseudo code.
|
32
|
+
#
|
33
|
+
# Timestamp start = ...;
|
34
|
+
# Timestamp end = ...;
|
35
|
+
# Duration duration = ...;
|
36
|
+
#
|
37
|
+
# duration.seconds = end.seconds - start.seconds;
|
38
|
+
# duration.nanos = end.nanos - start.nanos;
|
39
|
+
#
|
40
|
+
# if (duration.seconds < 0 && duration.nanos > 0) {
|
41
|
+
# duration.seconds += 1;
|
42
|
+
# duration.nanos -= 1000000000;
|
43
|
+
# } else if (duration.seconds > 0 && duration.nanos < 0) {
|
44
|
+
# duration.seconds -= 1;
|
45
|
+
# duration.nanos += 1000000000;
|
46
|
+
# }
|
47
|
+
#
|
48
|
+
# Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
49
|
+
#
|
50
|
+
# Timestamp start = ...;
|
51
|
+
# Duration duration = ...;
|
52
|
+
# Timestamp end = ...;
|
53
|
+
#
|
54
|
+
# end.seconds = start.seconds + duration.seconds;
|
55
|
+
# end.nanos = start.nanos + duration.nanos;
|
56
|
+
#
|
57
|
+
# if (end.nanos < 0) {
|
58
|
+
# end.seconds -= 1;
|
59
|
+
# end.nanos += 1000000000;
|
60
|
+
# } else if (end.nanos >= 1000000000) {
|
61
|
+
# end.seconds += 1;
|
62
|
+
# end.nanos -= 1000000000;
|
63
|
+
# }
|
64
|
+
#
|
65
|
+
# Example 3: Compute Duration from datetime.timedelta in Python.
|
66
|
+
#
|
67
|
+
# td = datetime.timedelta(days=3, minutes=10)
|
68
|
+
# duration = Duration()
|
69
|
+
# duration.FromTimedelta(td)
|
70
|
+
#
|
71
|
+
# # JSON Mapping
|
72
|
+
#
|
73
|
+
# In JSON format, the Duration type is encoded as a string rather than an
|
74
|
+
# object, where the string ends in the suffix "s" (indicating seconds) and
|
75
|
+
# is preceded by the number of seconds, with nanoseconds expressed as
|
76
|
+
# fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
77
|
+
# encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
78
|
+
# be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
79
|
+
# microsecond should be expressed in JSON format as "3.000001s".
|
80
|
+
# @!attribute [rw] seconds
|
81
|
+
# @return [::Integer]
|
82
|
+
# Signed seconds of the span of time. Must be from -315,576,000,000
|
83
|
+
# to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
84
|
+
# 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
85
|
+
# @!attribute [rw] nanos
|
86
|
+
# @return [::Integer]
|
87
|
+
# Signed fractions of a second at nanosecond resolution of the span
|
88
|
+
# of time. Durations less than one second are represented with a 0
|
89
|
+
# `seconds` field and a positive or negative `nanos` field. For durations
|
90
|
+
# of one second or more, a non-zero value for the `nanos` field must be
|
91
|
+
# of the same sign as the `seconds` field. Must be from -999,999,999
|
92
|
+
# to +999,999,999 inclusive.
|
93
|
+
class Duration
|
94
|
+
include ::Google::Protobuf::MessageExts
|
95
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|