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.SecurityPoliciesClient.AggregatedListPagedResponse; 20 import static com.google.cloud.compute.v1.SecurityPoliciesClient.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.SecurityPoliciesStubSettings; 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 SecurityPoliciesClient}. 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 * SecurityPoliciesSettings.Builder securityPoliciesSettingsBuilder = 63 * SecurityPoliciesSettings.newBuilder(); 64 * securityPoliciesSettingsBuilder 65 * .getSettings() 66 * .setRetrySettings( 67 * securityPoliciesSettingsBuilder 68 * .getSettings() 69 * .getRetrySettings() 70 * .toBuilder() 71 * .setTotalTimeout(Duration.ofSeconds(30)) 72 * .build()); 73 * SecurityPoliciesSettings securityPoliciesSettings = securityPoliciesSettingsBuilder.build(); 74 * }</pre> 75 */ 76 @Generated("by gapic-generator-java") 77 public class SecurityPoliciesSettings extends ClientSettings<SecurityPoliciesSettings> { 78 79 /** Returns the object with the settings used for calls to addRule. */ addRuleSettings()80 public UnaryCallSettings<AddRuleSecurityPolicyRequest, Operation> addRuleSettings() { 81 return ((SecurityPoliciesStubSettings) getStubSettings()).addRuleSettings(); 82 } 83 84 /** Returns the object with the settings used for calls to addRule. */ 85 public OperationCallSettings<AddRuleSecurityPolicyRequest, Operation, Operation> addRuleOperationSettings()86 addRuleOperationSettings() { 87 return ((SecurityPoliciesStubSettings) getStubSettings()).addRuleOperationSettings(); 88 } 89 90 /** Returns the object with the settings used for calls to aggregatedList. */ 91 public PagedCallSettings< 92 AggregatedListSecurityPoliciesRequest, 93 SecurityPoliciesAggregatedList, 94 AggregatedListPagedResponse> aggregatedListSettings()95 aggregatedListSettings() { 96 return ((SecurityPoliciesStubSettings) getStubSettings()).aggregatedListSettings(); 97 } 98 99 /** Returns the object with the settings used for calls to delete. */ deleteSettings()100 public UnaryCallSettings<DeleteSecurityPolicyRequest, Operation> deleteSettings() { 101 return ((SecurityPoliciesStubSettings) getStubSettings()).deleteSettings(); 102 } 103 104 /** Returns the object with the settings used for calls to delete. */ 105 public OperationCallSettings<DeleteSecurityPolicyRequest, Operation, Operation> deleteOperationSettings()106 deleteOperationSettings() { 107 return ((SecurityPoliciesStubSettings) getStubSettings()).deleteOperationSettings(); 108 } 109 110 /** Returns the object with the settings used for calls to get. */ getSettings()111 public UnaryCallSettings<GetSecurityPolicyRequest, SecurityPolicy> getSettings() { 112 return ((SecurityPoliciesStubSettings) getStubSettings()).getSettings(); 113 } 114 115 /** Returns the object with the settings used for calls to getRule. */ getRuleSettings()116 public UnaryCallSettings<GetRuleSecurityPolicyRequest, SecurityPolicyRule> getRuleSettings() { 117 return ((SecurityPoliciesStubSettings) getStubSettings()).getRuleSettings(); 118 } 119 120 /** Returns the object with the settings used for calls to insert. */ insertSettings()121 public UnaryCallSettings<InsertSecurityPolicyRequest, Operation> insertSettings() { 122 return ((SecurityPoliciesStubSettings) getStubSettings()).insertSettings(); 123 } 124 125 /** Returns the object with the settings used for calls to insert. */ 126 public OperationCallSettings<InsertSecurityPolicyRequest, Operation, Operation> insertOperationSettings()127 insertOperationSettings() { 128 return ((SecurityPoliciesStubSettings) getStubSettings()).insertOperationSettings(); 129 } 130 131 /** Returns the object with the settings used for calls to list. */ 132 public PagedCallSettings<ListSecurityPoliciesRequest, SecurityPolicyList, ListPagedResponse> listSettings()133 listSettings() { 134 return ((SecurityPoliciesStubSettings) getStubSettings()).listSettings(); 135 } 136 137 /** Returns the object with the settings used for calls to listPreconfiguredExpressionSets. */ 138 public UnaryCallSettings< 139 ListPreconfiguredExpressionSetsSecurityPoliciesRequest, 140 SecurityPoliciesListPreconfiguredExpressionSetsResponse> listPreconfiguredExpressionSetsSettings()141 listPreconfiguredExpressionSetsSettings() { 142 return ((SecurityPoliciesStubSettings) getStubSettings()) 143 .listPreconfiguredExpressionSetsSettings(); 144 } 145 146 /** Returns the object with the settings used for calls to patch. */ patchSettings()147 public UnaryCallSettings<PatchSecurityPolicyRequest, Operation> patchSettings() { 148 return ((SecurityPoliciesStubSettings) getStubSettings()).patchSettings(); 149 } 150 151 /** Returns the object with the settings used for calls to patch. */ 152 public OperationCallSettings<PatchSecurityPolicyRequest, Operation, Operation> patchOperationSettings()153 patchOperationSettings() { 154 return ((SecurityPoliciesStubSettings) getStubSettings()).patchOperationSettings(); 155 } 156 157 /** Returns the object with the settings used for calls to patchRule. */ patchRuleSettings()158 public UnaryCallSettings<PatchRuleSecurityPolicyRequest, Operation> patchRuleSettings() { 159 return ((SecurityPoliciesStubSettings) getStubSettings()).patchRuleSettings(); 160 } 161 162 /** Returns the object with the settings used for calls to patchRule. */ 163 public OperationCallSettings<PatchRuleSecurityPolicyRequest, Operation, Operation> patchRuleOperationSettings()164 patchRuleOperationSettings() { 165 return ((SecurityPoliciesStubSettings) getStubSettings()).patchRuleOperationSettings(); 166 } 167 168 /** Returns the object with the settings used for calls to removeRule. */ removeRuleSettings()169 public UnaryCallSettings<RemoveRuleSecurityPolicyRequest, Operation> removeRuleSettings() { 170 return ((SecurityPoliciesStubSettings) getStubSettings()).removeRuleSettings(); 171 } 172 173 /** Returns the object with the settings used for calls to removeRule. */ 174 public OperationCallSettings<RemoveRuleSecurityPolicyRequest, Operation, Operation> removeRuleOperationSettings()175 removeRuleOperationSettings() { 176 return ((SecurityPoliciesStubSettings) getStubSettings()).removeRuleOperationSettings(); 177 } 178 179 /** Returns the object with the settings used for calls to setLabels. */ setLabelsSettings()180 public UnaryCallSettings<SetLabelsSecurityPolicyRequest, Operation> setLabelsSettings() { 181 return ((SecurityPoliciesStubSettings) getStubSettings()).setLabelsSettings(); 182 } 183 184 /** Returns the object with the settings used for calls to setLabels. */ 185 public OperationCallSettings<SetLabelsSecurityPolicyRequest, Operation, Operation> setLabelsOperationSettings()186 setLabelsOperationSettings() { 187 return ((SecurityPoliciesStubSettings) getStubSettings()).setLabelsOperationSettings(); 188 } 189 create(SecurityPoliciesStubSettings stub)190 public static final SecurityPoliciesSettings create(SecurityPoliciesStubSettings stub) 191 throws IOException { 192 return new SecurityPoliciesSettings.Builder(stub.toBuilder()).build(); 193 } 194 195 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()196 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 197 return SecurityPoliciesStubSettings.defaultExecutorProviderBuilder(); 198 } 199 200 /** Returns the default service endpoint. */ getDefaultEndpoint()201 public static String getDefaultEndpoint() { 202 return SecurityPoliciesStubSettings.getDefaultEndpoint(); 203 } 204 205 /** Returns the default service scopes. */ getDefaultServiceScopes()206 public static List<String> getDefaultServiceScopes() { 207 return SecurityPoliciesStubSettings.getDefaultServiceScopes(); 208 } 209 210 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()211 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 212 return SecurityPoliciesStubSettings.defaultCredentialsProviderBuilder(); 213 } 214 215 /** Returns a builder for the default ChannelProvider for this service. */ 216 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()217 defaultHttpJsonTransportProviderBuilder() { 218 return SecurityPoliciesStubSettings.defaultHttpJsonTransportProviderBuilder(); 219 } 220 defaultTransportChannelProvider()221 public static TransportChannelProvider defaultTransportChannelProvider() { 222 return SecurityPoliciesStubSettings.defaultTransportChannelProvider(); 223 } 224 225 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()226 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 227 return SecurityPoliciesStubSettings.defaultApiClientHeaderProviderBuilder(); 228 } 229 230 /** Returns a new builder for this class. */ newBuilder()231 public static Builder newBuilder() { 232 return Builder.createDefault(); 233 } 234 235 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)236 public static Builder newBuilder(ClientContext clientContext) { 237 return new Builder(clientContext); 238 } 239 240 /** Returns a builder containing all the values of this settings class. */ toBuilder()241 public Builder toBuilder() { 242 return new Builder(this); 243 } 244 SecurityPoliciesSettings(Builder settingsBuilder)245 protected SecurityPoliciesSettings(Builder settingsBuilder) throws IOException { 246 super(settingsBuilder); 247 } 248 249 /** Builder for SecurityPoliciesSettings. */ 250 public static class Builder extends ClientSettings.Builder<SecurityPoliciesSettings, Builder> { 251 Builder()252 protected Builder() throws IOException { 253 this(((ClientContext) null)); 254 } 255 Builder(ClientContext clientContext)256 protected Builder(ClientContext clientContext) { 257 super(SecurityPoliciesStubSettings.newBuilder(clientContext)); 258 } 259 Builder(SecurityPoliciesSettings settings)260 protected Builder(SecurityPoliciesSettings settings) { 261 super(settings.getStubSettings().toBuilder()); 262 } 263 Builder(SecurityPoliciesStubSettings.Builder stubSettings)264 protected Builder(SecurityPoliciesStubSettings.Builder stubSettings) { 265 super(stubSettings); 266 } 267 createDefault()268 private static Builder createDefault() { 269 return new Builder(SecurityPoliciesStubSettings.newBuilder()); 270 } 271 getStubSettingsBuilder()272 public SecurityPoliciesStubSettings.Builder getStubSettingsBuilder() { 273 return ((SecurityPoliciesStubSettings.Builder) getStubSettings()); 274 } 275 276 /** 277 * Applies the given settings updater function to all of the unary API methods in this service. 278 * 279 * <p>Note: This method does not support applying settings to streaming methods. 280 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)281 public Builder applyToAllUnaryMethods( 282 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 283 super.applyToAllUnaryMethods( 284 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 285 return this; 286 } 287 288 /** Returns the builder for the settings used for calls to addRule. */ addRuleSettings()289 public UnaryCallSettings.Builder<AddRuleSecurityPolicyRequest, Operation> addRuleSettings() { 290 return getStubSettingsBuilder().addRuleSettings(); 291 } 292 293 /** Returns the builder for the settings used for calls to addRule. */ 294 public OperationCallSettings.Builder<AddRuleSecurityPolicyRequest, Operation, Operation> addRuleOperationSettings()295 addRuleOperationSettings() { 296 return getStubSettingsBuilder().addRuleOperationSettings(); 297 } 298 299 /** Returns the builder for the settings used for calls to aggregatedList. */ 300 public PagedCallSettings.Builder< 301 AggregatedListSecurityPoliciesRequest, 302 SecurityPoliciesAggregatedList, 303 AggregatedListPagedResponse> aggregatedListSettings()304 aggregatedListSettings() { 305 return getStubSettingsBuilder().aggregatedListSettings(); 306 } 307 308 /** Returns the builder for the settings used for calls to delete. */ deleteSettings()309 public UnaryCallSettings.Builder<DeleteSecurityPolicyRequest, Operation> deleteSettings() { 310 return getStubSettingsBuilder().deleteSettings(); 311 } 312 313 /** Returns the builder for the settings used for calls to delete. */ 314 public OperationCallSettings.Builder<DeleteSecurityPolicyRequest, Operation, Operation> deleteOperationSettings()315 deleteOperationSettings() { 316 return getStubSettingsBuilder().deleteOperationSettings(); 317 } 318 319 /** Returns the builder for the settings used for calls to get. */ getSettings()320 public UnaryCallSettings.Builder<GetSecurityPolicyRequest, SecurityPolicy> getSettings() { 321 return getStubSettingsBuilder().getSettings(); 322 } 323 324 /** Returns the builder for the settings used for calls to getRule. */ 325 public UnaryCallSettings.Builder<GetRuleSecurityPolicyRequest, SecurityPolicyRule> getRuleSettings()326 getRuleSettings() { 327 return getStubSettingsBuilder().getRuleSettings(); 328 } 329 330 /** Returns the builder for the settings used for calls to insert. */ insertSettings()331 public UnaryCallSettings.Builder<InsertSecurityPolicyRequest, Operation> insertSettings() { 332 return getStubSettingsBuilder().insertSettings(); 333 } 334 335 /** Returns the builder for the settings used for calls to insert. */ 336 public OperationCallSettings.Builder<InsertSecurityPolicyRequest, Operation, Operation> insertOperationSettings()337 insertOperationSettings() { 338 return getStubSettingsBuilder().insertOperationSettings(); 339 } 340 341 /** Returns the builder for the settings used for calls to list. */ 342 public PagedCallSettings.Builder< 343 ListSecurityPoliciesRequest, SecurityPolicyList, ListPagedResponse> listSettings()344 listSettings() { 345 return getStubSettingsBuilder().listSettings(); 346 } 347 348 /** Returns the builder for the settings used for calls to listPreconfiguredExpressionSets. */ 349 public UnaryCallSettings.Builder< 350 ListPreconfiguredExpressionSetsSecurityPoliciesRequest, 351 SecurityPoliciesListPreconfiguredExpressionSetsResponse> listPreconfiguredExpressionSetsSettings()352 listPreconfiguredExpressionSetsSettings() { 353 return getStubSettingsBuilder().listPreconfiguredExpressionSetsSettings(); 354 } 355 356 /** Returns the builder for the settings used for calls to patch. */ patchSettings()357 public UnaryCallSettings.Builder<PatchSecurityPolicyRequest, Operation> patchSettings() { 358 return getStubSettingsBuilder().patchSettings(); 359 } 360 361 /** Returns the builder for the settings used for calls to patch. */ 362 public OperationCallSettings.Builder<PatchSecurityPolicyRequest, Operation, Operation> patchOperationSettings()363 patchOperationSettings() { 364 return getStubSettingsBuilder().patchOperationSettings(); 365 } 366 367 /** Returns the builder for the settings used for calls to patchRule. */ 368 public UnaryCallSettings.Builder<PatchRuleSecurityPolicyRequest, Operation> patchRuleSettings()369 patchRuleSettings() { 370 return getStubSettingsBuilder().patchRuleSettings(); 371 } 372 373 /** Returns the builder for the settings used for calls to patchRule. */ 374 public OperationCallSettings.Builder<PatchRuleSecurityPolicyRequest, Operation, Operation> patchRuleOperationSettings()375 patchRuleOperationSettings() { 376 return getStubSettingsBuilder().patchRuleOperationSettings(); 377 } 378 379 /** Returns the builder for the settings used for calls to removeRule. */ 380 public UnaryCallSettings.Builder<RemoveRuleSecurityPolicyRequest, Operation> removeRuleSettings()381 removeRuleSettings() { 382 return getStubSettingsBuilder().removeRuleSettings(); 383 } 384 385 /** Returns the builder for the settings used for calls to removeRule. */ 386 public OperationCallSettings.Builder<RemoveRuleSecurityPolicyRequest, Operation, Operation> removeRuleOperationSettings()387 removeRuleOperationSettings() { 388 return getStubSettingsBuilder().removeRuleOperationSettings(); 389 } 390 391 /** Returns the builder for the settings used for calls to setLabels. */ 392 public UnaryCallSettings.Builder<SetLabelsSecurityPolicyRequest, Operation> setLabelsSettings()393 setLabelsSettings() { 394 return getStubSettingsBuilder().setLabelsSettings(); 395 } 396 397 /** Returns the builder for the settings used for calls to setLabels. */ 398 public OperationCallSettings.Builder<SetLabelsSecurityPolicyRequest, Operation, Operation> setLabelsOperationSettings()399 setLabelsOperationSettings() { 400 return getStubSettingsBuilder().setLabelsOperationSettings(); 401 } 402 403 @Override build()404 public SecurityPoliciesSettings build() throws IOException { 405 return new SecurityPoliciesSettings(this); 406 } 407 } 408 } 409