Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [cloudcommerceconsumerprocurement] add Order modification RPCs and License Management Service #5737

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions packages/google-cloud-commerce-consumer-procurement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
1. [Select or create a Cloud Platform project][projects].
1. [Enable billing for your project][billing].
1. [Enable the Cloud Commerce Consumer Procurement API API][enable_api].
1. [Set up authentication with a service account][auth] so you can access the
1. [Set up authentication][auth] so you can access the
API from your local workstation.

### Installing the client library
Expand Down Expand Up @@ -125,9 +125,16 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Consumer_procurement_service.cancel_order | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.cancel_order.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.cancel_order.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| Consumer_procurement_service.get_order | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.get_order.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.get_order.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| Consumer_procurement_service.list_orders | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.list_orders.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.list_orders.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| Consumer_procurement_service.modify_order | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.modify_order.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.modify_order.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| Consumer_procurement_service.place_order | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.place_order.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/consumer_procurement_service.place_order.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| License_management_service.assign | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.assign.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.assign.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| License_management_service.enumerate_licensed_users | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.enumerate_licensed_users.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.enumerate_licensed_users.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| License_management_service.get_license_pool | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.get_license_pool.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.get_license_pool.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| License_management_service.unassign | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.unassign.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.unassign.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| License_management_service.update_license_pool | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.update_license_pool.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1/license_management_service.update_license_pool.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| Consumer_procurement_service.get_order | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1alpha1/consumer_procurement_service.get_order.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1alpha1/consumer_procurement_service.get_order.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| Consumer_procurement_service.list_orders | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1alpha1/consumer_procurement_service.list_orders.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1alpha1/consumer_procurement_service.list_orders.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
| Consumer_procurement_service.place_order | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-commerce-consumer-procurement/samples/generated/v1alpha1/consumer_procurement_service.place_order.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-commerce-consumer-procurement/samples/generated/v1alpha1/consumer_procurement_service.place_order.js,packages/google-cloud-commerce-consumer-procurement/samples/README.md) |
Expand Down Expand Up @@ -201,4 +208,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudcommerceconsumerprocurement.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started
[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.commerce.consumer.procurement.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.Commerce.Consumer.Procurement.V1";
option go_package = "cloud.google.com/go/commerce/consumer/procurement/apiv1/procurementpb;procurementpb";
option java_multiple_files = true;
option java_outer_classname = "LicenseManagementServiceProto";
option java_package = "com.google.cloud.commerce.consumer.procurement.v1";
option php_namespace = "Google\\Cloud\\Commerce\\Consumer\\Procurement\\V1";
option ruby_package = "Google::Cloud::Commerce::Consumer::Procurement::V1";

// Service for managing licenses.
service LicenseManagementService {
option (google.api.default_host) =
"cloudcommerceconsumerprocurement.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";

// Gets the license pool.
rpc GetLicensePool(GetLicensePoolRequest) returns (LicensePool) {
option (google.api.http) = {
get: "/v1/{name=billingAccounts/*/orders/*/licensePool}"
};
option (google.api.method_signature) = "name";
}

// Updates the license pool if one exists for this Order.
rpc UpdateLicensePool(UpdateLicensePoolRequest) returns (LicensePool) {
option (google.api.http) = {
patch: "/v1/{license_pool.name=billingAccounts/*/orders/*/licensePool/*}"
body: "license_pool"
};
option (google.api.method_signature) = "license_pool,update_mask";
}

// Assigns a license to a user.
rpc Assign(AssignRequest) returns (AssignResponse) {
option (google.api.http) = {
post: "/v1/{parent=billingAccounts/*/orders/*/licensePool}:assign"
body: "*"
};
option (google.api.method_signature) = "parent,usernames";
}

// Unassigns a license from a user.
rpc Unassign(UnassignRequest) returns (UnassignResponse) {
option (google.api.http) = {
post: "/v1/{parent=billingAccounts/*/orders/*/licensePool}:unassign"
body: "*"
};
option (google.api.method_signature) = "parent,usernames";
}

// Enumerates all users assigned a license.
rpc EnumerateLicensedUsers(EnumerateLicensedUsersRequest)
returns (EnumerateLicensedUsersResponse) {
option (google.api.http) = {
get: "/v1/{parent=billingAccounts/*/orders/*/licensePool}:enumerateLicensedUsers"
};
option (google.api.method_signature) = "parent";
}
}

// Assignment protocol for a license pool.
message AssignmentProtocol {
// Allow manual assignments triggered by administrative operations only.
message ManualAssignmentType {}

// Configuration for automatic assignments handled by data plane operations.
message AutoAssignmentType {
// Optional. The time to live for an inactive license. After this time has
// passed, the license will be automatically unassigned from the user. Must
// be at least 7 days, if set. If unset, the license will never expire.
google.protobuf.Duration inactive_license_ttl = 1
[(google.api.field_behavior) = OPTIONAL];
}

// The type of assignment protocol.
oneof assignment_type {
// Allow manual assignments triggered by administrative operations only.
ManualAssignmentType manual_assignment_type = 2;

// Allow automatic assignments triggered by data plane operations.
AutoAssignmentType auto_assignment_type = 3;
}
}

// A license pool represents a pool of licenses that can be assigned to users.
message LicensePool {
option (google.api.resource) = {
type: "cloudcommerceconsumerprocurement.googleapis.com/LicensePool"
pattern: "billingAccounts/{billing_account}/orders/{order}/licensePool"
plural: "licensePools"
singular: "licensePool"
};

// Identifier. Format:
// `billingAccounts/{billing_account}/orders/{order}/licensePool`
string name = 1 [(google.api.field_behavior) = IDENTIFIER];

// Required. Assignment protocol for the license pool.
AssignmentProtocol license_assignment_protocol = 2
[(google.api.field_behavior) = REQUIRED];

// Output only. Licenses count that are available to be assigned.
int32 available_license_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Total number of licenses in the pool.
int32 total_license_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request message for getting a license pool.
message GetLicensePoolRequest {
// Required. The name of the license pool to get.
// Format: `billingAccounts/{billing_account}/orders/{order}/licensePool`
string name = 1 [(google.api.field_behavior) = REQUIRED];
}

// Request message for updating a license pool.
message UpdateLicensePoolRequest {
// Required. The license pool to update.
//
// The license pool's name field is used to identify the license pool to
// update. Format:
// `billingAccounts/{billing_account}/orders/{order}/licensePool`.
LicensePool license_pool = 1 [(google.api.field_behavior) = REQUIRED];

// Required. The list of fields to update.
google.protobuf.FieldMask update_mask = 2
[(google.api.field_behavior) = REQUIRED];
}

// Request message for
// [LicenseManagementService.Assign][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Assign].
message AssignRequest {
// Required. License pool name.
string parent = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Username.
// Format: `[email protected]`.
repeated string usernames = 2 [(google.api.field_behavior) = REQUIRED];
}

// Response message for
// [LicenseManagementService.Assign][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Assign].
message AssignResponse {}

// Request message for
// [LicenseManagementService.Unassign][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Unassign].
message UnassignRequest {
// Required. License pool name.
string parent = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Username.
// Format: `[email protected]`.
repeated string usernames = 2 [(google.api.field_behavior) = REQUIRED];
}

// Response message for
// [LicenseManagementService.Unassign][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Unassign].
message UnassignResponse {}

// Request message for
// [LicenseManagementService.EnumerateLicensedUsers][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.EnumerateLicensedUsers].
message EnumerateLicensedUsersRequest {
// Required. License pool name.
string parent = 1 [(google.api.field_behavior) = REQUIRED];

// Optional. The maximum number of users to return. The service may return
// fewer than this value.
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. A page token, received from a previous `EnumerateLicensedUsers`
// call. Provide this to retrieve the subsequent page.
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// A licensed user.
message LicensedUser {
// Username.
// Format: `[email protected]`.
string username = 1;

// Output only. Timestamp when the license was assigned.
google.protobuf.Timestamp assign_time = 2
[(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Timestamp when the license was recently used. This may not be
// the most recent usage time, and will be updated regularly (within 24
// hours).
google.protobuf.Timestamp recent_usage_time = 3
[(google.api.field_behavior) = OUTPUT_ONLY];
}

// Response message for
// [LicenseManagementService.EnumerateLicensedUsers][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.EnumerateLicensedUsers].
message EnumerateLicensedUsersResponse {
// The list of licensed users.
repeated LicensedUser licensed_users = 1;

// A token that can be sent as `page_token` to retrieve the next page.
// If this field is omitted, there are no subsequent pages.
string next_page_token = 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,32 @@ enum LineItemChangeState {
// Sentinel value. Do not use.
LINE_ITEM_CHANGE_STATE_UNSPECIFIED = 0;

// Change is in this state when a change is initiated and waiting for
// partner approval.
// Change is in this state when a change is initiated and waiting for partner
// approval. This state is only applicable for pending change.
LINE_ITEM_CHANGE_STATE_PENDING_APPROVAL = 1;

// Change is in this state after it's approved by the partner or auto-approved
// but before it takes effect. The change can be overwritten
// or cancelled depending on the new line item info property (pending Private
// Offer change cannot be cancelled and can only be overwritten by another
// Private Offer).
// but before it takes effect. The change can be overwritten or cancelled
// depending on the new line item info property (pending Private Offer change
// cannot be cancelled and can only be overwritten by another Private Offer).
// This state is only applicable for pending change.
LINE_ITEM_CHANGE_STATE_APPROVED = 2;

// Change is in this state after it's been activated.
// Change is in this state after it's been activated. This state is only
// applicable for change in history.
LINE_ITEM_CHANGE_STATE_COMPLETED = 3;

// Change is in this state if it was rejected by the partner.
// Change is in this state if it was rejected by the partner. This state is
// only applicable for change in history.
LINE_ITEM_CHANGE_STATE_REJECTED = 4;

// Change is in this state if it was abandoned by the user.
// Change is in this state if it was abandoned by the user. This state is only
// applicable for change in history.
LINE_ITEM_CHANGE_STATE_ABANDONED = 5;

// Change is in this state if it's currently being provisioned downstream. The
// change can't be overwritten or cancelled when it's in this state.
// change can't be overwritten or cancelled when it's in this state. This
// state is only applicable for pending change.
LINE_ITEM_CHANGE_STATE_ACTIVATING = 6;
}

Expand Down
Loading
Loading