|
| 1 | +/* |
| 2 | + * Copyright 2025 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.cloudsecuritycompliance.v1; |
| 18 | + |
| 19 | +import static com.google.cloud.cloudsecuritycompliance.v1.AuditClient.ListFrameworkAuditsPagedResponse; |
| 20 | +import static com.google.cloud.cloudsecuritycompliance.v1.AuditClient.ListLocationsPagedResponse; |
| 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.grpc.InstantiatingGrpcChannelProvider; |
| 27 | +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; |
| 28 | +import com.google.api.gax.rpc.ApiClientHeaderProvider; |
| 29 | +import com.google.api.gax.rpc.ClientContext; |
| 30 | +import com.google.api.gax.rpc.ClientSettings; |
| 31 | +import com.google.api.gax.rpc.OperationCallSettings; |
| 32 | +import com.google.api.gax.rpc.PagedCallSettings; |
| 33 | +import com.google.api.gax.rpc.TransportChannelProvider; |
| 34 | +import com.google.api.gax.rpc.UnaryCallSettings; |
| 35 | +import com.google.cloud.cloudsecuritycompliance.v1.stub.AuditStubSettings; |
| 36 | +import com.google.cloud.location.GetLocationRequest; |
| 37 | +import com.google.cloud.location.ListLocationsRequest; |
| 38 | +import com.google.cloud.location.ListLocationsResponse; |
| 39 | +import com.google.cloud.location.Location; |
| 40 | +import com.google.longrunning.Operation; |
| 41 | +import java.io.IOException; |
| 42 | +import java.util.List; |
| 43 | +import javax.annotation.Generated; |
| 44 | + |
| 45 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 46 | +/** |
| 47 | + * Settings class to configure an instance of {@link AuditClient}. |
| 48 | + * |
| 49 | + * <p>The default instance has everything set to sensible defaults: |
| 50 | + * |
| 51 | + * <ul> |
| 52 | + * <li>The default service address (cloudsecuritycompliance.googleapis.com) and default port (443) |
| 53 | + * are used. |
| 54 | + * <li>Credentials are acquired automatically through Application Default Credentials. |
| 55 | + * <li>Retries are configured for idempotent methods but not for non-idempotent methods. |
| 56 | + * </ul> |
| 57 | + * |
| 58 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 59 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 60 | + * |
| 61 | + * <p>For example, to set the |
| 62 | + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) |
| 63 | + * of generateFrameworkAuditScopeReport: |
| 64 | + * |
| 65 | + * <pre>{@code |
| 66 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 67 | + * // It will require modifications to work: |
| 68 | + * // - It may require correct/in-range values for request initialization. |
| 69 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 70 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 71 | + * AuditSettings.Builder auditSettingsBuilder = AuditSettings.newBuilder(); |
| 72 | + * auditSettingsBuilder |
| 73 | + * .generateFrameworkAuditScopeReportSettings() |
| 74 | + * .setRetrySettings( |
| 75 | + * auditSettingsBuilder |
| 76 | + * .generateFrameworkAuditScopeReportSettings() |
| 77 | + * .getRetrySettings() |
| 78 | + * .toBuilder() |
| 79 | + * .setInitialRetryDelayDuration(Duration.ofSeconds(1)) |
| 80 | + * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5)) |
| 81 | + * .setMaxAttempts(5) |
| 82 | + * .setMaxRetryDelayDuration(Duration.ofSeconds(30)) |
| 83 | + * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60)) |
| 84 | + * .setRetryDelayMultiplier(1.3) |
| 85 | + * .setRpcTimeoutMultiplier(1.5) |
| 86 | + * .setTotalTimeoutDuration(Duration.ofSeconds(300)) |
| 87 | + * .build()); |
| 88 | + * AuditSettings auditSettings = auditSettingsBuilder.build(); |
| 89 | + * }</pre> |
| 90 | + * |
| 91 | + * Please refer to the [Client Side Retry |
| 92 | + * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for |
| 93 | + * additional support in setting retries. |
| 94 | + * |
| 95 | + * <p>To configure the RetrySettings of a Long Running Operation method, create an |
| 96 | + * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to |
| 97 | + * configure the RetrySettings for createFrameworkAudit: |
| 98 | + * |
| 99 | + * <pre>{@code |
| 100 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 101 | + * // It will require modifications to work: |
| 102 | + * // - It may require correct/in-range values for request initialization. |
| 103 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 104 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 105 | + * AuditSettings.Builder auditSettingsBuilder = AuditSettings.newBuilder(); |
| 106 | + * TimedRetryAlgorithm timedRetryAlgorithm = |
| 107 | + * OperationalTimedPollAlgorithm.create( |
| 108 | + * RetrySettings.newBuilder() |
| 109 | + * .setInitialRetryDelayDuration(Duration.ofMillis(500)) |
| 110 | + * .setRetryDelayMultiplier(1.5) |
| 111 | + * .setMaxRetryDelayDuration(Duration.ofMillis(5000)) |
| 112 | + * .setTotalTimeoutDuration(Duration.ofHours(24)) |
| 113 | + * .build()); |
| 114 | + * auditSettingsBuilder |
| 115 | + * .createClusterOperationSettings() |
| 116 | + * .setPollingAlgorithm(timedRetryAlgorithm) |
| 117 | + * .build(); |
| 118 | + * }</pre> |
| 119 | + */ |
| 120 | +@Generated("by gapic-generator-java") |
| 121 | +public class AuditSettings extends ClientSettings<AuditSettings> { |
| 122 | + |
| 123 | + /** Returns the object with the settings used for calls to generateFrameworkAuditScopeReport. */ |
| 124 | + public UnaryCallSettings< |
| 125 | + GenerateFrameworkAuditScopeReportRequest, GenerateFrameworkAuditScopeReportResponse> |
| 126 | + generateFrameworkAuditScopeReportSettings() { |
| 127 | + return ((AuditStubSettings) getStubSettings()).generateFrameworkAuditScopeReportSettings(); |
| 128 | + } |
| 129 | + |
| 130 | + /** Returns the object with the settings used for calls to createFrameworkAudit. */ |
| 131 | + public UnaryCallSettings<CreateFrameworkAuditRequest, Operation> createFrameworkAuditSettings() { |
| 132 | + return ((AuditStubSettings) getStubSettings()).createFrameworkAuditSettings(); |
| 133 | + } |
| 134 | + |
| 135 | + /** Returns the object with the settings used for calls to createFrameworkAudit. */ |
| 136 | + public OperationCallSettings<CreateFrameworkAuditRequest, FrameworkAudit, OperationMetadata> |
| 137 | + createFrameworkAuditOperationSettings() { |
| 138 | + return ((AuditStubSettings) getStubSettings()).createFrameworkAuditOperationSettings(); |
| 139 | + } |
| 140 | + |
| 141 | + /** Returns the object with the settings used for calls to listFrameworkAudits. */ |
| 142 | + public PagedCallSettings< |
| 143 | + ListFrameworkAuditsRequest, ListFrameworkAuditsResponse, ListFrameworkAuditsPagedResponse> |
| 144 | + listFrameworkAuditsSettings() { |
| 145 | + return ((AuditStubSettings) getStubSettings()).listFrameworkAuditsSettings(); |
| 146 | + } |
| 147 | + |
| 148 | + /** Returns the object with the settings used for calls to getFrameworkAudit. */ |
| 149 | + public UnaryCallSettings<GetFrameworkAuditRequest, FrameworkAudit> getFrameworkAuditSettings() { |
| 150 | + return ((AuditStubSettings) getStubSettings()).getFrameworkAuditSettings(); |
| 151 | + } |
| 152 | + |
| 153 | + /** Returns the object with the settings used for calls to listLocations. */ |
| 154 | + public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> |
| 155 | + listLocationsSettings() { |
| 156 | + return ((AuditStubSettings) getStubSettings()).listLocationsSettings(); |
| 157 | + } |
| 158 | + |
| 159 | + /** Returns the object with the settings used for calls to getLocation. */ |
| 160 | + public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() { |
| 161 | + return ((AuditStubSettings) getStubSettings()).getLocationSettings(); |
| 162 | + } |
| 163 | + |
| 164 | + public static final AuditSettings create(AuditStubSettings stub) throws IOException { |
| 165 | + return new AuditSettings.Builder(stub.toBuilder()).build(); |
| 166 | + } |
| 167 | + |
| 168 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 169 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 170 | + return AuditStubSettings.defaultExecutorProviderBuilder(); |
| 171 | + } |
| 172 | + |
| 173 | + /** Returns the default service endpoint. */ |
| 174 | + public static String getDefaultEndpoint() { |
| 175 | + return AuditStubSettings.getDefaultEndpoint(); |
| 176 | + } |
| 177 | + |
| 178 | + /** Returns the default service scopes. */ |
| 179 | + public static List<String> getDefaultServiceScopes() { |
| 180 | + return AuditStubSettings.getDefaultServiceScopes(); |
| 181 | + } |
| 182 | + |
| 183 | + /** Returns a builder for the default credentials for this service. */ |
| 184 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 185 | + return AuditStubSettings.defaultCredentialsProviderBuilder(); |
| 186 | + } |
| 187 | + |
| 188 | + /** Returns a builder for the default gRPC ChannelProvider for this service. */ |
| 189 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 190 | + return AuditStubSettings.defaultGrpcTransportProviderBuilder(); |
| 191 | + } |
| 192 | + |
| 193 | + /** Returns a builder for the default REST ChannelProvider for this service. */ |
| 194 | + @BetaApi |
| 195 | + public static InstantiatingHttpJsonChannelProvider.Builder |
| 196 | + defaultHttpJsonTransportProviderBuilder() { |
| 197 | + return AuditStubSettings.defaultHttpJsonTransportProviderBuilder(); |
| 198 | + } |
| 199 | + |
| 200 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 201 | + return AuditStubSettings.defaultTransportChannelProvider(); |
| 202 | + } |
| 203 | + |
| 204 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 205 | + return AuditStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 206 | + } |
| 207 | + |
| 208 | + /** Returns a new gRPC builder for this class. */ |
| 209 | + public static Builder newBuilder() { |
| 210 | + return Builder.createDefault(); |
| 211 | + } |
| 212 | + |
| 213 | + /** Returns a new REST builder for this class. */ |
| 214 | + public static Builder newHttpJsonBuilder() { |
| 215 | + return Builder.createHttpJsonDefault(); |
| 216 | + } |
| 217 | + |
| 218 | + /** Returns a new builder for this class. */ |
| 219 | + public static Builder newBuilder(ClientContext clientContext) { |
| 220 | + return new Builder(clientContext); |
| 221 | + } |
| 222 | + |
| 223 | + /** Returns a builder containing all the values of this settings class. */ |
| 224 | + public Builder toBuilder() { |
| 225 | + return new Builder(this); |
| 226 | + } |
| 227 | + |
| 228 | + protected AuditSettings(Builder settingsBuilder) throws IOException { |
| 229 | + super(settingsBuilder); |
| 230 | + } |
| 231 | + |
| 232 | + /** Builder for AuditSettings. */ |
| 233 | + public static class Builder extends ClientSettings.Builder<AuditSettings, Builder> { |
| 234 | + |
| 235 | + protected Builder() throws IOException { |
| 236 | + this(((ClientContext) null)); |
| 237 | + } |
| 238 | + |
| 239 | + protected Builder(ClientContext clientContext) { |
| 240 | + super(AuditStubSettings.newBuilder(clientContext)); |
| 241 | + } |
| 242 | + |
| 243 | + protected Builder(AuditSettings settings) { |
| 244 | + super(settings.getStubSettings().toBuilder()); |
| 245 | + } |
| 246 | + |
| 247 | + protected Builder(AuditStubSettings.Builder stubSettings) { |
| 248 | + super(stubSettings); |
| 249 | + } |
| 250 | + |
| 251 | + private static Builder createDefault() { |
| 252 | + return new Builder(AuditStubSettings.newBuilder()); |
| 253 | + } |
| 254 | + |
| 255 | + private static Builder createHttpJsonDefault() { |
| 256 | + return new Builder(AuditStubSettings.newHttpJsonBuilder()); |
| 257 | + } |
| 258 | + |
| 259 | + public AuditStubSettings.Builder getStubSettingsBuilder() { |
| 260 | + return ((AuditStubSettings.Builder) getStubSettings()); |
| 261 | + } |
| 262 | + |
| 263 | + /** |
| 264 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 265 | + * |
| 266 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 267 | + */ |
| 268 | + public Builder applyToAllUnaryMethods( |
| 269 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 270 | + super.applyToAllUnaryMethods( |
| 271 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 272 | + return this; |
| 273 | + } |
| 274 | + |
| 275 | + /** Returns the builder for the settings used for calls to generateFrameworkAuditScopeReport. */ |
| 276 | + public UnaryCallSettings.Builder< |
| 277 | + GenerateFrameworkAuditScopeReportRequest, GenerateFrameworkAuditScopeReportResponse> |
| 278 | + generateFrameworkAuditScopeReportSettings() { |
| 279 | + return getStubSettingsBuilder().generateFrameworkAuditScopeReportSettings(); |
| 280 | + } |
| 281 | + |
| 282 | + /** Returns the builder for the settings used for calls to createFrameworkAudit. */ |
| 283 | + public UnaryCallSettings.Builder<CreateFrameworkAuditRequest, Operation> |
| 284 | + createFrameworkAuditSettings() { |
| 285 | + return getStubSettingsBuilder().createFrameworkAuditSettings(); |
| 286 | + } |
| 287 | + |
| 288 | + /** Returns the builder for the settings used for calls to createFrameworkAudit. */ |
| 289 | + public OperationCallSettings.Builder< |
| 290 | + CreateFrameworkAuditRequest, FrameworkAudit, OperationMetadata> |
| 291 | + createFrameworkAuditOperationSettings() { |
| 292 | + return getStubSettingsBuilder().createFrameworkAuditOperationSettings(); |
| 293 | + } |
| 294 | + |
| 295 | + /** Returns the builder for the settings used for calls to listFrameworkAudits. */ |
| 296 | + public PagedCallSettings.Builder< |
| 297 | + ListFrameworkAuditsRequest, |
| 298 | + ListFrameworkAuditsResponse, |
| 299 | + ListFrameworkAuditsPagedResponse> |
| 300 | + listFrameworkAuditsSettings() { |
| 301 | + return getStubSettingsBuilder().listFrameworkAuditsSettings(); |
| 302 | + } |
| 303 | + |
| 304 | + /** Returns the builder for the settings used for calls to getFrameworkAudit. */ |
| 305 | + public UnaryCallSettings.Builder<GetFrameworkAuditRequest, FrameworkAudit> |
| 306 | + getFrameworkAuditSettings() { |
| 307 | + return getStubSettingsBuilder().getFrameworkAuditSettings(); |
| 308 | + } |
| 309 | + |
| 310 | + /** Returns the builder for the settings used for calls to listLocations. */ |
| 311 | + public PagedCallSettings.Builder< |
| 312 | + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> |
| 313 | + listLocationsSettings() { |
| 314 | + return getStubSettingsBuilder().listLocationsSettings(); |
| 315 | + } |
| 316 | + |
| 317 | + /** Returns the builder for the settings used for calls to getLocation. */ |
| 318 | + public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() { |
| 319 | + return getStubSettingsBuilder().getLocationSettings(); |
| 320 | + } |
| 321 | + |
| 322 | + @Override |
| 323 | + public AuditSettings build() throws IOException { |
| 324 | + return new AuditSettings(this); |
| 325 | + } |
| 326 | + } |
| 327 | +} |
0 commit comments