Skip to content

Commit

Permalink
feat: [cloudcommerceconsumerprocurement] permit duplicate display nam…
Browse files Browse the repository at this point in the history
…es (#9615)

* feat: permit duplicate display names
feat: include a gRPC retry policy
chore: update proto comments

PiperOrigin-RevId: 545774653

Source-Link: googleapis/googleapis@507145d

Source-Link: https://github.com/googleapis/googleapis-gen/commit/39f1ae267c4a3cd3a0cf5d25d7cdfc865aa7b02d
Copy-Tag: eyJwIjoiamF2YS1jbG91ZGNvbW1lcmNlY29uc3VtZXJwcm9jdXJlbWVudC8uT3dsQm90LnlhbWwiLCJoIjoiMzlmMWFlMjY3YzRhM2NkM2EwY2Y1ZDI1ZDdjZGZjODY1YWE3YjAyZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Jul 7, 2023
1 parent 9cb69a8 commit 491c157
Show file tree
Hide file tree
Showing 24 changed files with 610 additions and 376 deletions.
4 changes: 2 additions & 2 deletions java-cloudcommerceconsumerprocurement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.16.0</version>
<version>26.18.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -201,7 +201,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-preview-yellow
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-cloudcommerceconsumerprocurement.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-cloudcommerceconsumerprocurement/0.17.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-cloudcommerceconsumerprocurement/0.18.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ConsumerProcurementServiceClient consumerProcurementServiceClient =
* ConsumerProcurementServiceClient.create()) {
* GetOrderRequest request = GetOrderRequest.newBuilder().setName("name3373707").build();
* Order response = consumerProcurementServiceClient.getOrder(request);
* String name = "name3373707";
* Order response = consumerProcurementServiceClient.getOrder(name);
* }
* }</pre>
*
Expand Down Expand Up @@ -219,6 +219,9 @@ public final OperationsClient getHttpJsonOperationsClient() {
/**
* Creates a new [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order].
*
* <p>This API only supports GCP spend-based committed use discounts specified by GCP
* documentation.
*
* <p>The returned long-running operation is in-progress until the backend completes the creation
* of the resource. Once completed, the order is in
* [OrderState.ORDER_STATE_ACTIVE][google.cloud.commerce.consumer.procurement.v1alpha1.OrderState.ORDER_STATE_ACTIVE].
Expand Down Expand Up @@ -257,6 +260,9 @@ public final OperationFuture<Order, PlaceOrderMetadata> placeOrderAsync(
/**
* Creates a new [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order].
*
* <p>This API only supports GCP spend-based committed use discounts specified by GCP
* documentation.
*
* <p>The returned long-running operation is in-progress until the backend completes the creation
* of the resource. Once completed, the order is in
* [OrderState.ORDER_STATE_ACTIVE][google.cloud.commerce.consumer.procurement.v1alpha1.OrderState.ORDER_STATE_ACTIVE].
Expand Down Expand Up @@ -295,6 +301,9 @@ public final OperationFuture<Order, PlaceOrderMetadata> placeOrderAsync(
/**
* Creates a new [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order].
*
* <p>This API only supports GCP spend-based committed use discounts specified by GCP
* documentation.
*
* <p>The returned long-running operation is in-progress until the backend completes the creation
* of the resource. Once completed, the order is in
* [OrderState.ORDER_STATE_ACTIVE][google.cloud.commerce.consumer.procurement.v1alpha1.OrderState.ORDER_STATE_ACTIVE].
Expand Down Expand Up @@ -328,6 +337,34 @@ public final UnaryCallable<PlaceOrderRequest, Operation> placeOrderCallable() {
return stub.placeOrderCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order]
* resource.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ConsumerProcurementServiceClient consumerProcurementServiceClient =
* ConsumerProcurementServiceClient.create()) {
* String name = "name3373707";
* Order response = consumerProcurementServiceClient.getOrder(name);
* }
* }</pre>
*
* @param name Required. The name of the order to retrieve.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Order getOrder(String name) {
GetOrderRequest request = GetOrderRequest.newBuilder().setName(name).build();
return getOrder(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order]
Expand Down Expand Up @@ -382,6 +419,37 @@ public final UnaryCallable<GetOrderRequest, Order> getOrderCallable() {
return stub.getOrderCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order] resources that the
* user has access to, within the scope of the parent resource.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ConsumerProcurementServiceClient consumerProcurementServiceClient =
* ConsumerProcurementServiceClient.create()) {
* String parent = "parent-995424086";
* for (Order element : consumerProcurementServiceClient.listOrders(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. The parent resource to query for orders. This field has the form
* `billingAccounts/{billing-account-id}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListOrdersPagedResponse listOrders(String parent) {
ListOrdersRequest request = ListOrdersRequest.newBuilder().setParent(parent).build();
return listOrders(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists [Order][google.cloud.commerce.consumer.procurement.v1alpha1.Order] resources that the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"libraryClient": "ConsumerProcurementServiceClient",
"rpcs": {
"GetOrder": {
"methods": ["getOrder", "getOrderCallable"]
"methods": ["getOrder", "getOrder", "getOrderCallable"]
},
"ListOrders": {
"methods": ["listOrders", "listOrdersPagedCallable", "listOrdersCallable"]
"methods": ["listOrders", "listOrders", "listOrdersPagedCallable", "listOrdersCallable"]
},
"PlaceOrder": {
"methods": ["placeOrderAsync", "placeOrderOperationCallable", "placeOrderCallable"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ConsumerProcurementServiceClient consumerProcurementServiceClient =
* ConsumerProcurementServiceClient.create()) {
* GetOrderRequest request = GetOrderRequest.newBuilder().setName("name3373707").build();
* Order response = consumerProcurementServiceClient.getOrder(request);
* String name = "name3373707";
* Order response = consumerProcurementServiceClient.getOrder(name);
* }
* }</pre>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ protected HttpJsonConsumerProcurementServiceStub(
"google.longrunning.Operations.GetOperation",
HttpRule.newBuilder()
.setGet("/v1alpha1/{name=billingAccounts/*/orders/*/operations/*}")
.addAdditionalBindings(
HttpRule.newBuilder()
.setGet(
"/v1alpha1/{name=billingAccounts/*/orders/*/orderAttributions/*/operations/*}")
.build())
.build())
.build());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,9 @@ public void getOrderTest() throws Exception {
.build();
mockService.addResponse(expectedResponse);

GetOrderRequest request =
GetOrderRequest.newBuilder()
.setName("billingAccounts/billingAccount-9614/orders/order-9614")
.build();
String name = "billingAccounts/billingAccount-9614/orders/order-9614";

Order actualResponse = client.getOrder(request);
Order actualResponse = client.getOrder(name);
Assert.assertEquals(expectedResponse, actualResponse);

List<String> actualRequests = mockService.getRequestPaths();
Expand All @@ -192,11 +189,8 @@ public void getOrderExceptionTest() throws Exception {
mockService.addException(exception);

try {
GetOrderRequest request =
GetOrderRequest.newBuilder()
.setName("billingAccounts/billingAccount-9614/orders/order-9614")
.build();
client.getOrder(request);
String name = "billingAccounts/billingAccount-9614/orders/order-9614";
client.getOrder(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
Expand All @@ -213,15 +207,9 @@ public void listOrdersTest() throws Exception {
.build();
mockService.addResponse(expectedResponse);

ListOrdersRequest request =
ListOrdersRequest.newBuilder()
.setParent("billingAccounts/billingAccount-7950")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
String parent = "billingAccounts/billingAccount-7950";

ListOrdersPagedResponse pagedListResponse = client.listOrders(request);
ListOrdersPagedResponse pagedListResponse = client.listOrders(parent);

List<Order> resources = Lists.newArrayList(pagedListResponse.iterateAll());

Expand Down Expand Up @@ -251,14 +239,8 @@ public void listOrdersExceptionTest() throws Exception {
mockService.addException(exception);

try {
ListOrdersRequest request =
ListOrdersRequest.newBuilder()
.setParent("billingAccounts/billingAccount-7950")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
client.listOrders(request);
String parent = "billingAccounts/billingAccount-7950";
client.listOrders(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,16 @@ public void getOrderTest() throws Exception {
.build();
mockConsumerProcurementService.addResponse(expectedResponse);

GetOrderRequest request = GetOrderRequest.newBuilder().setName("name3373707").build();
String name = "name3373707";

Order actualResponse = client.getOrder(request);
Order actualResponse = client.getOrder(name);
Assert.assertEquals(expectedResponse, actualResponse);

List<AbstractMessage> actualRequests = mockConsumerProcurementService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetOrderRequest actualRequest = ((GetOrderRequest) actualRequests.get(0));

Assert.assertEquals(request.getName(), actualRequest.getName());
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -188,8 +188,8 @@ public void getOrderExceptionTest() throws Exception {
mockConsumerProcurementService.addException(exception);

try {
GetOrderRequest request = GetOrderRequest.newBuilder().setName("name3373707").build();
client.getOrder(request);
String name = "name3373707";
client.getOrder(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
Expand All @@ -206,15 +206,9 @@ public void listOrdersTest() throws Exception {
.build();
mockConsumerProcurementService.addResponse(expectedResponse);

ListOrdersRequest request =
ListOrdersRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
String parent = "parent-995424086";

ListOrdersPagedResponse pagedListResponse = client.listOrders(request);
ListOrdersPagedResponse pagedListResponse = client.listOrders(parent);

List<Order> resources = Lists.newArrayList(pagedListResponse.iterateAll());

Expand All @@ -225,10 +219,7 @@ public void listOrdersTest() throws Exception {
Assert.assertEquals(1, actualRequests.size());
ListOrdersRequest actualRequest = ((ListOrdersRequest) actualRequests.get(0));

Assert.assertEquals(request.getParent(), actualRequest.getParent());
Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize());
Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken());
Assert.assertEquals(request.getFilter(), actualRequest.getFilter());
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -241,14 +232,8 @@ public void listOrdersExceptionTest() throws Exception {
mockConsumerProcurementService.addException(exception);

try {
ListOrdersRequest request =
ListOrdersRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
client.listOrders(request);
String parent = "parent-995424086";
client.listOrders(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
Expand Down
Loading

0 comments on commit 491c157

Please sign in to comment.