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.AddressesClient.AggregatedListPagedResponse; 20 import static com.google.cloud.compute.v1.AddressesClient.ListPagedResponse; 21 22 import com.google.api.core.ApiFunction; 23 import com.google.api.core.BetaApi; 24 import com.google.api.gax.core.GoogleCredentialsProvider; 25 import com.google.api.gax.core.InstantiatingExecutorProvider; 26 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; 27 import com.google.api.gax.rpc.ApiClientHeaderProvider; 28 import com.google.api.gax.rpc.ClientContext; 29 import com.google.api.gax.rpc.ClientSettings; 30 import com.google.api.gax.rpc.OperationCallSettings; 31 import com.google.api.gax.rpc.PagedCallSettings; 32 import com.google.api.gax.rpc.TransportChannelProvider; 33 import com.google.api.gax.rpc.UnaryCallSettings; 34 import com.google.cloud.compute.v1.stub.AddressesStubSettings; 35 import java.io.IOException; 36 import java.util.List; 37 import javax.annotation.Generated; 38 39 // AUTO-GENERATED DOCUMENTATION AND CLASS. 40 /** 41 * Settings class to configure an instance of {@link AddressesClient}. 42 * 43 * <p>The default instance has everything set to sensible defaults: 44 * 45 * <ul> 46 * <li>The default service address (compute.googleapis.com) and default port (443) are used. 47 * <li>Credentials are acquired automatically through Application Default Credentials. 48 * <li>Retries are configured for idempotent methods but not for non-idempotent methods. 49 * </ul> 50 * 51 * <p>The builder of this class is recursive, so contained classes are themselves builders. When 52 * build() is called, the tree of builders is called to create the complete settings object. 53 * 54 * <p>For example, to set the total timeout of get to 30 seconds: 55 * 56 * <pre>{@code 57 * // This snippet has been automatically generated and should be regarded as a code template only. 58 * // It will require modifications to work: 59 * // - It may require correct/in-range values for request initialization. 60 * // - It may require specifying regional endpoints when creating the service client as shown in 61 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 62 * AddressesSettings.Builder addressesSettingsBuilder = AddressesSettings.newBuilder(); 63 * addressesSettingsBuilder 64 * .getSettings() 65 * .setRetrySettings( 66 * addressesSettingsBuilder 67 * .getSettings() 68 * .getRetrySettings() 69 * .toBuilder() 70 * .setTotalTimeout(Duration.ofSeconds(30)) 71 * .build()); 72 * AddressesSettings addressesSettings = addressesSettingsBuilder.build(); 73 * }</pre> 74 */ 75 @Generated("by gapic-generator-java") 76 public class AddressesSettings extends ClientSettings<AddressesSettings> { 77 78 /** Returns the object with the settings used for calls to aggregatedList. */ 79 public PagedCallSettings< 80 AggregatedListAddressesRequest, AddressAggregatedList, AggregatedListPagedResponse> aggregatedListSettings()81 aggregatedListSettings() { 82 return ((AddressesStubSettings) getStubSettings()).aggregatedListSettings(); 83 } 84 85 /** Returns the object with the settings used for calls to delete. */ deleteSettings()86 public UnaryCallSettings<DeleteAddressRequest, Operation> deleteSettings() { 87 return ((AddressesStubSettings) getStubSettings()).deleteSettings(); 88 } 89 90 /** Returns the object with the settings used for calls to delete. */ 91 public OperationCallSettings<DeleteAddressRequest, Operation, Operation> deleteOperationSettings()92 deleteOperationSettings() { 93 return ((AddressesStubSettings) getStubSettings()).deleteOperationSettings(); 94 } 95 96 /** Returns the object with the settings used for calls to get. */ getSettings()97 public UnaryCallSettings<GetAddressRequest, Address> getSettings() { 98 return ((AddressesStubSettings) getStubSettings()).getSettings(); 99 } 100 101 /** Returns the object with the settings used for calls to insert. */ insertSettings()102 public UnaryCallSettings<InsertAddressRequest, Operation> insertSettings() { 103 return ((AddressesStubSettings) getStubSettings()).insertSettings(); 104 } 105 106 /** Returns the object with the settings used for calls to insert. */ 107 public OperationCallSettings<InsertAddressRequest, Operation, Operation> insertOperationSettings()108 insertOperationSettings() { 109 return ((AddressesStubSettings) getStubSettings()).insertOperationSettings(); 110 } 111 112 /** Returns the object with the settings used for calls to list. */ listSettings()113 public PagedCallSettings<ListAddressesRequest, AddressList, ListPagedResponse> listSettings() { 114 return ((AddressesStubSettings) getStubSettings()).listSettings(); 115 } 116 117 /** Returns the object with the settings used for calls to setLabels. */ setLabelsSettings()118 public UnaryCallSettings<SetLabelsAddressRequest, Operation> setLabelsSettings() { 119 return ((AddressesStubSettings) getStubSettings()).setLabelsSettings(); 120 } 121 122 /** Returns the object with the settings used for calls to setLabels. */ 123 public OperationCallSettings<SetLabelsAddressRequest, Operation, Operation> setLabelsOperationSettings()124 setLabelsOperationSettings() { 125 return ((AddressesStubSettings) getStubSettings()).setLabelsOperationSettings(); 126 } 127 create(AddressesStubSettings stub)128 public static final AddressesSettings create(AddressesStubSettings stub) throws IOException { 129 return new AddressesSettings.Builder(stub.toBuilder()).build(); 130 } 131 132 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()133 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 134 return AddressesStubSettings.defaultExecutorProviderBuilder(); 135 } 136 137 /** Returns the default service endpoint. */ getDefaultEndpoint()138 public static String getDefaultEndpoint() { 139 return AddressesStubSettings.getDefaultEndpoint(); 140 } 141 142 /** Returns the default service scopes. */ getDefaultServiceScopes()143 public static List<String> getDefaultServiceScopes() { 144 return AddressesStubSettings.getDefaultServiceScopes(); 145 } 146 147 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()148 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 149 return AddressesStubSettings.defaultCredentialsProviderBuilder(); 150 } 151 152 /** Returns a builder for the default ChannelProvider for this service. */ 153 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()154 defaultHttpJsonTransportProviderBuilder() { 155 return AddressesStubSettings.defaultHttpJsonTransportProviderBuilder(); 156 } 157 defaultTransportChannelProvider()158 public static TransportChannelProvider defaultTransportChannelProvider() { 159 return AddressesStubSettings.defaultTransportChannelProvider(); 160 } 161 162 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()163 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 164 return AddressesStubSettings.defaultApiClientHeaderProviderBuilder(); 165 } 166 167 /** Returns a new builder for this class. */ newBuilder()168 public static Builder newBuilder() { 169 return Builder.createDefault(); 170 } 171 172 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)173 public static Builder newBuilder(ClientContext clientContext) { 174 return new Builder(clientContext); 175 } 176 177 /** Returns a builder containing all the values of this settings class. */ toBuilder()178 public Builder toBuilder() { 179 return new Builder(this); 180 } 181 AddressesSettings(Builder settingsBuilder)182 protected AddressesSettings(Builder settingsBuilder) throws IOException { 183 super(settingsBuilder); 184 } 185 186 /** Builder for AddressesSettings. */ 187 public static class Builder extends ClientSettings.Builder<AddressesSettings, Builder> { 188 Builder()189 protected Builder() throws IOException { 190 this(((ClientContext) null)); 191 } 192 Builder(ClientContext clientContext)193 protected Builder(ClientContext clientContext) { 194 super(AddressesStubSettings.newBuilder(clientContext)); 195 } 196 Builder(AddressesSettings settings)197 protected Builder(AddressesSettings settings) { 198 super(settings.getStubSettings().toBuilder()); 199 } 200 Builder(AddressesStubSettings.Builder stubSettings)201 protected Builder(AddressesStubSettings.Builder stubSettings) { 202 super(stubSettings); 203 } 204 createDefault()205 private static Builder createDefault() { 206 return new Builder(AddressesStubSettings.newBuilder()); 207 } 208 getStubSettingsBuilder()209 public AddressesStubSettings.Builder getStubSettingsBuilder() { 210 return ((AddressesStubSettings.Builder) getStubSettings()); 211 } 212 213 /** 214 * Applies the given settings updater function to all of the unary API methods in this service. 215 * 216 * <p>Note: This method does not support applying settings to streaming methods. 217 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)218 public Builder applyToAllUnaryMethods( 219 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 220 super.applyToAllUnaryMethods( 221 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 222 return this; 223 } 224 225 /** Returns the builder for the settings used for calls to aggregatedList. */ 226 public PagedCallSettings.Builder< 227 AggregatedListAddressesRequest, AddressAggregatedList, AggregatedListPagedResponse> aggregatedListSettings()228 aggregatedListSettings() { 229 return getStubSettingsBuilder().aggregatedListSettings(); 230 } 231 232 /** Returns the builder for the settings used for calls to delete. */ deleteSettings()233 public UnaryCallSettings.Builder<DeleteAddressRequest, Operation> deleteSettings() { 234 return getStubSettingsBuilder().deleteSettings(); 235 } 236 237 /** Returns the builder for the settings used for calls to delete. */ 238 public OperationCallSettings.Builder<DeleteAddressRequest, 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<GetAddressRequest, Address> getSettings() { 245 return getStubSettingsBuilder().getSettings(); 246 } 247 248 /** Returns the builder for the settings used for calls to insert. */ insertSettings()249 public UnaryCallSettings.Builder<InsertAddressRequest, Operation> insertSettings() { 250 return getStubSettingsBuilder().insertSettings(); 251 } 252 253 /** Returns the builder for the settings used for calls to insert. */ 254 public OperationCallSettings.Builder<InsertAddressRequest, 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<ListAddressesRequest, AddressList, ListPagedResponse> listSettings()261 listSettings() { 262 return getStubSettingsBuilder().listSettings(); 263 } 264 265 /** Returns the builder for the settings used for calls to setLabels. */ setLabelsSettings()266 public UnaryCallSettings.Builder<SetLabelsAddressRequest, Operation> setLabelsSettings() { 267 return getStubSettingsBuilder().setLabelsSettings(); 268 } 269 270 /** Returns the builder for the settings used for calls to setLabels. */ 271 public OperationCallSettings.Builder<SetLabelsAddressRequest, Operation, Operation> setLabelsOperationSettings()272 setLabelsOperationSettings() { 273 return getStubSettingsBuilder().setLabelsOperationSettings(); 274 } 275 276 @Override build()277 public AddressesSettings build() throws IOException { 278 return new AddressesSettings(this); 279 } 280 } 281 } 282