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.RegionAutoscalersClient.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.RegionAutoscalersStubSettings; 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 RegionAutoscalersClient}. 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 * RegionAutoscalersSettings.Builder regionAutoscalersSettingsBuilder = 62 * RegionAutoscalersSettings.newBuilder(); 63 * regionAutoscalersSettingsBuilder 64 * .getSettings() 65 * .setRetrySettings( 66 * regionAutoscalersSettingsBuilder 67 * .getSettings() 68 * .getRetrySettings() 69 * .toBuilder() 70 * .setTotalTimeout(Duration.ofSeconds(30)) 71 * .build()); 72 * RegionAutoscalersSettings regionAutoscalersSettings = regionAutoscalersSettingsBuilder.build(); 73 * }</pre> 74 */ 75 @Generated("by gapic-generator-java") 76 public class RegionAutoscalersSettings extends ClientSettings<RegionAutoscalersSettings> { 77 78 /** Returns the object with the settings used for calls to delete. */ deleteSettings()79 public UnaryCallSettings<DeleteRegionAutoscalerRequest, Operation> deleteSettings() { 80 return ((RegionAutoscalersStubSettings) getStubSettings()).deleteSettings(); 81 } 82 83 /** Returns the object with the settings used for calls to delete. */ 84 public OperationCallSettings<DeleteRegionAutoscalerRequest, Operation, Operation> deleteOperationSettings()85 deleteOperationSettings() { 86 return ((RegionAutoscalersStubSettings) getStubSettings()).deleteOperationSettings(); 87 } 88 89 /** Returns the object with the settings used for calls to get. */ getSettings()90 public UnaryCallSettings<GetRegionAutoscalerRequest, Autoscaler> getSettings() { 91 return ((RegionAutoscalersStubSettings) getStubSettings()).getSettings(); 92 } 93 94 /** Returns the object with the settings used for calls to insert. */ insertSettings()95 public UnaryCallSettings<InsertRegionAutoscalerRequest, Operation> insertSettings() { 96 return ((RegionAutoscalersStubSettings) getStubSettings()).insertSettings(); 97 } 98 99 /** Returns the object with the settings used for calls to insert. */ 100 public OperationCallSettings<InsertRegionAutoscalerRequest, Operation, Operation> insertOperationSettings()101 insertOperationSettings() { 102 return ((RegionAutoscalersStubSettings) getStubSettings()).insertOperationSettings(); 103 } 104 105 /** Returns the object with the settings used for calls to list. */ 106 public PagedCallSettings<ListRegionAutoscalersRequest, RegionAutoscalerList, ListPagedResponse> listSettings()107 listSettings() { 108 return ((RegionAutoscalersStubSettings) getStubSettings()).listSettings(); 109 } 110 111 /** Returns the object with the settings used for calls to patch. */ patchSettings()112 public UnaryCallSettings<PatchRegionAutoscalerRequest, Operation> patchSettings() { 113 return ((RegionAutoscalersStubSettings) getStubSettings()).patchSettings(); 114 } 115 116 /** Returns the object with the settings used for calls to patch. */ 117 public OperationCallSettings<PatchRegionAutoscalerRequest, Operation, Operation> patchOperationSettings()118 patchOperationSettings() { 119 return ((RegionAutoscalersStubSettings) getStubSettings()).patchOperationSettings(); 120 } 121 122 /** Returns the object with the settings used for calls to update. */ updateSettings()123 public UnaryCallSettings<UpdateRegionAutoscalerRequest, Operation> updateSettings() { 124 return ((RegionAutoscalersStubSettings) getStubSettings()).updateSettings(); 125 } 126 127 /** Returns the object with the settings used for calls to update. */ 128 public OperationCallSettings<UpdateRegionAutoscalerRequest, Operation, Operation> updateOperationSettings()129 updateOperationSettings() { 130 return ((RegionAutoscalersStubSettings) getStubSettings()).updateOperationSettings(); 131 } 132 create(RegionAutoscalersStubSettings stub)133 public static final RegionAutoscalersSettings create(RegionAutoscalersStubSettings stub) 134 throws IOException { 135 return new RegionAutoscalersSettings.Builder(stub.toBuilder()).build(); 136 } 137 138 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()139 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 140 return RegionAutoscalersStubSettings.defaultExecutorProviderBuilder(); 141 } 142 143 /** Returns the default service endpoint. */ getDefaultEndpoint()144 public static String getDefaultEndpoint() { 145 return RegionAutoscalersStubSettings.getDefaultEndpoint(); 146 } 147 148 /** Returns the default service scopes. */ getDefaultServiceScopes()149 public static List<String> getDefaultServiceScopes() { 150 return RegionAutoscalersStubSettings.getDefaultServiceScopes(); 151 } 152 153 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()154 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 155 return RegionAutoscalersStubSettings.defaultCredentialsProviderBuilder(); 156 } 157 158 /** Returns a builder for the default ChannelProvider for this service. */ 159 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()160 defaultHttpJsonTransportProviderBuilder() { 161 return RegionAutoscalersStubSettings.defaultHttpJsonTransportProviderBuilder(); 162 } 163 defaultTransportChannelProvider()164 public static TransportChannelProvider defaultTransportChannelProvider() { 165 return RegionAutoscalersStubSettings.defaultTransportChannelProvider(); 166 } 167 168 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()169 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 170 return RegionAutoscalersStubSettings.defaultApiClientHeaderProviderBuilder(); 171 } 172 173 /** Returns a new builder for this class. */ newBuilder()174 public static Builder newBuilder() { 175 return Builder.createDefault(); 176 } 177 178 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)179 public static Builder newBuilder(ClientContext clientContext) { 180 return new Builder(clientContext); 181 } 182 183 /** Returns a builder containing all the values of this settings class. */ toBuilder()184 public Builder toBuilder() { 185 return new Builder(this); 186 } 187 RegionAutoscalersSettings(Builder settingsBuilder)188 protected RegionAutoscalersSettings(Builder settingsBuilder) throws IOException { 189 super(settingsBuilder); 190 } 191 192 /** Builder for RegionAutoscalersSettings. */ 193 public static class Builder extends ClientSettings.Builder<RegionAutoscalersSettings, Builder> { 194 Builder()195 protected Builder() throws IOException { 196 this(((ClientContext) null)); 197 } 198 Builder(ClientContext clientContext)199 protected Builder(ClientContext clientContext) { 200 super(RegionAutoscalersStubSettings.newBuilder(clientContext)); 201 } 202 Builder(RegionAutoscalersSettings settings)203 protected Builder(RegionAutoscalersSettings settings) { 204 super(settings.getStubSettings().toBuilder()); 205 } 206 Builder(RegionAutoscalersStubSettings.Builder stubSettings)207 protected Builder(RegionAutoscalersStubSettings.Builder stubSettings) { 208 super(stubSettings); 209 } 210 createDefault()211 private static Builder createDefault() { 212 return new Builder(RegionAutoscalersStubSettings.newBuilder()); 213 } 214 getStubSettingsBuilder()215 public RegionAutoscalersStubSettings.Builder getStubSettingsBuilder() { 216 return ((RegionAutoscalersStubSettings.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 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)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 delete. */ deleteSettings()232 public UnaryCallSettings.Builder<DeleteRegionAutoscalerRequest, Operation> deleteSettings() { 233 return getStubSettingsBuilder().deleteSettings(); 234 } 235 236 /** Returns the builder for the settings used for calls to delete. */ 237 public OperationCallSettings.Builder<DeleteRegionAutoscalerRequest, Operation, Operation> deleteOperationSettings()238 deleteOperationSettings() { 239 return getStubSettingsBuilder().deleteOperationSettings(); 240 } 241 242 /** Returns the builder for the settings used for calls to get. */ getSettings()243 public UnaryCallSettings.Builder<GetRegionAutoscalerRequest, Autoscaler> getSettings() { 244 return getStubSettingsBuilder().getSettings(); 245 } 246 247 /** Returns the builder for the settings used for calls to insert. */ insertSettings()248 public UnaryCallSettings.Builder<InsertRegionAutoscalerRequest, Operation> insertSettings() { 249 return getStubSettingsBuilder().insertSettings(); 250 } 251 252 /** Returns the builder for the settings used for calls to insert. */ 253 public OperationCallSettings.Builder<InsertRegionAutoscalerRequest, Operation, Operation> insertOperationSettings()254 insertOperationSettings() { 255 return getStubSettingsBuilder().insertOperationSettings(); 256 } 257 258 /** Returns the builder for the settings used for calls to list. */ 259 public PagedCallSettings.Builder< 260 ListRegionAutoscalersRequest, RegionAutoscalerList, ListPagedResponse> listSettings()261 listSettings() { 262 return getStubSettingsBuilder().listSettings(); 263 } 264 265 /** Returns the builder for the settings used for calls to patch. */ patchSettings()266 public UnaryCallSettings.Builder<PatchRegionAutoscalerRequest, Operation> patchSettings() { 267 return getStubSettingsBuilder().patchSettings(); 268 } 269 270 /** Returns the builder for the settings used for calls to patch. */ 271 public OperationCallSettings.Builder<PatchRegionAutoscalerRequest, Operation, Operation> patchOperationSettings()272 patchOperationSettings() { 273 return getStubSettingsBuilder().patchOperationSettings(); 274 } 275 276 /** Returns the builder for the settings used for calls to update. */ updateSettings()277 public UnaryCallSettings.Builder<UpdateRegionAutoscalerRequest, Operation> updateSettings() { 278 return getStubSettingsBuilder().updateSettings(); 279 } 280 281 /** Returns the builder for the settings used for calls to update. */ 282 public OperationCallSettings.Builder<UpdateRegionAutoscalerRequest, Operation, Operation> updateOperationSettings()283 updateOperationSettings() { 284 return getStubSettingsBuilder().updateOperationSettings(); 285 } 286 287 @Override build()288 public RegionAutoscalersSettings build() throws IOException { 289 return new RegionAutoscalersSettings(this); 290 } 291 } 292 } 293