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