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