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