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.EndpointServiceClient.ListEndpointsPagedResponse; 20 import static com.google.cloud.aiplatform.v1.EndpointServiceClient.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.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.aiplatform.v1.stub.EndpointServiceStubSettings; 35 import com.google.cloud.location.GetLocationRequest; 36 import com.google.cloud.location.ListLocationsRequest; 37 import com.google.cloud.location.ListLocationsResponse; 38 import com.google.cloud.location.Location; 39 import com.google.iam.v1.GetIamPolicyRequest; 40 import com.google.iam.v1.Policy; 41 import com.google.iam.v1.SetIamPolicyRequest; 42 import com.google.iam.v1.TestIamPermissionsRequest; 43 import com.google.iam.v1.TestIamPermissionsResponse; 44 import com.google.longrunning.Operation; 45 import com.google.protobuf.Empty; 46 import java.io.IOException; 47 import java.util.List; 48 import javax.annotation.Generated; 49 50 // AUTO-GENERATED DOCUMENTATION AND CLASS. 51 /** 52 * Settings class to configure an instance of {@link EndpointServiceClient}. 53 * 54 * <p>The default instance has everything set to sensible defaults: 55 * 56 * <ul> 57 * <li>The default service address (aiplatform.googleapis.com) and default port (443) are used. 58 * <li>Credentials are acquired automatically through Application Default Credentials. 59 * <li>Retries are configured for idempotent methods but not for non-idempotent methods. 60 * </ul> 61 * 62 * <p>The builder of this class is recursive, so contained classes are themselves builders. When 63 * build() is called, the tree of builders is called to create the complete settings object. 64 * 65 * <p>For example, to set the total timeout of getEndpoint to 30 seconds: 66 * 67 * <pre>{@code 68 * // This snippet has been automatically generated and should be regarded as a code template only. 69 * // It will require modifications to work: 70 * // - It may require correct/in-range values for request initialization. 71 * // - It may require specifying regional endpoints when creating the service client as shown in 72 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 73 * EndpointServiceSettings.Builder endpointServiceSettingsBuilder = 74 * EndpointServiceSettings.newBuilder(); 75 * endpointServiceSettingsBuilder 76 * .getEndpointSettings() 77 * .setRetrySettings( 78 * endpointServiceSettingsBuilder 79 * .getEndpointSettings() 80 * .getRetrySettings() 81 * .toBuilder() 82 * .setTotalTimeout(Duration.ofSeconds(30)) 83 * .build()); 84 * EndpointServiceSettings endpointServiceSettings = endpointServiceSettingsBuilder.build(); 85 * }</pre> 86 */ 87 @Generated("by gapic-generator-java") 88 public class EndpointServiceSettings extends ClientSettings<EndpointServiceSettings> { 89 90 /** Returns the object with the settings used for calls to createEndpoint. */ createEndpointSettings()91 public UnaryCallSettings<CreateEndpointRequest, Operation> createEndpointSettings() { 92 return ((EndpointServiceStubSettings) getStubSettings()).createEndpointSettings(); 93 } 94 95 /** Returns the object with the settings used for calls to createEndpoint. */ 96 public OperationCallSettings<CreateEndpointRequest, Endpoint, CreateEndpointOperationMetadata> createEndpointOperationSettings()97 createEndpointOperationSettings() { 98 return ((EndpointServiceStubSettings) getStubSettings()).createEndpointOperationSettings(); 99 } 100 101 /** Returns the object with the settings used for calls to getEndpoint. */ getEndpointSettings()102 public UnaryCallSettings<GetEndpointRequest, Endpoint> getEndpointSettings() { 103 return ((EndpointServiceStubSettings) getStubSettings()).getEndpointSettings(); 104 } 105 106 /** Returns the object with the settings used for calls to listEndpoints. */ 107 public PagedCallSettings<ListEndpointsRequest, ListEndpointsResponse, ListEndpointsPagedResponse> listEndpointsSettings()108 listEndpointsSettings() { 109 return ((EndpointServiceStubSettings) getStubSettings()).listEndpointsSettings(); 110 } 111 112 /** Returns the object with the settings used for calls to updateEndpoint. */ updateEndpointSettings()113 public UnaryCallSettings<UpdateEndpointRequest, Endpoint> updateEndpointSettings() { 114 return ((EndpointServiceStubSettings) getStubSettings()).updateEndpointSettings(); 115 } 116 117 /** Returns the object with the settings used for calls to deleteEndpoint. */ deleteEndpointSettings()118 public UnaryCallSettings<DeleteEndpointRequest, Operation> deleteEndpointSettings() { 119 return ((EndpointServiceStubSettings) getStubSettings()).deleteEndpointSettings(); 120 } 121 122 /** Returns the object with the settings used for calls to deleteEndpoint. */ 123 public OperationCallSettings<DeleteEndpointRequest, Empty, DeleteOperationMetadata> deleteEndpointOperationSettings()124 deleteEndpointOperationSettings() { 125 return ((EndpointServiceStubSettings) getStubSettings()).deleteEndpointOperationSettings(); 126 } 127 128 /** Returns the object with the settings used for calls to deployModel. */ deployModelSettings()129 public UnaryCallSettings<DeployModelRequest, Operation> deployModelSettings() { 130 return ((EndpointServiceStubSettings) getStubSettings()).deployModelSettings(); 131 } 132 133 /** Returns the object with the settings used for calls to deployModel. */ 134 public OperationCallSettings< 135 DeployModelRequest, DeployModelResponse, DeployModelOperationMetadata> deployModelOperationSettings()136 deployModelOperationSettings() { 137 return ((EndpointServiceStubSettings) getStubSettings()).deployModelOperationSettings(); 138 } 139 140 /** Returns the object with the settings used for calls to undeployModel. */ undeployModelSettings()141 public UnaryCallSettings<UndeployModelRequest, Operation> undeployModelSettings() { 142 return ((EndpointServiceStubSettings) getStubSettings()).undeployModelSettings(); 143 } 144 145 /** Returns the object with the settings used for calls to undeployModel. */ 146 public OperationCallSettings< 147 UndeployModelRequest, UndeployModelResponse, UndeployModelOperationMetadata> undeployModelOperationSettings()148 undeployModelOperationSettings() { 149 return ((EndpointServiceStubSettings) getStubSettings()).undeployModelOperationSettings(); 150 } 151 152 /** Returns the object with the settings used for calls to mutateDeployedModel. */ mutateDeployedModelSettings()153 public UnaryCallSettings<MutateDeployedModelRequest, Operation> mutateDeployedModelSettings() { 154 return ((EndpointServiceStubSettings) getStubSettings()).mutateDeployedModelSettings(); 155 } 156 157 /** Returns the object with the settings used for calls to mutateDeployedModel. */ 158 public OperationCallSettings< 159 MutateDeployedModelRequest, 160 MutateDeployedModelResponse, 161 MutateDeployedModelOperationMetadata> mutateDeployedModelOperationSettings()162 mutateDeployedModelOperationSettings() { 163 return ((EndpointServiceStubSettings) getStubSettings()).mutateDeployedModelOperationSettings(); 164 } 165 166 /** Returns the object with the settings used for calls to listLocations. */ 167 public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings()168 listLocationsSettings() { 169 return ((EndpointServiceStubSettings) getStubSettings()).listLocationsSettings(); 170 } 171 172 /** Returns the object with the settings used for calls to getLocation. */ getLocationSettings()173 public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() { 174 return ((EndpointServiceStubSettings) getStubSettings()).getLocationSettings(); 175 } 176 177 /** Returns the object with the settings used for calls to setIamPolicy. */ setIamPolicySettings()178 public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() { 179 return ((EndpointServiceStubSettings) getStubSettings()).setIamPolicySettings(); 180 } 181 182 /** Returns the object with the settings used for calls to getIamPolicy. */ getIamPolicySettings()183 public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() { 184 return ((EndpointServiceStubSettings) getStubSettings()).getIamPolicySettings(); 185 } 186 187 /** Returns the object with the settings used for calls to testIamPermissions. */ 188 public UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsSettings()189 testIamPermissionsSettings() { 190 return ((EndpointServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); 191 } 192 create(EndpointServiceStubSettings stub)193 public static final EndpointServiceSettings create(EndpointServiceStubSettings stub) 194 throws IOException { 195 return new EndpointServiceSettings.Builder(stub.toBuilder()).build(); 196 } 197 198 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()199 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 200 return EndpointServiceStubSettings.defaultExecutorProviderBuilder(); 201 } 202 203 /** Returns the default service endpoint. */ getDefaultEndpoint()204 public static String getDefaultEndpoint() { 205 return EndpointServiceStubSettings.getDefaultEndpoint(); 206 } 207 208 /** Returns the default service scopes. */ getDefaultServiceScopes()209 public static List<String> getDefaultServiceScopes() { 210 return EndpointServiceStubSettings.getDefaultServiceScopes(); 211 } 212 213 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()214 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 215 return EndpointServiceStubSettings.defaultCredentialsProviderBuilder(); 216 } 217 218 /** Returns a builder for the default ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()219 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 220 return EndpointServiceStubSettings.defaultGrpcTransportProviderBuilder(); 221 } 222 defaultTransportChannelProvider()223 public static TransportChannelProvider defaultTransportChannelProvider() { 224 return EndpointServiceStubSettings.defaultTransportChannelProvider(); 225 } 226 227 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()228 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 229 return EndpointServiceStubSettings.defaultApiClientHeaderProviderBuilder(); 230 } 231 232 /** Returns a new builder for this class. */ newBuilder()233 public static Builder newBuilder() { 234 return Builder.createDefault(); 235 } 236 237 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)238 public static Builder newBuilder(ClientContext clientContext) { 239 return new Builder(clientContext); 240 } 241 242 /** Returns a builder containing all the values of this settings class. */ toBuilder()243 public Builder toBuilder() { 244 return new Builder(this); 245 } 246 EndpointServiceSettings(Builder settingsBuilder)247 protected EndpointServiceSettings(Builder settingsBuilder) throws IOException { 248 super(settingsBuilder); 249 } 250 251 /** Builder for EndpointServiceSettings. */ 252 public static class Builder extends ClientSettings.Builder<EndpointServiceSettings, Builder> { 253 Builder()254 protected Builder() throws IOException { 255 this(((ClientContext) null)); 256 } 257 Builder(ClientContext clientContext)258 protected Builder(ClientContext clientContext) { 259 super(EndpointServiceStubSettings.newBuilder(clientContext)); 260 } 261 Builder(EndpointServiceSettings settings)262 protected Builder(EndpointServiceSettings settings) { 263 super(settings.getStubSettings().toBuilder()); 264 } 265 Builder(EndpointServiceStubSettings.Builder stubSettings)266 protected Builder(EndpointServiceStubSettings.Builder stubSettings) { 267 super(stubSettings); 268 } 269 createDefault()270 private static Builder createDefault() { 271 return new Builder(EndpointServiceStubSettings.newBuilder()); 272 } 273 getStubSettingsBuilder()274 public EndpointServiceStubSettings.Builder getStubSettingsBuilder() { 275 return ((EndpointServiceStubSettings.Builder) getStubSettings()); 276 } 277 278 /** 279 * Applies the given settings updater function to all of the unary API methods in this service. 280 * 281 * <p>Note: This method does not support applying settings to streaming methods. 282 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)283 public Builder applyToAllUnaryMethods( 284 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 285 super.applyToAllUnaryMethods( 286 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 287 return this; 288 } 289 290 /** Returns the builder for the settings used for calls to createEndpoint. */ createEndpointSettings()291 public UnaryCallSettings.Builder<CreateEndpointRequest, Operation> createEndpointSettings() { 292 return getStubSettingsBuilder().createEndpointSettings(); 293 } 294 295 /** Returns the builder for the settings used for calls to createEndpoint. */ 296 public OperationCallSettings.Builder< 297 CreateEndpointRequest, Endpoint, CreateEndpointOperationMetadata> createEndpointOperationSettings()298 createEndpointOperationSettings() { 299 return getStubSettingsBuilder().createEndpointOperationSettings(); 300 } 301 302 /** Returns the builder for the settings used for calls to getEndpoint. */ getEndpointSettings()303 public UnaryCallSettings.Builder<GetEndpointRequest, Endpoint> getEndpointSettings() { 304 return getStubSettingsBuilder().getEndpointSettings(); 305 } 306 307 /** Returns the builder for the settings used for calls to listEndpoints. */ 308 public PagedCallSettings.Builder< 309 ListEndpointsRequest, ListEndpointsResponse, ListEndpointsPagedResponse> listEndpointsSettings()310 listEndpointsSettings() { 311 return getStubSettingsBuilder().listEndpointsSettings(); 312 } 313 314 /** Returns the builder for the settings used for calls to updateEndpoint. */ updateEndpointSettings()315 public UnaryCallSettings.Builder<UpdateEndpointRequest, Endpoint> updateEndpointSettings() { 316 return getStubSettingsBuilder().updateEndpointSettings(); 317 } 318 319 /** Returns the builder for the settings used for calls to deleteEndpoint. */ deleteEndpointSettings()320 public UnaryCallSettings.Builder<DeleteEndpointRequest, Operation> deleteEndpointSettings() { 321 return getStubSettingsBuilder().deleteEndpointSettings(); 322 } 323 324 /** Returns the builder for the settings used for calls to deleteEndpoint. */ 325 public OperationCallSettings.Builder<DeleteEndpointRequest, Empty, DeleteOperationMetadata> deleteEndpointOperationSettings()326 deleteEndpointOperationSettings() { 327 return getStubSettingsBuilder().deleteEndpointOperationSettings(); 328 } 329 330 /** Returns the builder for the settings used for calls to deployModel. */ deployModelSettings()331 public UnaryCallSettings.Builder<DeployModelRequest, Operation> deployModelSettings() { 332 return getStubSettingsBuilder().deployModelSettings(); 333 } 334 335 /** Returns the builder for the settings used for calls to deployModel. */ 336 public OperationCallSettings.Builder< 337 DeployModelRequest, DeployModelResponse, DeployModelOperationMetadata> deployModelOperationSettings()338 deployModelOperationSettings() { 339 return getStubSettingsBuilder().deployModelOperationSettings(); 340 } 341 342 /** Returns the builder for the settings used for calls to undeployModel. */ undeployModelSettings()343 public UnaryCallSettings.Builder<UndeployModelRequest, Operation> undeployModelSettings() { 344 return getStubSettingsBuilder().undeployModelSettings(); 345 } 346 347 /** Returns the builder for the settings used for calls to undeployModel. */ 348 public OperationCallSettings.Builder< 349 UndeployModelRequest, UndeployModelResponse, UndeployModelOperationMetadata> undeployModelOperationSettings()350 undeployModelOperationSettings() { 351 return getStubSettingsBuilder().undeployModelOperationSettings(); 352 } 353 354 /** Returns the builder for the settings used for calls to mutateDeployedModel. */ 355 public UnaryCallSettings.Builder<MutateDeployedModelRequest, Operation> mutateDeployedModelSettings()356 mutateDeployedModelSettings() { 357 return getStubSettingsBuilder().mutateDeployedModelSettings(); 358 } 359 360 /** Returns the builder for the settings used for calls to mutateDeployedModel. */ 361 public OperationCallSettings.Builder< 362 MutateDeployedModelRequest, 363 MutateDeployedModelResponse, 364 MutateDeployedModelOperationMetadata> mutateDeployedModelOperationSettings()365 mutateDeployedModelOperationSettings() { 366 return getStubSettingsBuilder().mutateDeployedModelOperationSettings(); 367 } 368 369 /** Returns the builder for the settings used for calls to listLocations. */ 370 public PagedCallSettings.Builder< 371 ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings()372 listLocationsSettings() { 373 return getStubSettingsBuilder().listLocationsSettings(); 374 } 375 376 /** Returns the builder for the settings used for calls to getLocation. */ getLocationSettings()377 public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() { 378 return getStubSettingsBuilder().getLocationSettings(); 379 } 380 381 /** Returns the builder for the settings used for calls to setIamPolicy. */ setIamPolicySettings()382 public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings() { 383 return getStubSettingsBuilder().setIamPolicySettings(); 384 } 385 386 /** Returns the builder for the settings used for calls to getIamPolicy. */ getIamPolicySettings()387 public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() { 388 return getStubSettingsBuilder().getIamPolicySettings(); 389 } 390 391 /** Returns the builder for the settings used for calls to testIamPermissions. */ 392 public UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsSettings()393 testIamPermissionsSettings() { 394 return getStubSettingsBuilder().testIamPermissionsSettings(); 395 } 396 397 @Override build()398 public EndpointServiceSettings build() throws IOException { 399 return new EndpointServiceSettings(this); 400 } 401 } 402 } 403