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