1 /* 2 * Copyright 2022 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.compute.v1; 18 19 import static com.google.cloud.compute.v1.BackendBucketsClient.ListPagedResponse; 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.httpjson.InstantiatingHttpJsonChannelProvider; 26 import com.google.api.gax.rpc.ApiClientHeaderProvider; 27 import com.google.api.gax.rpc.ClientContext; 28 import com.google.api.gax.rpc.ClientSettings; 29 import com.google.api.gax.rpc.OperationCallSettings; 30 import com.google.api.gax.rpc.PagedCallSettings; 31 import com.google.api.gax.rpc.TransportChannelProvider; 32 import com.google.api.gax.rpc.UnaryCallSettings; 33 import com.google.cloud.compute.v1.stub.BackendBucketsStubSettings; 34 import java.io.IOException; 35 import java.util.List; 36 import javax.annotation.Generated; 37 38 // AUTO-GENERATED DOCUMENTATION AND CLASS. 39 /** 40 * Settings class to configure an instance of {@link BackendBucketsClient}. 41 * 42 * <p>The default instance has everything set to sensible defaults: 43 * 44 * <ul> 45 * <li>The default service address (compute.googleapis.com) and default port (443) are used. 46 * <li>Credentials are acquired automatically through Application Default Credentials. 47 * <li>Retries are configured for idempotent methods but not for non-idempotent methods. 48 * </ul> 49 * 50 * <p>The builder of this class is recursive, so contained classes are themselves builders. When 51 * build() is called, the tree of builders is called to create the complete settings object. 52 * 53 * <p>For example, to set the total timeout of get to 30 seconds: 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 * BackendBucketsSettings.Builder backendBucketsSettingsBuilder = 62 * BackendBucketsSettings.newBuilder(); 63 * backendBucketsSettingsBuilder 64 * .getSettings() 65 * .setRetrySettings( 66 * backendBucketsSettingsBuilder 67 * .getSettings() 68 * .getRetrySettings() 69 * .toBuilder() 70 * .setTotalTimeout(Duration.ofSeconds(30)) 71 * .build()); 72 * BackendBucketsSettings backendBucketsSettings = backendBucketsSettingsBuilder.build(); 73 * }</pre> 74 */ 75 @Generated("by gapic-generator-java") 76 public class BackendBucketsSettings extends ClientSettings<BackendBucketsSettings> { 77 78 /** Returns the object with the settings used for calls to addSignedUrlKey. */ 79 public UnaryCallSettings<AddSignedUrlKeyBackendBucketRequest, Operation> addSignedUrlKeySettings()80 addSignedUrlKeySettings() { 81 return ((BackendBucketsStubSettings) getStubSettings()).addSignedUrlKeySettings(); 82 } 83 84 /** Returns the object with the settings used for calls to addSignedUrlKey. */ 85 public OperationCallSettings<AddSignedUrlKeyBackendBucketRequest, Operation, Operation> addSignedUrlKeyOperationSettings()86 addSignedUrlKeyOperationSettings() { 87 return ((BackendBucketsStubSettings) getStubSettings()).addSignedUrlKeyOperationSettings(); 88 } 89 90 /** Returns the object with the settings used for calls to delete. */ deleteSettings()91 public UnaryCallSettings<DeleteBackendBucketRequest, Operation> deleteSettings() { 92 return ((BackendBucketsStubSettings) getStubSettings()).deleteSettings(); 93 } 94 95 /** Returns the object with the settings used for calls to delete. */ 96 public OperationCallSettings<DeleteBackendBucketRequest, Operation, Operation> deleteOperationSettings()97 deleteOperationSettings() { 98 return ((BackendBucketsStubSettings) getStubSettings()).deleteOperationSettings(); 99 } 100 101 /** Returns the object with the settings used for calls to deleteSignedUrlKey. */ 102 public UnaryCallSettings<DeleteSignedUrlKeyBackendBucketRequest, Operation> deleteSignedUrlKeySettings()103 deleteSignedUrlKeySettings() { 104 return ((BackendBucketsStubSettings) getStubSettings()).deleteSignedUrlKeySettings(); 105 } 106 107 /** Returns the object with the settings used for calls to deleteSignedUrlKey. */ 108 public OperationCallSettings<DeleteSignedUrlKeyBackendBucketRequest, Operation, Operation> deleteSignedUrlKeyOperationSettings()109 deleteSignedUrlKeyOperationSettings() { 110 return ((BackendBucketsStubSettings) getStubSettings()).deleteSignedUrlKeyOperationSettings(); 111 } 112 113 /** Returns the object with the settings used for calls to get. */ getSettings()114 public UnaryCallSettings<GetBackendBucketRequest, BackendBucket> getSettings() { 115 return ((BackendBucketsStubSettings) getStubSettings()).getSettings(); 116 } 117 118 /** Returns the object with the settings used for calls to insert. */ insertSettings()119 public UnaryCallSettings<InsertBackendBucketRequest, Operation> insertSettings() { 120 return ((BackendBucketsStubSettings) getStubSettings()).insertSettings(); 121 } 122 123 /** Returns the object with the settings used for calls to insert. */ 124 public OperationCallSettings<InsertBackendBucketRequest, Operation, Operation> insertOperationSettings()125 insertOperationSettings() { 126 return ((BackendBucketsStubSettings) getStubSettings()).insertOperationSettings(); 127 } 128 129 /** Returns the object with the settings used for calls to list. */ 130 public PagedCallSettings<ListBackendBucketsRequest, BackendBucketList, ListPagedResponse> listSettings()131 listSettings() { 132 return ((BackendBucketsStubSettings) getStubSettings()).listSettings(); 133 } 134 135 /** Returns the object with the settings used for calls to patch. */ patchSettings()136 public UnaryCallSettings<PatchBackendBucketRequest, Operation> patchSettings() { 137 return ((BackendBucketsStubSettings) getStubSettings()).patchSettings(); 138 } 139 140 /** Returns the object with the settings used for calls to patch. */ 141 public OperationCallSettings<PatchBackendBucketRequest, Operation, Operation> patchOperationSettings()142 patchOperationSettings() { 143 return ((BackendBucketsStubSettings) getStubSettings()).patchOperationSettings(); 144 } 145 146 /** Returns the object with the settings used for calls to setEdgeSecurityPolicy. */ 147 public UnaryCallSettings<SetEdgeSecurityPolicyBackendBucketRequest, Operation> setEdgeSecurityPolicySettings()148 setEdgeSecurityPolicySettings() { 149 return ((BackendBucketsStubSettings) getStubSettings()).setEdgeSecurityPolicySettings(); 150 } 151 152 /** Returns the object with the settings used for calls to setEdgeSecurityPolicy. */ 153 public OperationCallSettings<SetEdgeSecurityPolicyBackendBucketRequest, Operation, Operation> setEdgeSecurityPolicyOperationSettings()154 setEdgeSecurityPolicyOperationSettings() { 155 return ((BackendBucketsStubSettings) getStubSettings()) 156 .setEdgeSecurityPolicyOperationSettings(); 157 } 158 159 /** Returns the object with the settings used for calls to update. */ updateSettings()160 public UnaryCallSettings<UpdateBackendBucketRequest, Operation> updateSettings() { 161 return ((BackendBucketsStubSettings) getStubSettings()).updateSettings(); 162 } 163 164 /** Returns the object with the settings used for calls to update. */ 165 public OperationCallSettings<UpdateBackendBucketRequest, Operation, Operation> updateOperationSettings()166 updateOperationSettings() { 167 return ((BackendBucketsStubSettings) getStubSettings()).updateOperationSettings(); 168 } 169 create(BackendBucketsStubSettings stub)170 public static final BackendBucketsSettings create(BackendBucketsStubSettings stub) 171 throws IOException { 172 return new BackendBucketsSettings.Builder(stub.toBuilder()).build(); 173 } 174 175 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()176 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 177 return BackendBucketsStubSettings.defaultExecutorProviderBuilder(); 178 } 179 180 /** Returns the default service endpoint. */ getDefaultEndpoint()181 public static String getDefaultEndpoint() { 182 return BackendBucketsStubSettings.getDefaultEndpoint(); 183 } 184 185 /** Returns the default service scopes. */ getDefaultServiceScopes()186 public static List<String> getDefaultServiceScopes() { 187 return BackendBucketsStubSettings.getDefaultServiceScopes(); 188 } 189 190 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()191 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 192 return BackendBucketsStubSettings.defaultCredentialsProviderBuilder(); 193 } 194 195 /** Returns a builder for the default ChannelProvider for this service. */ 196 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()197 defaultHttpJsonTransportProviderBuilder() { 198 return BackendBucketsStubSettings.defaultHttpJsonTransportProviderBuilder(); 199 } 200 defaultTransportChannelProvider()201 public static TransportChannelProvider defaultTransportChannelProvider() { 202 return BackendBucketsStubSettings.defaultTransportChannelProvider(); 203 } 204 205 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()206 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 207 return BackendBucketsStubSettings.defaultApiClientHeaderProviderBuilder(); 208 } 209 210 /** Returns a new builder for this class. */ newBuilder()211 public static Builder newBuilder() { 212 return Builder.createDefault(); 213 } 214 215 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)216 public static Builder newBuilder(ClientContext clientContext) { 217 return new Builder(clientContext); 218 } 219 220 /** Returns a builder containing all the values of this settings class. */ toBuilder()221 public Builder toBuilder() { 222 return new Builder(this); 223 } 224 BackendBucketsSettings(Builder settingsBuilder)225 protected BackendBucketsSettings(Builder settingsBuilder) throws IOException { 226 super(settingsBuilder); 227 } 228 229 /** Builder for BackendBucketsSettings. */ 230 public static class Builder extends ClientSettings.Builder<BackendBucketsSettings, Builder> { 231 Builder()232 protected Builder() throws IOException { 233 this(((ClientContext) null)); 234 } 235 Builder(ClientContext clientContext)236 protected Builder(ClientContext clientContext) { 237 super(BackendBucketsStubSettings.newBuilder(clientContext)); 238 } 239 Builder(BackendBucketsSettings settings)240 protected Builder(BackendBucketsSettings settings) { 241 super(settings.getStubSettings().toBuilder()); 242 } 243 Builder(BackendBucketsStubSettings.Builder stubSettings)244 protected Builder(BackendBucketsStubSettings.Builder stubSettings) { 245 super(stubSettings); 246 } 247 createDefault()248 private static Builder createDefault() { 249 return new Builder(BackendBucketsStubSettings.newBuilder()); 250 } 251 getStubSettingsBuilder()252 public BackendBucketsStubSettings.Builder getStubSettingsBuilder() { 253 return ((BackendBucketsStubSettings.Builder) getStubSettings()); 254 } 255 256 /** 257 * Applies the given settings updater function to all of the unary API methods in this service. 258 * 259 * <p>Note: This method does not support applying settings to streaming methods. 260 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)261 public Builder applyToAllUnaryMethods( 262 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 263 super.applyToAllUnaryMethods( 264 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 265 return this; 266 } 267 268 /** Returns the builder for the settings used for calls to addSignedUrlKey. */ 269 public UnaryCallSettings.Builder<AddSignedUrlKeyBackendBucketRequest, Operation> addSignedUrlKeySettings()270 addSignedUrlKeySettings() { 271 return getStubSettingsBuilder().addSignedUrlKeySettings(); 272 } 273 274 /** Returns the builder for the settings used for calls to addSignedUrlKey. */ 275 public OperationCallSettings.Builder<AddSignedUrlKeyBackendBucketRequest, Operation, Operation> addSignedUrlKeyOperationSettings()276 addSignedUrlKeyOperationSettings() { 277 return getStubSettingsBuilder().addSignedUrlKeyOperationSettings(); 278 } 279 280 /** Returns the builder for the settings used for calls to delete. */ deleteSettings()281 public UnaryCallSettings.Builder<DeleteBackendBucketRequest, Operation> deleteSettings() { 282 return getStubSettingsBuilder().deleteSettings(); 283 } 284 285 /** Returns the builder for the settings used for calls to delete. */ 286 public OperationCallSettings.Builder<DeleteBackendBucketRequest, Operation, Operation> deleteOperationSettings()287 deleteOperationSettings() { 288 return getStubSettingsBuilder().deleteOperationSettings(); 289 } 290 291 /** Returns the builder for the settings used for calls to deleteSignedUrlKey. */ 292 public UnaryCallSettings.Builder<DeleteSignedUrlKeyBackendBucketRequest, Operation> deleteSignedUrlKeySettings()293 deleteSignedUrlKeySettings() { 294 return getStubSettingsBuilder().deleteSignedUrlKeySettings(); 295 } 296 297 /** Returns the builder for the settings used for calls to deleteSignedUrlKey. */ 298 public OperationCallSettings.Builder< 299 DeleteSignedUrlKeyBackendBucketRequest, Operation, Operation> deleteSignedUrlKeyOperationSettings()300 deleteSignedUrlKeyOperationSettings() { 301 return getStubSettingsBuilder().deleteSignedUrlKeyOperationSettings(); 302 } 303 304 /** Returns the builder for the settings used for calls to get. */ getSettings()305 public UnaryCallSettings.Builder<GetBackendBucketRequest, BackendBucket> getSettings() { 306 return getStubSettingsBuilder().getSettings(); 307 } 308 309 /** Returns the builder for the settings used for calls to insert. */ insertSettings()310 public UnaryCallSettings.Builder<InsertBackendBucketRequest, Operation> insertSettings() { 311 return getStubSettingsBuilder().insertSettings(); 312 } 313 314 /** Returns the builder for the settings used for calls to insert. */ 315 public OperationCallSettings.Builder<InsertBackendBucketRequest, Operation, Operation> insertOperationSettings()316 insertOperationSettings() { 317 return getStubSettingsBuilder().insertOperationSettings(); 318 } 319 320 /** Returns the builder for the settings used for calls to list. */ 321 public PagedCallSettings.Builder< 322 ListBackendBucketsRequest, BackendBucketList, ListPagedResponse> listSettings()323 listSettings() { 324 return getStubSettingsBuilder().listSettings(); 325 } 326 327 /** Returns the builder for the settings used for calls to patch. */ patchSettings()328 public UnaryCallSettings.Builder<PatchBackendBucketRequest, Operation> patchSettings() { 329 return getStubSettingsBuilder().patchSettings(); 330 } 331 332 /** Returns the builder for the settings used for calls to patch. */ 333 public OperationCallSettings.Builder<PatchBackendBucketRequest, Operation, Operation> patchOperationSettings()334 patchOperationSettings() { 335 return getStubSettingsBuilder().patchOperationSettings(); 336 } 337 338 /** Returns the builder for the settings used for calls to setEdgeSecurityPolicy. */ 339 public UnaryCallSettings.Builder<SetEdgeSecurityPolicyBackendBucketRequest, Operation> setEdgeSecurityPolicySettings()340 setEdgeSecurityPolicySettings() { 341 return getStubSettingsBuilder().setEdgeSecurityPolicySettings(); 342 } 343 344 /** Returns the builder for the settings used for calls to setEdgeSecurityPolicy. */ 345 public OperationCallSettings.Builder< 346 SetEdgeSecurityPolicyBackendBucketRequest, Operation, Operation> setEdgeSecurityPolicyOperationSettings()347 setEdgeSecurityPolicyOperationSettings() { 348 return getStubSettingsBuilder().setEdgeSecurityPolicyOperationSettings(); 349 } 350 351 /** Returns the builder for the settings used for calls to update. */ updateSettings()352 public UnaryCallSettings.Builder<UpdateBackendBucketRequest, Operation> updateSettings() { 353 return getStubSettingsBuilder().updateSettings(); 354 } 355 356 /** Returns the builder for the settings used for calls to update. */ 357 public OperationCallSettings.Builder<UpdateBackendBucketRequest, Operation, Operation> updateOperationSettings()358 updateOperationSettings() { 359 return getStubSettingsBuilder().updateOperationSettings(); 360 } 361 362 @Override build()363 public BackendBucketsSettings build() throws IOException { 364 return new BackendBucketsSettings(this); 365 } 366 } 367 } 368