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