|
| 1 | +/* |
| 2 | + * Copyright 2025 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.shopping.merchant.accounts.v1beta; |
| 18 | + |
| 19 | +import com.google.api.core.ApiFunction; |
| 20 | +import com.google.api.core.BetaApi; |
| 21 | +import com.google.api.gax.core.GoogleCredentialsProvider; |
| 22 | +import com.google.api.gax.core.InstantiatingExecutorProvider; |
| 23 | +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; |
| 24 | +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; |
| 25 | +import com.google.api.gax.rpc.ApiClientHeaderProvider; |
| 26 | +import com.google.api.gax.rpc.ClientContext; |
| 27 | +import com.google.api.gax.rpc.ClientSettings; |
| 28 | +import com.google.api.gax.rpc.TransportChannelProvider; |
| 29 | +import com.google.api.gax.rpc.UnaryCallSettings; |
| 30 | +import com.google.protobuf.Empty; |
| 31 | +import com.google.shopping.merchant.accounts.v1beta.stub.CheckoutSettingsServiceStubSettings; |
| 32 | +import java.io.IOException; |
| 33 | +import java.util.List; |
| 34 | +import javax.annotation.Generated; |
| 35 | + |
| 36 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 37 | +/** |
| 38 | + * Settings class to configure an instance of {@link CheckoutSettingsServiceClient}. |
| 39 | + * |
| 40 | + * <p>The default instance has everything set to sensible defaults: |
| 41 | + * |
| 42 | + * <ul> |
| 43 | + * <li>The default service address (merchantapi.googleapis.com) and default port (443) are used. |
| 44 | + * <li>Credentials are acquired automatically through Application Default Credentials. |
| 45 | + * <li>Retries are configured for idempotent methods but not for non-idempotent methods. |
| 46 | + * </ul> |
| 47 | + * |
| 48 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 49 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 50 | + * |
| 51 | + * <p>For example, to set the |
| 52 | + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) |
| 53 | + * of getCheckoutSettings: |
| 54 | + * |
| 55 | + * <pre>{@code |
| 56 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 57 | + * // It will require modifications to work: |
| 58 | + * // - It may require correct/in-range values for request initialization. |
| 59 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 60 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 61 | + * CheckoutSettingsServiceSettings.Builder checkoutSettingsServiceSettingsBuilder = |
| 62 | + * CheckoutSettingsServiceSettings.newBuilder(); |
| 63 | + * checkoutSettingsServiceSettingsBuilder |
| 64 | + * .getCheckoutSettingsSettings() |
| 65 | + * .setRetrySettings( |
| 66 | + * checkoutSettingsServiceSettingsBuilder |
| 67 | + * .getCheckoutSettingsSettings() |
| 68 | + * .getRetrySettings() |
| 69 | + * .toBuilder() |
| 70 | + * .setInitialRetryDelayDuration(Duration.ofSeconds(1)) |
| 71 | + * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5)) |
| 72 | + * .setMaxAttempts(5) |
| 73 | + * .setMaxRetryDelayDuration(Duration.ofSeconds(30)) |
| 74 | + * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60)) |
| 75 | + * .setRetryDelayMultiplier(1.3) |
| 76 | + * .setRpcTimeoutMultiplier(1.5) |
| 77 | + * .setTotalTimeoutDuration(Duration.ofSeconds(300)) |
| 78 | + * .build()); |
| 79 | + * CheckoutSettingsServiceSettings checkoutSettingsServiceSettings = |
| 80 | + * checkoutSettingsServiceSettingsBuilder.build(); |
| 81 | + * }</pre> |
| 82 | + * |
| 83 | + * Please refer to the [Client Side Retry |
| 84 | + * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for |
| 85 | + * additional support in setting retries. |
| 86 | + */ |
| 87 | +@BetaApi |
| 88 | +@Generated("by gapic-generator-java") |
| 89 | +public class CheckoutSettingsServiceSettings |
| 90 | + extends ClientSettings<CheckoutSettingsServiceSettings> { |
| 91 | + |
| 92 | + /** Returns the object with the settings used for calls to getCheckoutSettings. */ |
| 93 | + public UnaryCallSettings<GetCheckoutSettingsRequest, CheckoutSettings> |
| 94 | + getCheckoutSettingsSettings() { |
| 95 | + return ((CheckoutSettingsServiceStubSettings) getStubSettings()).getCheckoutSettingsSettings(); |
| 96 | + } |
| 97 | + |
| 98 | + /** Returns the object with the settings used for calls to createCheckoutSettings. */ |
| 99 | + public UnaryCallSettings<CreateCheckoutSettingsRequest, CheckoutSettings> |
| 100 | + createCheckoutSettingsSettings() { |
| 101 | + return ((CheckoutSettingsServiceStubSettings) getStubSettings()) |
| 102 | + .createCheckoutSettingsSettings(); |
| 103 | + } |
| 104 | + |
| 105 | + /** Returns the object with the settings used for calls to updateCheckoutSettings. */ |
| 106 | + public UnaryCallSettings<UpdateCheckoutSettingsRequest, CheckoutSettings> |
| 107 | + updateCheckoutSettingsSettings() { |
| 108 | + return ((CheckoutSettingsServiceStubSettings) getStubSettings()) |
| 109 | + .updateCheckoutSettingsSettings(); |
| 110 | + } |
| 111 | + |
| 112 | + /** Returns the object with the settings used for calls to deleteCheckoutSettings. */ |
| 113 | + public UnaryCallSettings<DeleteCheckoutSettingsRequest, Empty> deleteCheckoutSettingsSettings() { |
| 114 | + return ((CheckoutSettingsServiceStubSettings) getStubSettings()) |
| 115 | + .deleteCheckoutSettingsSettings(); |
| 116 | + } |
| 117 | + |
| 118 | + public static final CheckoutSettingsServiceSettings create( |
| 119 | + CheckoutSettingsServiceStubSettings stub) throws IOException { |
| 120 | + return new CheckoutSettingsServiceSettings.Builder(stub.toBuilder()).build(); |
| 121 | + } |
| 122 | + |
| 123 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 124 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 125 | + return CheckoutSettingsServiceStubSettings.defaultExecutorProviderBuilder(); |
| 126 | + } |
| 127 | + |
| 128 | + /** Returns the default service endpoint. */ |
| 129 | + public static String getDefaultEndpoint() { |
| 130 | + return CheckoutSettingsServiceStubSettings.getDefaultEndpoint(); |
| 131 | + } |
| 132 | + |
| 133 | + /** Returns the default service scopes. */ |
| 134 | + public static List<String> getDefaultServiceScopes() { |
| 135 | + return CheckoutSettingsServiceStubSettings.getDefaultServiceScopes(); |
| 136 | + } |
| 137 | + |
| 138 | + /** Returns a builder for the default credentials for this service. */ |
| 139 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 140 | + return CheckoutSettingsServiceStubSettings.defaultCredentialsProviderBuilder(); |
| 141 | + } |
| 142 | + |
| 143 | + /** Returns a builder for the default gRPC ChannelProvider for this service. */ |
| 144 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 145 | + return CheckoutSettingsServiceStubSettings.defaultGrpcTransportProviderBuilder(); |
| 146 | + } |
| 147 | + |
| 148 | + /** Returns a builder for the default REST ChannelProvider for this service. */ |
| 149 | + @BetaApi |
| 150 | + public static InstantiatingHttpJsonChannelProvider.Builder |
| 151 | + defaultHttpJsonTransportProviderBuilder() { |
| 152 | + return CheckoutSettingsServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); |
| 153 | + } |
| 154 | + |
| 155 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 156 | + return CheckoutSettingsServiceStubSettings.defaultTransportChannelProvider(); |
| 157 | + } |
| 158 | + |
| 159 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 160 | + return CheckoutSettingsServiceStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 161 | + } |
| 162 | + |
| 163 | + /** Returns a new gRPC builder for this class. */ |
| 164 | + public static Builder newBuilder() { |
| 165 | + return Builder.createDefault(); |
| 166 | + } |
| 167 | + |
| 168 | + /** Returns a new REST builder for this class. */ |
| 169 | + public static Builder newHttpJsonBuilder() { |
| 170 | + return Builder.createHttpJsonDefault(); |
| 171 | + } |
| 172 | + |
| 173 | + /** Returns a new builder for this class. */ |
| 174 | + public static Builder newBuilder(ClientContext clientContext) { |
| 175 | + return new Builder(clientContext); |
| 176 | + } |
| 177 | + |
| 178 | + /** Returns a builder containing all the values of this settings class. */ |
| 179 | + public Builder toBuilder() { |
| 180 | + return new Builder(this); |
| 181 | + } |
| 182 | + |
| 183 | + protected CheckoutSettingsServiceSettings(Builder settingsBuilder) throws IOException { |
| 184 | + super(settingsBuilder); |
| 185 | + } |
| 186 | + |
| 187 | + /** Builder for CheckoutSettingsServiceSettings. */ |
| 188 | + public static class Builder |
| 189 | + extends ClientSettings.Builder<CheckoutSettingsServiceSettings, Builder> { |
| 190 | + |
| 191 | + protected Builder() throws IOException { |
| 192 | + this(((ClientContext) null)); |
| 193 | + } |
| 194 | + |
| 195 | + protected Builder(ClientContext clientContext) { |
| 196 | + super(CheckoutSettingsServiceStubSettings.newBuilder(clientContext)); |
| 197 | + } |
| 198 | + |
| 199 | + protected Builder(CheckoutSettingsServiceSettings settings) { |
| 200 | + super(settings.getStubSettings().toBuilder()); |
| 201 | + } |
| 202 | + |
| 203 | + protected Builder(CheckoutSettingsServiceStubSettings.Builder stubSettings) { |
| 204 | + super(stubSettings); |
| 205 | + } |
| 206 | + |
| 207 | + private static Builder createDefault() { |
| 208 | + return new Builder(CheckoutSettingsServiceStubSettings.newBuilder()); |
| 209 | + } |
| 210 | + |
| 211 | + private static Builder createHttpJsonDefault() { |
| 212 | + return new Builder(CheckoutSettingsServiceStubSettings.newHttpJsonBuilder()); |
| 213 | + } |
| 214 | + |
| 215 | + public CheckoutSettingsServiceStubSettings.Builder getStubSettingsBuilder() { |
| 216 | + return ((CheckoutSettingsServiceStubSettings.Builder) getStubSettings()); |
| 217 | + } |
| 218 | + |
| 219 | + /** |
| 220 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 221 | + * |
| 222 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 223 | + */ |
| 224 | + public Builder applyToAllUnaryMethods( |
| 225 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 226 | + super.applyToAllUnaryMethods( |
| 227 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 228 | + return this; |
| 229 | + } |
| 230 | + |
| 231 | + /** Returns the builder for the settings used for calls to getCheckoutSettings. */ |
| 232 | + public UnaryCallSettings.Builder<GetCheckoutSettingsRequest, CheckoutSettings> |
| 233 | + getCheckoutSettingsSettings() { |
| 234 | + return getStubSettingsBuilder().getCheckoutSettingsSettings(); |
| 235 | + } |
| 236 | + |
| 237 | + /** Returns the builder for the settings used for calls to createCheckoutSettings. */ |
| 238 | + public UnaryCallSettings.Builder<CreateCheckoutSettingsRequest, CheckoutSettings> |
| 239 | + createCheckoutSettingsSettings() { |
| 240 | + return getStubSettingsBuilder().createCheckoutSettingsSettings(); |
| 241 | + } |
| 242 | + |
| 243 | + /** Returns the builder for the settings used for calls to updateCheckoutSettings. */ |
| 244 | + public UnaryCallSettings.Builder<UpdateCheckoutSettingsRequest, CheckoutSettings> |
| 245 | + updateCheckoutSettingsSettings() { |
| 246 | + return getStubSettingsBuilder().updateCheckoutSettingsSettings(); |
| 247 | + } |
| 248 | + |
| 249 | + /** Returns the builder for the settings used for calls to deleteCheckoutSettings. */ |
| 250 | + public UnaryCallSettings.Builder<DeleteCheckoutSettingsRequest, Empty> |
| 251 | + deleteCheckoutSettingsSettings() { |
| 252 | + return getStubSettingsBuilder().deleteCheckoutSettingsSettings(); |
| 253 | + } |
| 254 | + |
| 255 | + @Override |
| 256 | + public CheckoutSettingsServiceSettings build() throws IOException { |
| 257 | + return new CheckoutSettingsServiceSettings(this); |
| 258 | + } |
| 259 | + } |
| 260 | +} |
0 commit comments