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/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/commerce/consumer/procurement/v1alpha1/order.proto"; 24import "google/longrunning/operations.proto"; 25 26option go_package = "cloud.google.com/go/commerce/consumer/procurement/apiv1alpha1/procurementpb;procurementpb"; 27option java_multiple_files = true; 28option java_package = "com.google.cloud.commerce.consumer.procurement.v1alpha1"; 29 30// ConsumerProcurementService allows customers to make purchases of products 31// served by the Cloud Commerce platform. 32// 33// 34// When purchases are made, the 35// [ConsumerProcurementService][google.cloud.commerce.consumer.procurement.v1alpha1.ConsumerProcurementService] 36// programs the appropriate backends, including both Google's own 37// infrastructure, as well as third-party systems, and to enable billing setup 38// for charging for the procured item. 39// 40service ConsumerProcurementService { 41 option (google.api.default_host) = 42 "cloudcommerceconsumerprocurement.googleapis.com"; 43 option (google.api.oauth_scopes) = 44 "https://www.googleapis.com/auth/cloud-platform"; 45 46 // Creates a new 47 // [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order]. 48 // 49 // This API only supports GCP spend-based committed use 50 // discounts specified by GCP documentation. 51 // 52 // The returned long-running operation is in-progress until the backend 53 // completes the creation of the resource. Once completed, the order is 54 // in 55 // [OrderState.ORDER_STATE_ACTIVE][google.cloud.commerce.consumer.procurement.v1alpha1.OrderState.ORDER_STATE_ACTIVE]. 56 // In case of failure, the order resource will be removed. 57 rpc PlaceOrder(PlaceOrderRequest) returns (google.longrunning.Operation) { 58 option (google.api.http) = { 59 post: "/v1alpha1/{parent=billingAccounts/*}/orders:place" 60 body: "*" 61 }; 62 option (google.longrunning.operation_info) = { 63 response_type: "Order" 64 metadata_type: "PlaceOrderMetadata" 65 }; 66 } 67 68 // Returns the requested 69 // [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order] 70 // resource. 71 rpc GetOrder(GetOrderRequest) returns (Order) { 72 option (google.api.http) = { 73 get: "/v1alpha1/{name=billingAccounts/*/orders/*}" 74 }; 75 option (google.api.method_signature) = "name"; 76 } 77 78 // Lists [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order] 79 // resources that the user has access to, within the scope of the parent 80 // resource. 81 rpc ListOrders(ListOrdersRequest) returns (ListOrdersResponse) { 82 option (google.api.http) = { 83 get: "/v1alpha1/{parent=billingAccounts/*}/orders" 84 }; 85 option (google.api.method_signature) = "parent"; 86 } 87} 88 89// Request message for 90// [ConsumerProcurementService.PlaceOrder][google.cloud.commerce.consumer.procurement.v1alpha1.ConsumerProcurementService.PlaceOrder]. 91message PlaceOrderRequest { 92 // Required. The resource name of the parent resource. 93 // This field has the form `billingAccounts/{billing-account-id}`. 94 string parent = 1 [ 95 (google.api.field_behavior) = REQUIRED, 96 (google.api.resource_reference) = { 97 type: "cloudbilling.googleapis.com/BillingAccount" 98 } 99 ]; 100 101 // Required. The user-specified name of the order being placed. 102 string display_name = 6 [(google.api.field_behavior) = REQUIRED]; 103 104 // Optional. Places order for offer. Required when an offer-based order is 105 // being placed. 106 repeated LineItemInfo line_item_info = 10 107 [(google.api.field_behavior) = OPTIONAL]; 108 109 // Optional. A unique identifier for this request. 110 // The server will ignore subsequent requests that provide a duplicate request 111 // ID for at least 120 minutes after the first request. 112 // 113 // The request ID must be a valid 114 // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). 115 string request_id = 7 [(google.api.field_behavior) = OPTIONAL]; 116} 117 118// Message stored in the metadata field of the Operation returned by 119// [ConsumerProcurementService.PlaceOrder][google.cloud.commerce.consumer.procurement.v1alpha1.ConsumerProcurementService.PlaceOrder]. 120message PlaceOrderMetadata {} 121 122// Request message for 123// [ConsumerProcurementService.GetOrder][google.cloud.commerce.consumer.procurement.v1alpha1.ConsumerProcurementService.GetOrder] 124message GetOrderRequest { 125 // Required. The name of the order to retrieve. 126 string name = 1 [(google.api.field_behavior) = REQUIRED]; 127} 128 129// Request message for 130// [ConsumerProcurementService.ListOrders][google.cloud.commerce.consumer.procurement.v1alpha1.ConsumerProcurementService.ListOrders]. 131message ListOrdersRequest { 132 // Required. The parent resource to query for orders. 133 // This field has the form `billingAccounts/{billing-account-id}`. 134 string parent = 1 [(google.api.field_behavior) = REQUIRED]; 135 136 // The maximum number of entries requested. 137 // The default page size is 25 and the maximum page size is 200. 138 int32 page_size = 2; 139 140 // The token for fetching the next page. 141 string page_token = 3; 142 143 // Filter that you can use to limit the list request. 144 // 145 // A query string that can match a selected set of attributes 146 // with string values. For example, `display_name=abc`. 147 // Supported query attributes are 148 // 149 // * `display_name` 150 // 151 // If the query contains special characters other than letters, 152 // underscore, or digits, the phrase must be quoted with double quotes. For 153 // example, `display_name="foo:bar"`, where the display name needs to be 154 // quoted because it contains special character colon. 155 // 156 // Queries can be combined with `OR`, and `NOT` to form more complex queries. 157 // You can also group them to force a desired evaluation order. 158 // For example, `display_name=abc OR display_name=def`. 159 string filter = 4; 160} 161 162// Response message for 163// [ConsumerProcurementService.ListOrders][google.cloud.commerce.consumer.procurement.v1alpha1.ConsumerProcurementService.ListOrders]. 164message ListOrdersResponse { 165 // The list of orders in this response. 166 repeated Order orders = 1; 167 168 // The token for fetching the next page. 169 string next_page_token = 2; 170} 171