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