|
| 1 | +/* |
| 2 | + * Copyright 2023 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package com.google.cloud.commerce.consumer.procurement.v1; |
| 18 | + |
| 19 | +import static com.google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementServiceClient.ListOrdersPagedResponse; |
| 20 | + |
| 21 | +import com.google.api.core.ApiFunction; |
| 22 | +import com.google.api.core.BetaApi; |
| 23 | +import com.google.api.gax.core.GoogleCredentialsProvider; |
| 24 | +import com.google.api.gax.core.InstantiatingExecutorProvider; |
| 25 | +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; |
| 26 | +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; |
| 27 | +import com.google.api.gax.rpc.ApiClientHeaderProvider; |
| 28 | +import com.google.api.gax.rpc.ClientContext; |
| 29 | +import com.google.api.gax.rpc.ClientSettings; |
| 30 | +import com.google.api.gax.rpc.OperationCallSettings; |
| 31 | +import com.google.api.gax.rpc.PagedCallSettings; |
| 32 | +import com.google.api.gax.rpc.TransportChannelProvider; |
| 33 | +import com.google.api.gax.rpc.UnaryCallSettings; |
| 34 | +import com.google.cloud.commerce.consumer.procurement.v1.stub.ConsumerProcurementServiceStubSettings; |
| 35 | +import com.google.longrunning.Operation; |
| 36 | +import java.io.IOException; |
| 37 | +import java.util.List; |
| 38 | +import javax.annotation.Generated; |
| 39 | + |
| 40 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 41 | +/** |
| 42 | + * Settings class to configure an instance of {@link ConsumerProcurementServiceClient}. |
| 43 | + * |
| 44 | + * <p>The default instance has everything set to sensible defaults: |
| 45 | + * |
| 46 | + * <ul> |
| 47 | + * <li>The default service address (cloudcommerceconsumerprocurement.googleapis.com) and default |
| 48 | + * port (443) are used. |
| 49 | + * <li>Credentials are acquired automatically through Application Default Credentials. |
| 50 | + * <li>Retries are configured for idempotent methods but not for non-idempotent methods. |
| 51 | + * </ul> |
| 52 | + * |
| 53 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 54 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 55 | + * |
| 56 | + * <p>For example, to set the total timeout of getOrder to 30 seconds: |
| 57 | + * |
| 58 | + * <pre>{@code |
| 59 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 60 | + * // It will require modifications to work: |
| 61 | + * // - It may require correct/in-range values for request initialization. |
| 62 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 63 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 64 | + * ConsumerProcurementServiceSettings.Builder consumerProcurementServiceSettingsBuilder = |
| 65 | + * ConsumerProcurementServiceSettings.newBuilder(); |
| 66 | + * consumerProcurementServiceSettingsBuilder |
| 67 | + * .getOrderSettings() |
| 68 | + * .setRetrySettings( |
| 69 | + * consumerProcurementServiceSettingsBuilder |
| 70 | + * .getOrderSettings() |
| 71 | + * .getRetrySettings() |
| 72 | + * .toBuilder() |
| 73 | + * .setTotalTimeout(Duration.ofSeconds(30)) |
| 74 | + * .build()); |
| 75 | + * ConsumerProcurementServiceSettings consumerProcurementServiceSettings = |
| 76 | + * consumerProcurementServiceSettingsBuilder.build(); |
| 77 | + * }</pre> |
| 78 | + */ |
| 79 | +@Generated("by gapic-generator-java") |
| 80 | +public class ConsumerProcurementServiceSettings |
| 81 | + extends ClientSettings<ConsumerProcurementServiceSettings> { |
| 82 | + |
| 83 | + /** Returns the object with the settings used for calls to placeOrder. */ |
| 84 | + public UnaryCallSettings<PlaceOrderRequest, Operation> placeOrderSettings() { |
| 85 | + return ((ConsumerProcurementServiceStubSettings) getStubSettings()).placeOrderSettings(); |
| 86 | + } |
| 87 | + |
| 88 | + /** Returns the object with the settings used for calls to placeOrder. */ |
| 89 | + public OperationCallSettings<PlaceOrderRequest, Order, PlaceOrderMetadata> |
| 90 | + placeOrderOperationSettings() { |
| 91 | + return ((ConsumerProcurementServiceStubSettings) getStubSettings()) |
| 92 | + .placeOrderOperationSettings(); |
| 93 | + } |
| 94 | + |
| 95 | + /** Returns the object with the settings used for calls to getOrder. */ |
| 96 | + public UnaryCallSettings<GetOrderRequest, Order> getOrderSettings() { |
| 97 | + return ((ConsumerProcurementServiceStubSettings) getStubSettings()).getOrderSettings(); |
| 98 | + } |
| 99 | + |
| 100 | + /** Returns the object with the settings used for calls to listOrders. */ |
| 101 | + public PagedCallSettings<ListOrdersRequest, ListOrdersResponse, ListOrdersPagedResponse> |
| 102 | + listOrdersSettings() { |
| 103 | + return ((ConsumerProcurementServiceStubSettings) getStubSettings()).listOrdersSettings(); |
| 104 | + } |
| 105 | + |
| 106 | + public static final ConsumerProcurementServiceSettings create( |
| 107 | + ConsumerProcurementServiceStubSettings stub) throws IOException { |
| 108 | + return new ConsumerProcurementServiceSettings.Builder(stub.toBuilder()).build(); |
| 109 | + } |
| 110 | + |
| 111 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 112 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 113 | + return ConsumerProcurementServiceStubSettings.defaultExecutorProviderBuilder(); |
| 114 | + } |
| 115 | + |
| 116 | + /** Returns the default service endpoint. */ |
| 117 | + public static String getDefaultEndpoint() { |
| 118 | + return ConsumerProcurementServiceStubSettings.getDefaultEndpoint(); |
| 119 | + } |
| 120 | + |
| 121 | + /** Returns the default service scopes. */ |
| 122 | + public static List<String> getDefaultServiceScopes() { |
| 123 | + return ConsumerProcurementServiceStubSettings.getDefaultServiceScopes(); |
| 124 | + } |
| 125 | + |
| 126 | + /** Returns a builder for the default credentials for this service. */ |
| 127 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 128 | + return ConsumerProcurementServiceStubSettings.defaultCredentialsProviderBuilder(); |
| 129 | + } |
| 130 | + |
| 131 | + /** Returns a builder for the default gRPC ChannelProvider for this service. */ |
| 132 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 133 | + return ConsumerProcurementServiceStubSettings.defaultGrpcTransportProviderBuilder(); |
| 134 | + } |
| 135 | + |
| 136 | + /** Returns a builder for the default REST ChannelProvider for this service. */ |
| 137 | + @BetaApi |
| 138 | + public static InstantiatingHttpJsonChannelProvider.Builder |
| 139 | + defaultHttpJsonTransportProviderBuilder() { |
| 140 | + return ConsumerProcurementServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); |
| 141 | + } |
| 142 | + |
| 143 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 144 | + return ConsumerProcurementServiceStubSettings.defaultTransportChannelProvider(); |
| 145 | + } |
| 146 | + |
| 147 | + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") |
| 148 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 149 | + return ConsumerProcurementServiceStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 150 | + } |
| 151 | + |
| 152 | + /** Returns a new gRPC builder for this class. */ |
| 153 | + public static Builder newBuilder() { |
| 154 | + return Builder.createDefault(); |
| 155 | + } |
| 156 | + |
| 157 | + /** Returns a new REST builder for this class. */ |
| 158 | + @BetaApi |
| 159 | + public static Builder newHttpJsonBuilder() { |
| 160 | + return Builder.createHttpJsonDefault(); |
| 161 | + } |
| 162 | + |
| 163 | + /** Returns a new builder for this class. */ |
| 164 | + public static Builder newBuilder(ClientContext clientContext) { |
| 165 | + return new Builder(clientContext); |
| 166 | + } |
| 167 | + |
| 168 | + /** Returns a builder containing all the values of this settings class. */ |
| 169 | + public Builder toBuilder() { |
| 170 | + return new Builder(this); |
| 171 | + } |
| 172 | + |
| 173 | + protected ConsumerProcurementServiceSettings(Builder settingsBuilder) throws IOException { |
| 174 | + super(settingsBuilder); |
| 175 | + } |
| 176 | + |
| 177 | + /** Builder for ConsumerProcurementServiceSettings. */ |
| 178 | + public static class Builder |
| 179 | + extends ClientSettings.Builder<ConsumerProcurementServiceSettings, Builder> { |
| 180 | + |
| 181 | + protected Builder() throws IOException { |
| 182 | + this(((ClientContext) null)); |
| 183 | + } |
| 184 | + |
| 185 | + protected Builder(ClientContext clientContext) { |
| 186 | + super(ConsumerProcurementServiceStubSettings.newBuilder(clientContext)); |
| 187 | + } |
| 188 | + |
| 189 | + protected Builder(ConsumerProcurementServiceSettings settings) { |
| 190 | + super(settings.getStubSettings().toBuilder()); |
| 191 | + } |
| 192 | + |
| 193 | + protected Builder(ConsumerProcurementServiceStubSettings.Builder stubSettings) { |
| 194 | + super(stubSettings); |
| 195 | + } |
| 196 | + |
| 197 | + private static Builder createDefault() { |
| 198 | + return new Builder(ConsumerProcurementServiceStubSettings.newBuilder()); |
| 199 | + } |
| 200 | + |
| 201 | + @BetaApi |
| 202 | + private static Builder createHttpJsonDefault() { |
| 203 | + return new Builder(ConsumerProcurementServiceStubSettings.newHttpJsonBuilder()); |
| 204 | + } |
| 205 | + |
| 206 | + public ConsumerProcurementServiceStubSettings.Builder getStubSettingsBuilder() { |
| 207 | + return ((ConsumerProcurementServiceStubSettings.Builder) getStubSettings()); |
| 208 | + } |
| 209 | + |
| 210 | + /** |
| 211 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 212 | + * |
| 213 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 214 | + */ |
| 215 | + public Builder applyToAllUnaryMethods( |
| 216 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 217 | + super.applyToAllUnaryMethods( |
| 218 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 219 | + return this; |
| 220 | + } |
| 221 | + |
| 222 | + /** Returns the builder for the settings used for calls to placeOrder. */ |
| 223 | + public UnaryCallSettings.Builder<PlaceOrderRequest, Operation> placeOrderSettings() { |
| 224 | + return getStubSettingsBuilder().placeOrderSettings(); |
| 225 | + } |
| 226 | + |
| 227 | + /** Returns the builder for the settings used for calls to placeOrder. */ |
| 228 | + public OperationCallSettings.Builder<PlaceOrderRequest, Order, PlaceOrderMetadata> |
| 229 | + placeOrderOperationSettings() { |
| 230 | + return getStubSettingsBuilder().placeOrderOperationSettings(); |
| 231 | + } |
| 232 | + |
| 233 | + /** Returns the builder for the settings used for calls to getOrder. */ |
| 234 | + public UnaryCallSettings.Builder<GetOrderRequest, Order> getOrderSettings() { |
| 235 | + return getStubSettingsBuilder().getOrderSettings(); |
| 236 | + } |
| 237 | + |
| 238 | + /** Returns the builder for the settings used for calls to listOrders. */ |
| 239 | + public PagedCallSettings.Builder<ListOrdersRequest, ListOrdersResponse, ListOrdersPagedResponse> |
| 240 | + listOrdersSettings() { |
| 241 | + return getStubSettingsBuilder().listOrdersSettings(); |
| 242 | + } |
| 243 | + |
| 244 | + @Override |
| 245 | + public ConsumerProcurementServiceSettings build() throws IOException { |
| 246 | + return new ConsumerProcurementServiceSettings(this); |
| 247 | + } |
| 248 | + } |
| 249 | +} |
0 commit comments