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.aiplatform.v1; 18 19 import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse; 20 import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListDataItemsPagedResponse; 21 import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListDatasetsPagedResponse; 22 import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListLocationsPagedResponse; 23 import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListSavedQueriesPagedResponse; 24 import static com.google.cloud.aiplatform.v1.DatasetServiceClient.SearchDataItemsPagedResponse; 25 26 import com.google.api.core.ApiFunction; 27 import com.google.api.core.BetaApi; 28 import com.google.api.gax.core.GoogleCredentialsProvider; 29 import com.google.api.gax.core.InstantiatingExecutorProvider; 30 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; 31 import com.google.api.gax.rpc.ApiClientHeaderProvider; 32 import com.google.api.gax.rpc.ClientContext; 33 import com.google.api.gax.rpc.ClientSettings; 34 import com.google.api.gax.rpc.OperationCallSettings; 35 import com.google.api.gax.rpc.PagedCallSettings; 36 import com.google.api.gax.rpc.TransportChannelProvider; 37 import com.google.api.gax.rpc.UnaryCallSettings; 38 import com.google.cloud.aiplatform.v1.stub.DatasetServiceStubSettings; 39 import com.google.cloud.location.GetLocationRequest; 40 import com.google.cloud.location.ListLocationsRequest; 41 import com.google.cloud.location.ListLocationsResponse; 42 import com.google.cloud.location.Location; 43 import com.google.iam.v1.GetIamPolicyRequest; 44 import com.google.iam.v1.Policy; 45 import com.google.iam.v1.SetIamPolicyRequest; 46 import com.google.iam.v1.TestIamPermissionsRequest; 47 import com.google.iam.v1.TestIamPermissionsResponse; 48 import com.google.longrunning.Operation; 49 import com.google.protobuf.Empty; 50 import java.io.IOException; 51 import java.util.List; 52 import javax.annotation.Generated; 53 54 // AUTO-GENERATED DOCUMENTATION AND CLASS. 55 /** 56 * Settings class to configure an instance of {@link DatasetServiceClient}. 57 * 58 * <p>The default instance has everything set to sensible defaults: 59 * 60 * <ul> 61 * <li>The default service address (aiplatform.googleapis.com) and default port (443) are used. 62 * <li>Credentials are acquired automatically through Application Default Credentials. 63 * <li>Retries are configured for idempotent methods but not for non-idempotent methods. 64 * </ul> 65 * 66 * <p>The builder of this class is recursive, so contained classes are themselves builders. When 67 * build() is called, the tree of builders is called to create the complete settings object. 68 * 69 * <p>For example, to set the total timeout of getDataset to 30 seconds: 70 * 71 * <pre>{@code 72 * // This snippet has been automatically generated and should be regarded as a code template only. 73 * // It will require modifications to work: 74 * // - It may require correct/in-range values for request initialization. 75 * // - It may require specifying regional endpoints when creating the service client as shown in 76 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 77 * DatasetServiceSettings.Builder datasetServiceSettingsBuilder = 78 * DatasetServiceSettings.newBuilder(); 79 * datasetServiceSettingsBuilder 80 * .getDatasetSettings() 81 * .setRetrySettings( 82 * datasetServiceSettingsBuilder 83 * .getDatasetSettings() 84 * .getRetrySettings() 85 * .toBuilder() 86 * .setTotalTimeout(Duration.ofSeconds(30)) 87 * .build()); 88 * DatasetServiceSettings datasetServiceSettings = datasetServiceSettingsBuilder.build(); 89 * }</pre> 90 */ 91 @Generated("by gapic-generator-java") 92 public class DatasetServiceSettings extends ClientSettings<DatasetServiceSettings> { 93 94 /** Returns the object with the settings used for calls to createDataset. */ createDatasetSettings()95 public UnaryCallSettings<CreateDatasetRequest, Operation> createDatasetSettings() { 96 return ((DatasetServiceStubSettings) getStubSettings()).createDatasetSettings(); 97 } 98 99 /** Returns the object with the settings used for calls to createDataset. */ 100 public OperationCallSettings<CreateDatasetRequest, Dataset, CreateDatasetOperationMetadata> createDatasetOperationSettings()101 createDatasetOperationSettings() { 102 return ((DatasetServiceStubSettings) getStubSettings()).createDatasetOperationSettings(); 103 } 104 105 /** Returns the object with the settings used for calls to getDataset. */ getDatasetSettings()106 public UnaryCallSettings<GetDatasetRequest, Dataset> getDatasetSettings() { 107 return ((DatasetServiceStubSettings) getStubSettings()).getDatasetSettings(); 108 } 109 110 /** Returns the object with the settings used for calls to updateDataset. */ updateDatasetSettings()111 public UnaryCallSettings<UpdateDatasetRequest, Dataset> updateDatasetSettings() { 112 return ((DatasetServiceStubSettings) getStubSettings()).updateDatasetSettings(); 113 } 114 115 /** Returns the object with the settings used for calls to listDatasets. */ 116 public PagedCallSettings<ListDatasetsRequest, ListDatasetsResponse, ListDatasetsPagedResponse> listDatasetsSettings()117 listDatasetsSettings() { 118 return ((DatasetServiceStubSettings) getStubSettings()).listDatasetsSettings(); 119 } 120 121 /** Returns the object with the settings used for calls to deleteDataset. */ deleteDatasetSettings()122 public UnaryCallSettings<DeleteDatasetRequest, Operation> deleteDatasetSettings() { 123 return ((DatasetServiceStubSettings) getStubSettings()).deleteDatasetSettings(); 124 } 125 126 /** Returns the object with the settings used for calls to deleteDataset. */ 127 public OperationCallSettings<DeleteDatasetRequest, Empty, DeleteOperationMetadata> deleteDatasetOperationSettings()128 deleteDatasetOperationSettings() { 129 return ((DatasetServiceStubSettings) getStubSettings()).deleteDatasetOperationSettings(); 130 } 131 132 /** Returns the object with the settings used for calls to importData. */ importDataSettings()133 public UnaryCallSettings<ImportDataRequest, Operation> importDataSettings() { 134 return ((DatasetServiceStubSettings) getStubSettings()).importDataSettings(); 135 } 136 137 /** Returns the object with the settings used for calls to importData. */ 138 public OperationCallSettings<ImportDataRequest, ImportDataResponse, ImportDataOperationMetadata> importDataOperationSettings()139 importDataOperationSettings() { 140 return ((DatasetServiceStubSettings) getStubSettings()).importDataOperationSettings(); 141 } 142 143 /** Returns the object with the settings used for calls to exportData. */ exportDataSettings()144 public UnaryCallSettings<ExportDataRequest, Operation> exportDataSettings() { 145 return ((DatasetServiceStubSettings) getStubSettings()).exportDataSettings(); 146 } 147 148 /** Returns the object with the settings used for calls to exportData. */ 149 public OperationCallSettings<ExportDataRequest, ExportDataResponse, ExportDataOperationMetadata> exportDataOperationSettings()150 exportDataOperationSettings() { 151 return ((DatasetServiceStubSettings) getStubSettings()).exportDataOperationSettings(); 152 } 153 154 /** Returns the object with the settings used for calls to listDataItems. */ 155 public PagedCallSettings<ListDataItemsRequest, ListDataItemsResponse, ListDataItemsPagedResponse> listDataItemsSettings()156 listDataItemsSettings() { 157 return ((DatasetServiceStubSettings) getStubSettings()).listDataItemsSettings(); 158 } 159 160 /** Returns the object with the settings used for calls to searchDataItems. */ 161 public PagedCallSettings< 162 SearchDataItemsRequest, SearchDataItemsResponse, SearchDataItemsPagedResponse> searchDataItemsSettings()163 searchDataItemsSettings() { 164 return ((DatasetServiceStubSettings) getStubSettings()).searchDataItemsSettings(); 165 } 166 167 /** Returns the object with the settings used for calls to listSavedQueries. */ 168 public PagedCallSettings< 169 ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse> listSavedQueriesSettings()170 listSavedQueriesSettings() { 171 return ((DatasetServiceStubSettings) getStubSettings()).listSavedQueriesSettings(); 172 } 173 174 /** Returns the object with the settings used for calls to getAnnotationSpec. */ getAnnotationSpecSettings()175 public UnaryCallSettings<GetAnnotationSpecRequest, AnnotationSpec> getAnnotationSpecSettings() { 176 return ((DatasetServiceStubSettings) getStubSettings()).getAnnotationSpecSettings(); 177 } 178 179 /** Returns the object with the settings used for calls to listAnnotations. */ 180 public PagedCallSettings< 181 ListAnnotationsRequest, ListAnnotationsResponse, ListAnnotationsPagedResponse> listAnnotationsSettings()182 listAnnotationsSettings() { 183 return ((DatasetServiceStubSettings) getStubSettings()).listAnnotationsSettings(); 184 } 185 186 /** Returns the object with the settings used for calls to listLocations. */ 187 public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings()188 listLocationsSettings() { 189 return ((DatasetServiceStubSettings) getStubSettings()).listLocationsSettings(); 190 } 191 192 /** Returns the object with the settings used for calls to getLocation. */ getLocationSettings()193 public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() { 194 return ((DatasetServiceStubSettings) getStubSettings()).getLocationSettings(); 195 } 196 197 /** Returns the object with the settings used for calls to setIamPolicy. */ setIamPolicySettings()198 public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() { 199 return ((DatasetServiceStubSettings) getStubSettings()).setIamPolicySettings(); 200 } 201 202 /** Returns the object with the settings used for calls to getIamPolicy. */ getIamPolicySettings()203 public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() { 204 return ((DatasetServiceStubSettings) getStubSettings()).getIamPolicySettings(); 205 } 206 207 /** Returns the object with the settings used for calls to testIamPermissions. */ 208 public UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsSettings()209 testIamPermissionsSettings() { 210 return ((DatasetServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); 211 } 212 create(DatasetServiceStubSettings stub)213 public static final DatasetServiceSettings create(DatasetServiceStubSettings stub) 214 throws IOException { 215 return new DatasetServiceSettings.Builder(stub.toBuilder()).build(); 216 } 217 218 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()219 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 220 return DatasetServiceStubSettings.defaultExecutorProviderBuilder(); 221 } 222 223 /** Returns the default service endpoint. */ getDefaultEndpoint()224 public static String getDefaultEndpoint() { 225 return DatasetServiceStubSettings.getDefaultEndpoint(); 226 } 227 228 /** Returns the default service scopes. */ getDefaultServiceScopes()229 public static List<String> getDefaultServiceScopes() { 230 return DatasetServiceStubSettings.getDefaultServiceScopes(); 231 } 232 233 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()234 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 235 return DatasetServiceStubSettings.defaultCredentialsProviderBuilder(); 236 } 237 238 /** Returns a builder for the default ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()239 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 240 return DatasetServiceStubSettings.defaultGrpcTransportProviderBuilder(); 241 } 242 defaultTransportChannelProvider()243 public static TransportChannelProvider defaultTransportChannelProvider() { 244 return DatasetServiceStubSettings.defaultTransportChannelProvider(); 245 } 246 247 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()248 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 249 return DatasetServiceStubSettings.defaultApiClientHeaderProviderBuilder(); 250 } 251 252 /** Returns a new builder for this class. */ newBuilder()253 public static Builder newBuilder() { 254 return Builder.createDefault(); 255 } 256 257 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)258 public static Builder newBuilder(ClientContext clientContext) { 259 return new Builder(clientContext); 260 } 261 262 /** Returns a builder containing all the values of this settings class. */ toBuilder()263 public Builder toBuilder() { 264 return new Builder(this); 265 } 266 DatasetServiceSettings(Builder settingsBuilder)267 protected DatasetServiceSettings(Builder settingsBuilder) throws IOException { 268 super(settingsBuilder); 269 } 270 271 /** Builder for DatasetServiceSettings. */ 272 public static class Builder extends ClientSettings.Builder<DatasetServiceSettings, Builder> { 273 Builder()274 protected Builder() throws IOException { 275 this(((ClientContext) null)); 276 } 277 Builder(ClientContext clientContext)278 protected Builder(ClientContext clientContext) { 279 super(DatasetServiceStubSettings.newBuilder(clientContext)); 280 } 281 Builder(DatasetServiceSettings settings)282 protected Builder(DatasetServiceSettings settings) { 283 super(settings.getStubSettings().toBuilder()); 284 } 285 Builder(DatasetServiceStubSettings.Builder stubSettings)286 protected Builder(DatasetServiceStubSettings.Builder stubSettings) { 287 super(stubSettings); 288 } 289 createDefault()290 private static Builder createDefault() { 291 return new Builder(DatasetServiceStubSettings.newBuilder()); 292 } 293 getStubSettingsBuilder()294 public DatasetServiceStubSettings.Builder getStubSettingsBuilder() { 295 return ((DatasetServiceStubSettings.Builder) getStubSettings()); 296 } 297 298 /** 299 * Applies the given settings updater function to all of the unary API methods in this service. 300 * 301 * <p>Note: This method does not support applying settings to streaming methods. 302 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)303 public Builder applyToAllUnaryMethods( 304 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 305 super.applyToAllUnaryMethods( 306 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 307 return this; 308 } 309 310 /** Returns the builder for the settings used for calls to createDataset. */ createDatasetSettings()311 public UnaryCallSettings.Builder<CreateDatasetRequest, Operation> createDatasetSettings() { 312 return getStubSettingsBuilder().createDatasetSettings(); 313 } 314 315 /** Returns the builder for the settings used for calls to createDataset. */ 316 public OperationCallSettings.Builder< 317 CreateDatasetRequest, Dataset, CreateDatasetOperationMetadata> createDatasetOperationSettings()318 createDatasetOperationSettings() { 319 return getStubSettingsBuilder().createDatasetOperationSettings(); 320 } 321 322 /** Returns the builder for the settings used for calls to getDataset. */ getDatasetSettings()323 public UnaryCallSettings.Builder<GetDatasetRequest, Dataset> getDatasetSettings() { 324 return getStubSettingsBuilder().getDatasetSettings(); 325 } 326 327 /** Returns the builder for the settings used for calls to updateDataset. */ updateDatasetSettings()328 public UnaryCallSettings.Builder<UpdateDatasetRequest, Dataset> updateDatasetSettings() { 329 return getStubSettingsBuilder().updateDatasetSettings(); 330 } 331 332 /** Returns the builder for the settings used for calls to listDatasets. */ 333 public PagedCallSettings.Builder< 334 ListDatasetsRequest, ListDatasetsResponse, ListDatasetsPagedResponse> listDatasetsSettings()335 listDatasetsSettings() { 336 return getStubSettingsBuilder().listDatasetsSettings(); 337 } 338 339 /** Returns the builder for the settings used for calls to deleteDataset. */ deleteDatasetSettings()340 public UnaryCallSettings.Builder<DeleteDatasetRequest, Operation> deleteDatasetSettings() { 341 return getStubSettingsBuilder().deleteDatasetSettings(); 342 } 343 344 /** Returns the builder for the settings used for calls to deleteDataset. */ 345 public OperationCallSettings.Builder<DeleteDatasetRequest, Empty, DeleteOperationMetadata> deleteDatasetOperationSettings()346 deleteDatasetOperationSettings() { 347 return getStubSettingsBuilder().deleteDatasetOperationSettings(); 348 } 349 350 /** Returns the builder for the settings used for calls to importData. */ importDataSettings()351 public UnaryCallSettings.Builder<ImportDataRequest, Operation> importDataSettings() { 352 return getStubSettingsBuilder().importDataSettings(); 353 } 354 355 /** Returns the builder for the settings used for calls to importData. */ 356 public OperationCallSettings.Builder< 357 ImportDataRequest, ImportDataResponse, ImportDataOperationMetadata> importDataOperationSettings()358 importDataOperationSettings() { 359 return getStubSettingsBuilder().importDataOperationSettings(); 360 } 361 362 /** Returns the builder for the settings used for calls to exportData. */ exportDataSettings()363 public UnaryCallSettings.Builder<ExportDataRequest, Operation> exportDataSettings() { 364 return getStubSettingsBuilder().exportDataSettings(); 365 } 366 367 /** Returns the builder for the settings used for calls to exportData. */ 368 public OperationCallSettings.Builder< 369 ExportDataRequest, ExportDataResponse, ExportDataOperationMetadata> exportDataOperationSettings()370 exportDataOperationSettings() { 371 return getStubSettingsBuilder().exportDataOperationSettings(); 372 } 373 374 /** Returns the builder for the settings used for calls to listDataItems. */ 375 public PagedCallSettings.Builder< 376 ListDataItemsRequest, ListDataItemsResponse, ListDataItemsPagedResponse> listDataItemsSettings()377 listDataItemsSettings() { 378 return getStubSettingsBuilder().listDataItemsSettings(); 379 } 380 381 /** Returns the builder for the settings used for calls to searchDataItems. */ 382 public PagedCallSettings.Builder< 383 SearchDataItemsRequest, SearchDataItemsResponse, SearchDataItemsPagedResponse> searchDataItemsSettings()384 searchDataItemsSettings() { 385 return getStubSettingsBuilder().searchDataItemsSettings(); 386 } 387 388 /** Returns the builder for the settings used for calls to listSavedQueries. */ 389 public PagedCallSettings.Builder< 390 ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse> listSavedQueriesSettings()391 listSavedQueriesSettings() { 392 return getStubSettingsBuilder().listSavedQueriesSettings(); 393 } 394 395 /** Returns the builder for the settings used for calls to getAnnotationSpec. */ 396 public UnaryCallSettings.Builder<GetAnnotationSpecRequest, AnnotationSpec> getAnnotationSpecSettings()397 getAnnotationSpecSettings() { 398 return getStubSettingsBuilder().getAnnotationSpecSettings(); 399 } 400 401 /** Returns the builder for the settings used for calls to listAnnotations. */ 402 public PagedCallSettings.Builder< 403 ListAnnotationsRequest, ListAnnotationsResponse, ListAnnotationsPagedResponse> listAnnotationsSettings()404 listAnnotationsSettings() { 405 return getStubSettingsBuilder().listAnnotationsSettings(); 406 } 407 408 /** Returns the builder for the settings used for calls to listLocations. */ 409 public PagedCallSettings.Builder< 410 ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings()411 listLocationsSettings() { 412 return getStubSettingsBuilder().listLocationsSettings(); 413 } 414 415 /** Returns the builder for the settings used for calls to getLocation. */ getLocationSettings()416 public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() { 417 return getStubSettingsBuilder().getLocationSettings(); 418 } 419 420 /** Returns the builder for the settings used for calls to setIamPolicy. */ setIamPolicySettings()421 public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings() { 422 return getStubSettingsBuilder().setIamPolicySettings(); 423 } 424 425 /** Returns the builder for the settings used for calls to getIamPolicy. */ getIamPolicySettings()426 public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() { 427 return getStubSettingsBuilder().getIamPolicySettings(); 428 } 429 430 /** Returns the builder for the settings used for calls to testIamPermissions. */ 431 public UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsSettings()432 testIamPermissionsSettings() { 433 return getStubSettingsBuilder().testIamPermissionsSettings(); 434 } 435 436 @Override build()437 public DatasetServiceSettings build() throws IOException { 438 return new DatasetServiceSettings(this); 439 } 440 } 441 } 442