• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2023 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//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.commerce.consumer.procurement.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/protobuf/timestamp.proto";
22
23option csharp_namespace = "Google.Cloud.Commerce.Consumer.Procurement.V1";
24option go_package = "cloud.google.com/go/commerce/consumer/procurement/apiv1/procurementpb;procurementpb";
25option java_multiple_files = true;
26option java_package = "com.google.cloud.commerce.consumer.procurement.v1";
27option php_namespace = "Google\\Cloud\\Commerce\\Consumer\\Procurement\\V1";
28option ruby_package = "Google::Cloud::Commerce::Consumer::Procurement::V1";
29option (google.api.resource_definition) = {
30  type: "commerceoffercatalog.googleapis.com/Offer"
31  pattern: "services/{service}/standardOffers/{offer}"
32  pattern: "billingAccounts/{consumer_billing_account}/offers/{offer}"
33};
34
35// Type of a line item change.
36enum LineItemChangeType {
37  // Sentinel value. Do not use.
38  LINE_ITEM_CHANGE_TYPE_UNSPECIFIED = 0;
39
40  // The change is to create a new line item.
41  LINE_ITEM_CHANGE_TYPE_CREATE = 1;
42
43  // The change is to update an existing line item.
44  LINE_ITEM_CHANGE_TYPE_UPDATE = 2;
45
46  // The change is to cancel an existing line item.
47  LINE_ITEM_CHANGE_TYPE_CANCEL = 3;
48
49  // The change is to revert a cancellation.
50  LINE_ITEM_CHANGE_TYPE_REVERT_CANCELLATION = 4;
51}
52
53// State of a change.
54enum LineItemChangeState {
55  // Sentinel value. Do not use.
56  LINE_ITEM_CHANGE_STATE_UNSPECIFIED = 0;
57
58  // Change is in this state when a change is initiated and waiting for
59  // partner approval.
60  LINE_ITEM_CHANGE_STATE_PENDING_APPROVAL = 1;
61
62  // Change is in this state after it's approved by the partner or auto-approved
63  // but before it takes effect. The change can be overwritten
64  // or cancelled depending on the new line item info property (pending Private
65  // Offer change cannot be cancelled and can only be overwritten by another
66  // Private Offer).
67  LINE_ITEM_CHANGE_STATE_APPROVED = 2;
68
69  // Change is in this state after it's been activated.
70  LINE_ITEM_CHANGE_STATE_COMPLETED = 3;
71
72  // Change is in this state if it was rejected by the partner.
73  LINE_ITEM_CHANGE_STATE_REJECTED = 4;
74
75  // Change is in this state if it was abandoned by the user.
76  LINE_ITEM_CHANGE_STATE_ABANDONED = 5;
77
78  // Change is in this state if it's currently being provisioned downstream. The
79  // change can't be overwritten or cancelled when it's in this state.
80  LINE_ITEM_CHANGE_STATE_ACTIVATING = 6;
81}
82
83// Predefined types for line item change state reason.
84enum LineItemChangeStateReasonType {
85  // Default value, indicating there's no predefined type for change state
86  // reason.
87  LINE_ITEM_CHANGE_STATE_REASON_TYPE_UNSPECIFIED = 0;
88
89  // Change is in current state due to term expiration.
90  LINE_ITEM_CHANGE_STATE_REASON_TYPE_EXPIRED = 1;
91
92  // Change is in current state due to user-initiated cancellation.
93  LINE_ITEM_CHANGE_STATE_REASON_TYPE_USER_CANCELLED = 2;
94
95  // Change is in current state due to system-initiated cancellation.
96  LINE_ITEM_CHANGE_STATE_REASON_TYPE_SYSTEM_CANCELLED = 3;
97}
98
99// Represents a purchase made by a customer on Cloud Marketplace.
100// Creating an order makes sure that both the Google backend systems
101// as well as external service provider's systems (if needed) allow use of
102// purchased products and ensures the appropriate billing events occur.
103//
104// An Order can be made against one Product with multiple add-ons (optional) or
105// one Quote which might reference multiple products.
106//
107// Customers typically choose a price plan for each Product purchased when
108// they create an order and can change their plan later, if the product allows.
109message Order {
110  option (google.api.resource) = {
111    type: "cloudcommerceconsumerprocurement.googleapis.com/Order"
112    pattern: "billingAccounts/{billing_account}/orders/{order}"
113  };
114
115  // Output only. The resource name of the order.
116  // Has the form
117  // `billingAccounts/{billing_account}/orders/{order}`.
118  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
119
120  // Required. The user-specified name of the order.
121  string display_name = 10 [(google.api.field_behavior) = REQUIRED];
122
123  // Output only. The items being purchased.
124  repeated LineItem line_items = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
125
126  // Output only. Line items that were cancelled.
127  repeated LineItem cancelled_line_items = 7
128      [(google.api.field_behavior) = OUTPUT_ONLY];
129
130  // Output only. The creation timestamp.
131  google.protobuf.Timestamp create_time = 8
132      [(google.api.field_behavior) = OUTPUT_ONLY];
133
134  // Output only. The last update timestamp.
135  google.protobuf.Timestamp update_time = 9
136      [(google.api.field_behavior) = OUTPUT_ONLY];
137
138  // The weak etag of the order.
139  string etag = 11;
140}
141
142// A single item within an order.
143message LineItem {
144  // Output only. Line item ID.
145  string line_item_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
146
147  // Output only. Current state and information of this item. It tells what,
148  // e.g. which offer, is currently effective.
149  LineItemInfo line_item_info = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
150
151  // Output only. A change made on the item which is pending and not yet
152  // effective. Absence of this field indicates the line item is not undergoing
153  // a change.
154  LineItemChange pending_change = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
155
156  // Output only. Changes made on the item that are not pending anymore which
157  // might be because they already took effect, were reverted by the customer,
158  // or were rejected by the partner. No more operations are allowed on these
159  // changes.
160  repeated LineItemChange change_history = 4
161      [(google.api.field_behavior) = OUTPUT_ONLY];
162}
163
164// A change made on a line item.
165message LineItemChange {
166  // Output only. Change ID.
167  // All changes made within one order update operation have the same change_id.
168  string change_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
169
170  // Required. Type of the change to make.
171  LineItemChangeType change_type = 2 [(google.api.field_behavior) = REQUIRED];
172
173  // Output only. Line item info before the change.
174  LineItemInfo old_line_item_info = 3
175      [(google.api.field_behavior) = OUTPUT_ONLY];
176
177  // Line item info after the change.
178  LineItemInfo new_line_item_info = 4;
179
180  // Output only. State of the change.
181  LineItemChangeState change_state = 5
182      [(google.api.field_behavior) = OUTPUT_ONLY];
183
184  // Output only. Provider-supplied message explaining the LineItemChange's
185  // state. Mainly used to communicate progress and ETA for provisioning in the
186  // case of `PENDING_APPROVAL`, and to explain why the change request was
187  // denied or canceled in the case of `REJECTED` and `CANCELED` states.
188  string state_reason = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
189
190  // Output only. Predefined enum types for why this line item change is in
191  // current state. For example, a line item change's state could be
192  // `LINE_ITEM_CHANGE_STATE_COMPLETED` because of end-of-term expiration,
193  // immediate cancellation initiated by the user, or system-initiated
194  // cancellation.
195  LineItemChangeStateReasonType change_state_reason_type = 10
196      [(google.api.field_behavior) = OUTPUT_ONLY];
197
198  // Output only. A time at which the change became or will become (in case of
199  // pending change) effective.
200  google.protobuf.Timestamp change_effective_time = 7
201      [(google.api.field_behavior) = OUTPUT_ONLY];
202
203  // Output only. The time when change was initiated.
204  google.protobuf.Timestamp create_time = 8
205      [(google.api.field_behavior) = OUTPUT_ONLY];
206
207  // Output only. The time when change was updated, e.g. approved/rejected by
208  // partners or cancelled by the user.
209  google.protobuf.Timestamp update_time = 9
210      [(google.api.field_behavior) = OUTPUT_ONLY];
211}
212
213// Line item information.
214message LineItemInfo {
215  // Optional. The name of the offer can have either of these formats:
216  // 'billingAccounts/{billing_account}/offers/{offer}',
217  // or 'services/{service}/standardOffers/{offer}'.
218  string offer = 13 [
219    (google.api.field_behavior) = OPTIONAL,
220    (google.api.resource_reference) = {
221      type: "commerceoffercatalog.googleapis.com/Offer"
222    }
223  ];
224
225  // Optional. User-provided parameters.
226  repeated Parameter parameters = 9 [(google.api.field_behavior) = OPTIONAL];
227
228  // Output only. Information about the subscription created, if applicable.
229  Subscription subscription = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
230}
231
232// User-provided Parameters.
233message Parameter {
234  message Value {
235    // The kind of value.
236    oneof kind {
237      // Represents an int64 value.
238      int64 int64_value = 3;
239
240      // Represents a string value.
241      string string_value = 4;
242
243      // Represents a double value.
244      double double_value = 5;
245    }
246  }
247
248  // Name of the parameter.
249  string name = 1;
250
251  // Value of parameter.
252  Value value = 2;
253}
254
255// Subscription information.
256message Subscription {
257  // The timestamp when the subscription begins, if applicable.
258  google.protobuf.Timestamp start_time = 3;
259
260  // The timestamp when the subscription ends, if applicable.
261  google.protobuf.Timestamp end_time = 1;
262
263  // Whether auto renewal is enabled by user choice on current subscription.
264  // This field indicates order/subscription status after pending plan change is
265  // cancelled or rejected.
266  bool auto_renewal_enabled = 2;
267}
268