|
| 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.bigquery.datapolicies.v2beta1; |
| 18 | + |
| 19 | +import static com.google.cloud.bigquery.datapolicies.v2beta1.DataPolicyServiceClient.ListDataPoliciesPagedResponse; |
| 20 | + |
| 21 | +import com.google.api.core.ApiFunction; |
| 22 | +import com.google.api.core.BetaApi; |
| 23 | +import com.google.api.gax.core.GoogleCredentialsProvider; |
| 24 | +import com.google.api.gax.core.InstantiatingExecutorProvider; |
| 25 | +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; |
| 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.PagedCallSettings; |
| 31 | +import com.google.api.gax.rpc.TransportChannelProvider; |
| 32 | +import com.google.api.gax.rpc.UnaryCallSettings; |
| 33 | +import com.google.cloud.bigquery.datapolicies.v2beta1.stub.DataPolicyServiceStubSettings; |
| 34 | +import com.google.iam.v1.GetIamPolicyRequest; |
| 35 | +import com.google.iam.v1.Policy; |
| 36 | +import com.google.iam.v1.SetIamPolicyRequest; |
| 37 | +import com.google.iam.v1.TestIamPermissionsRequest; |
| 38 | +import com.google.iam.v1.TestIamPermissionsResponse; |
| 39 | +import com.google.protobuf.Empty; |
| 40 | +import java.io.IOException; |
| 41 | +import java.util.List; |
| 42 | +import javax.annotation.Generated; |
| 43 | + |
| 44 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 45 | +/** |
| 46 | + * Settings class to configure an instance of {@link DataPolicyServiceClient}. |
| 47 | + * |
| 48 | + * <p>The default instance has everything set to sensible defaults: |
| 49 | + * |
| 50 | + * <ul> |
| 51 | + * <li>The default service address (bigquerydatapolicy.googleapis.com) and default port (443) are |
| 52 | + * used. |
| 53 | + * <li>Credentials are acquired automatically through Application Default Credentials. |
| 54 | + * <li>Retries are configured for idempotent methods but not for non-idempotent methods. |
| 55 | + * </ul> |
| 56 | + * |
| 57 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 58 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 59 | + * |
| 60 | + * <p>For example, to set the |
| 61 | + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) |
| 62 | + * of createDataPolicy: |
| 63 | + * |
| 64 | + * <pre>{@code |
| 65 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 66 | + * // It will require modifications to work: |
| 67 | + * // - It may require correct/in-range values for request initialization. |
| 68 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 69 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 70 | + * DataPolicyServiceSettings.Builder dataPolicyServiceSettingsBuilder = |
| 71 | + * DataPolicyServiceSettings.newBuilder(); |
| 72 | + * dataPolicyServiceSettingsBuilder |
| 73 | + * .createDataPolicySettings() |
| 74 | + * .setRetrySettings( |
| 75 | + * dataPolicyServiceSettingsBuilder |
| 76 | + * .createDataPolicySettings() |
| 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 | + * DataPolicyServiceSettings dataPolicyServiceSettings = dataPolicyServiceSettingsBuilder.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 | +@BetaApi |
| 96 | +@Generated("by gapic-generator-java") |
| 97 | +public class DataPolicyServiceSettings extends ClientSettings<DataPolicyServiceSettings> { |
| 98 | + |
| 99 | + /** Returns the object with the settings used for calls to createDataPolicy. */ |
| 100 | + public UnaryCallSettings<CreateDataPolicyRequest, DataPolicy> createDataPolicySettings() { |
| 101 | + return ((DataPolicyServiceStubSettings) getStubSettings()).createDataPolicySettings(); |
| 102 | + } |
| 103 | + |
| 104 | + /** Returns the object with the settings used for calls to addGrantees. */ |
| 105 | + public UnaryCallSettings<AddGranteesRequest, DataPolicy> addGranteesSettings() { |
| 106 | + return ((DataPolicyServiceStubSettings) getStubSettings()).addGranteesSettings(); |
| 107 | + } |
| 108 | + |
| 109 | + /** Returns the object with the settings used for calls to removeGrantees. */ |
| 110 | + public UnaryCallSettings<RemoveGranteesRequest, DataPolicy> removeGranteesSettings() { |
| 111 | + return ((DataPolicyServiceStubSettings) getStubSettings()).removeGranteesSettings(); |
| 112 | + } |
| 113 | + |
| 114 | + /** Returns the object with the settings used for calls to updateDataPolicy. */ |
| 115 | + public UnaryCallSettings<UpdateDataPolicyRequest, DataPolicy> updateDataPolicySettings() { |
| 116 | + return ((DataPolicyServiceStubSettings) getStubSettings()).updateDataPolicySettings(); |
| 117 | + } |
| 118 | + |
| 119 | + /** Returns the object with the settings used for calls to deleteDataPolicy. */ |
| 120 | + public UnaryCallSettings<DeleteDataPolicyRequest, Empty> deleteDataPolicySettings() { |
| 121 | + return ((DataPolicyServiceStubSettings) getStubSettings()).deleteDataPolicySettings(); |
| 122 | + } |
| 123 | + |
| 124 | + /** Returns the object with the settings used for calls to getDataPolicy. */ |
| 125 | + public UnaryCallSettings<GetDataPolicyRequest, DataPolicy> getDataPolicySettings() { |
| 126 | + return ((DataPolicyServiceStubSettings) getStubSettings()).getDataPolicySettings(); |
| 127 | + } |
| 128 | + |
| 129 | + /** Returns the object with the settings used for calls to listDataPolicies. */ |
| 130 | + public PagedCallSettings< |
| 131 | + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse> |
| 132 | + listDataPoliciesSettings() { |
| 133 | + return ((DataPolicyServiceStubSettings) getStubSettings()).listDataPoliciesSettings(); |
| 134 | + } |
| 135 | + |
| 136 | + /** Returns the object with the settings used for calls to getIamPolicy. */ |
| 137 | + public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() { |
| 138 | + return ((DataPolicyServiceStubSettings) getStubSettings()).getIamPolicySettings(); |
| 139 | + } |
| 140 | + |
| 141 | + /** Returns the object with the settings used for calls to setIamPolicy. */ |
| 142 | + public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() { |
| 143 | + return ((DataPolicyServiceStubSettings) getStubSettings()).setIamPolicySettings(); |
| 144 | + } |
| 145 | + |
| 146 | + /** Returns the object with the settings used for calls to testIamPermissions. */ |
| 147 | + public UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse> |
| 148 | + testIamPermissionsSettings() { |
| 149 | + return ((DataPolicyServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); |
| 150 | + } |
| 151 | + |
| 152 | + public static final DataPolicyServiceSettings create(DataPolicyServiceStubSettings stub) |
| 153 | + throws IOException { |
| 154 | + return new DataPolicyServiceSettings.Builder(stub.toBuilder()).build(); |
| 155 | + } |
| 156 | + |
| 157 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 158 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 159 | + return DataPolicyServiceStubSettings.defaultExecutorProviderBuilder(); |
| 160 | + } |
| 161 | + |
| 162 | + /** Returns the default service endpoint. */ |
| 163 | + public static String getDefaultEndpoint() { |
| 164 | + return DataPolicyServiceStubSettings.getDefaultEndpoint(); |
| 165 | + } |
| 166 | + |
| 167 | + /** Returns the default service scopes. */ |
| 168 | + public static List<String> getDefaultServiceScopes() { |
| 169 | + return DataPolicyServiceStubSettings.getDefaultServiceScopes(); |
| 170 | + } |
| 171 | + |
| 172 | + /** Returns a builder for the default credentials for this service. */ |
| 173 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 174 | + return DataPolicyServiceStubSettings.defaultCredentialsProviderBuilder(); |
| 175 | + } |
| 176 | + |
| 177 | + /** Returns a builder for the default gRPC ChannelProvider for this service. */ |
| 178 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 179 | + return DataPolicyServiceStubSettings.defaultGrpcTransportProviderBuilder(); |
| 180 | + } |
| 181 | + |
| 182 | + /** Returns a builder for the default REST ChannelProvider for this service. */ |
| 183 | + @BetaApi |
| 184 | + public static InstantiatingHttpJsonChannelProvider.Builder |
| 185 | + defaultHttpJsonTransportProviderBuilder() { |
| 186 | + return DataPolicyServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); |
| 187 | + } |
| 188 | + |
| 189 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 190 | + return DataPolicyServiceStubSettings.defaultTransportChannelProvider(); |
| 191 | + } |
| 192 | + |
| 193 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 194 | + return DataPolicyServiceStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 195 | + } |
| 196 | + |
| 197 | + /** Returns a new gRPC builder for this class. */ |
| 198 | + public static Builder newBuilder() { |
| 199 | + return Builder.createDefault(); |
| 200 | + } |
| 201 | + |
| 202 | + /** Returns a new REST builder for this class. */ |
| 203 | + public static Builder newHttpJsonBuilder() { |
| 204 | + return Builder.createHttpJsonDefault(); |
| 205 | + } |
| 206 | + |
| 207 | + /** Returns a new builder for this class. */ |
| 208 | + public static Builder newBuilder(ClientContext clientContext) { |
| 209 | + return new Builder(clientContext); |
| 210 | + } |
| 211 | + |
| 212 | + /** Returns a builder containing all the values of this settings class. */ |
| 213 | + public Builder toBuilder() { |
| 214 | + return new Builder(this); |
| 215 | + } |
| 216 | + |
| 217 | + protected DataPolicyServiceSettings(Builder settingsBuilder) throws IOException { |
| 218 | + super(settingsBuilder); |
| 219 | + } |
| 220 | + |
| 221 | + /** Builder for DataPolicyServiceSettings. */ |
| 222 | + public static class Builder extends ClientSettings.Builder<DataPolicyServiceSettings, Builder> { |
| 223 | + |
| 224 | + protected Builder() throws IOException { |
| 225 | + this(((ClientContext) null)); |
| 226 | + } |
| 227 | + |
| 228 | + protected Builder(ClientContext clientContext) { |
| 229 | + super(DataPolicyServiceStubSettings.newBuilder(clientContext)); |
| 230 | + } |
| 231 | + |
| 232 | + protected Builder(DataPolicyServiceSettings settings) { |
| 233 | + super(settings.getStubSettings().toBuilder()); |
| 234 | + } |
| 235 | + |
| 236 | + protected Builder(DataPolicyServiceStubSettings.Builder stubSettings) { |
| 237 | + super(stubSettings); |
| 238 | + } |
| 239 | + |
| 240 | + private static Builder createDefault() { |
| 241 | + return new Builder(DataPolicyServiceStubSettings.newBuilder()); |
| 242 | + } |
| 243 | + |
| 244 | + private static Builder createHttpJsonDefault() { |
| 245 | + return new Builder(DataPolicyServiceStubSettings.newHttpJsonBuilder()); |
| 246 | + } |
| 247 | + |
| 248 | + public DataPolicyServiceStubSettings.Builder getStubSettingsBuilder() { |
| 249 | + return ((DataPolicyServiceStubSettings.Builder) getStubSettings()); |
| 250 | + } |
| 251 | + |
| 252 | + /** |
| 253 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 254 | + * |
| 255 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 256 | + */ |
| 257 | + public Builder applyToAllUnaryMethods( |
| 258 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 259 | + super.applyToAllUnaryMethods( |
| 260 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 261 | + return this; |
| 262 | + } |
| 263 | + |
| 264 | + /** Returns the builder for the settings used for calls to createDataPolicy. */ |
| 265 | + public UnaryCallSettings.Builder<CreateDataPolicyRequest, DataPolicy> |
| 266 | + createDataPolicySettings() { |
| 267 | + return getStubSettingsBuilder().createDataPolicySettings(); |
| 268 | + } |
| 269 | + |
| 270 | + /** Returns the builder for the settings used for calls to addGrantees. */ |
| 271 | + public UnaryCallSettings.Builder<AddGranteesRequest, DataPolicy> addGranteesSettings() { |
| 272 | + return getStubSettingsBuilder().addGranteesSettings(); |
| 273 | + } |
| 274 | + |
| 275 | + /** Returns the builder for the settings used for calls to removeGrantees. */ |
| 276 | + public UnaryCallSettings.Builder<RemoveGranteesRequest, DataPolicy> removeGranteesSettings() { |
| 277 | + return getStubSettingsBuilder().removeGranteesSettings(); |
| 278 | + } |
| 279 | + |
| 280 | + /** Returns the builder for the settings used for calls to updateDataPolicy. */ |
| 281 | + public UnaryCallSettings.Builder<UpdateDataPolicyRequest, DataPolicy> |
| 282 | + updateDataPolicySettings() { |
| 283 | + return getStubSettingsBuilder().updateDataPolicySettings(); |
| 284 | + } |
| 285 | + |
| 286 | + /** Returns the builder for the settings used for calls to deleteDataPolicy. */ |
| 287 | + public UnaryCallSettings.Builder<DeleteDataPolicyRequest, Empty> deleteDataPolicySettings() { |
| 288 | + return getStubSettingsBuilder().deleteDataPolicySettings(); |
| 289 | + } |
| 290 | + |
| 291 | + /** Returns the builder for the settings used for calls to getDataPolicy. */ |
| 292 | + public UnaryCallSettings.Builder<GetDataPolicyRequest, DataPolicy> getDataPolicySettings() { |
| 293 | + return getStubSettingsBuilder().getDataPolicySettings(); |
| 294 | + } |
| 295 | + |
| 296 | + /** Returns the builder for the settings used for calls to listDataPolicies. */ |
| 297 | + public PagedCallSettings.Builder< |
| 298 | + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse> |
| 299 | + listDataPoliciesSettings() { |
| 300 | + return getStubSettingsBuilder().listDataPoliciesSettings(); |
| 301 | + } |
| 302 | + |
| 303 | + /** Returns the builder for the settings used for calls to getIamPolicy. */ |
| 304 | + public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() { |
| 305 | + return getStubSettingsBuilder().getIamPolicySettings(); |
| 306 | + } |
| 307 | + |
| 308 | + /** Returns the builder for the settings used for calls to setIamPolicy. */ |
| 309 | + public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings() { |
| 310 | + return getStubSettingsBuilder().setIamPolicySettings(); |
| 311 | + } |
| 312 | + |
| 313 | + /** Returns the builder for the settings used for calls to testIamPermissions. */ |
| 314 | + public UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse> |
| 315 | + testIamPermissionsSettings() { |
| 316 | + return getStubSettingsBuilder().testIamPermissionsSettings(); |
| 317 | + } |
| 318 | + |
| 319 | + @Override |
| 320 | + public DataPolicyServiceSettings build() throws IOException { |
| 321 | + return new DataPolicyServiceSettings(this); |
| 322 | + } |
| 323 | + } |
| 324 | +} |
0 commit comments