|
| 1 | +/* |
| 2 | + * Copyright 2024 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.v1beta1; |
| 18 | + |
| 19 | +import static com.google.cloud.aiplatform.v1beta1.EvaluationServiceClient.ListLocationsPagedResponse; |
| 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.rpc.ApiClientHeaderProvider; |
| 27 | +import com.google.api.gax.rpc.ClientContext; |
| 28 | +import com.google.api.gax.rpc.ClientSettings; |
| 29 | +import com.google.api.gax.rpc.PagedCallSettings; |
| 30 | +import com.google.api.gax.rpc.TransportChannelProvider; |
| 31 | +import com.google.api.gax.rpc.UnaryCallSettings; |
| 32 | +import com.google.cloud.aiplatform.v1beta1.stub.EvaluationServiceStubSettings; |
| 33 | +import com.google.cloud.location.GetLocationRequest; |
| 34 | +import com.google.cloud.location.ListLocationsRequest; |
| 35 | +import com.google.cloud.location.ListLocationsResponse; |
| 36 | +import com.google.cloud.location.Location; |
| 37 | +import com.google.iam.v1.GetIamPolicyRequest; |
| 38 | +import com.google.iam.v1.Policy; |
| 39 | +import com.google.iam.v1.SetIamPolicyRequest; |
| 40 | +import com.google.iam.v1.TestIamPermissionsRequest; |
| 41 | +import com.google.iam.v1.TestIamPermissionsResponse; |
| 42 | +import java.io.IOException; |
| 43 | +import java.util.List; |
| 44 | +import javax.annotation.Generated; |
| 45 | + |
| 46 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 47 | +/** |
| 48 | + * Settings class to configure an instance of {@link EvaluationServiceClient}. |
| 49 | + * |
| 50 | + * <p>The default instance has everything set to sensible defaults: |
| 51 | + * |
| 52 | + * <ul> |
| 53 | + * <li>The default service address (aiplatform.googleapis.com) and default port (443) 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 total timeout of evaluateInstances to 30 seconds: |
| 62 | + * |
| 63 | + * <pre>{@code |
| 64 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 65 | + * // It will require modifications to work: |
| 66 | + * // - It may require correct/in-range values for request initialization. |
| 67 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 68 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 69 | + * EvaluationServiceSettings.Builder evaluationServiceSettingsBuilder = |
| 70 | + * EvaluationServiceSettings.newBuilder(); |
| 71 | + * evaluationServiceSettingsBuilder |
| 72 | + * .evaluateInstancesSettings() |
| 73 | + * .setRetrySettings( |
| 74 | + * evaluationServiceSettingsBuilder |
| 75 | + * .evaluateInstancesSettings() |
| 76 | + * .getRetrySettings() |
| 77 | + * .toBuilder() |
| 78 | + * .setTotalTimeout(Duration.ofSeconds(30)) |
| 79 | + * .build()); |
| 80 | + * EvaluationServiceSettings evaluationServiceSettings = evaluationServiceSettingsBuilder.build(); |
| 81 | + * }</pre> |
| 82 | + */ |
| 83 | +@BetaApi |
| 84 | +@Generated("by gapic-generator-java") |
| 85 | +public class EvaluationServiceSettings extends ClientSettings<EvaluationServiceSettings> { |
| 86 | + |
| 87 | + /** Returns the object with the settings used for calls to evaluateInstances. */ |
| 88 | + public UnaryCallSettings<EvaluateInstancesRequest, EvaluateInstancesResponse> |
| 89 | + evaluateInstancesSettings() { |
| 90 | + return ((EvaluationServiceStubSettings) getStubSettings()).evaluateInstancesSettings(); |
| 91 | + } |
| 92 | + |
| 93 | + /** Returns the object with the settings used for calls to listLocations. */ |
| 94 | + public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> |
| 95 | + listLocationsSettings() { |
| 96 | + return ((EvaluationServiceStubSettings) getStubSettings()).listLocationsSettings(); |
| 97 | + } |
| 98 | + |
| 99 | + /** Returns the object with the settings used for calls to getLocation. */ |
| 100 | + public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() { |
| 101 | + return ((EvaluationServiceStubSettings) getStubSettings()).getLocationSettings(); |
| 102 | + } |
| 103 | + |
| 104 | + /** Returns the object with the settings used for calls to setIamPolicy. */ |
| 105 | + public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() { |
| 106 | + return ((EvaluationServiceStubSettings) getStubSettings()).setIamPolicySettings(); |
| 107 | + } |
| 108 | + |
| 109 | + /** Returns the object with the settings used for calls to getIamPolicy. */ |
| 110 | + public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() { |
| 111 | + return ((EvaluationServiceStubSettings) getStubSettings()).getIamPolicySettings(); |
| 112 | + } |
| 113 | + |
| 114 | + /** Returns the object with the settings used for calls to testIamPermissions. */ |
| 115 | + public UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse> |
| 116 | + testIamPermissionsSettings() { |
| 117 | + return ((EvaluationServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); |
| 118 | + } |
| 119 | + |
| 120 | + public static final EvaluationServiceSettings create(EvaluationServiceStubSettings stub) |
| 121 | + throws IOException { |
| 122 | + return new EvaluationServiceSettings.Builder(stub.toBuilder()).build(); |
| 123 | + } |
| 124 | + |
| 125 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 126 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 127 | + return EvaluationServiceStubSettings.defaultExecutorProviderBuilder(); |
| 128 | + } |
| 129 | + |
| 130 | + /** Returns the default service endpoint. */ |
| 131 | + public static String getDefaultEndpoint() { |
| 132 | + return EvaluationServiceStubSettings.getDefaultEndpoint(); |
| 133 | + } |
| 134 | + |
| 135 | + /** Returns the default service scopes. */ |
| 136 | + public static List<String> getDefaultServiceScopes() { |
| 137 | + return EvaluationServiceStubSettings.getDefaultServiceScopes(); |
| 138 | + } |
| 139 | + |
| 140 | + /** Returns a builder for the default credentials for this service. */ |
| 141 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 142 | + return EvaluationServiceStubSettings.defaultCredentialsProviderBuilder(); |
| 143 | + } |
| 144 | + |
| 145 | + /** Returns a builder for the default ChannelProvider for this service. */ |
| 146 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 147 | + return EvaluationServiceStubSettings.defaultGrpcTransportProviderBuilder(); |
| 148 | + } |
| 149 | + |
| 150 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 151 | + return EvaluationServiceStubSettings.defaultTransportChannelProvider(); |
| 152 | + } |
| 153 | + |
| 154 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 155 | + return EvaluationServiceStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 156 | + } |
| 157 | + |
| 158 | + /** Returns a new builder for this class. */ |
| 159 | + public static Builder newBuilder() { |
| 160 | + return Builder.createDefault(); |
| 161 | + } |
| 162 | + |
| 163 | + /** Returns a new builder for this class. */ |
| 164 | + public static Builder newBuilder(ClientContext clientContext) { |
| 165 | + return new Builder(clientContext); |
| 166 | + } |
| 167 | + |
| 168 | + /** Returns a builder containing all the values of this settings class. */ |
| 169 | + public Builder toBuilder() { |
| 170 | + return new Builder(this); |
| 171 | + } |
| 172 | + |
| 173 | + protected EvaluationServiceSettings(Builder settingsBuilder) throws IOException { |
| 174 | + super(settingsBuilder); |
| 175 | + } |
| 176 | + |
| 177 | + /** Builder for EvaluationServiceSettings. */ |
| 178 | + public static class Builder extends ClientSettings.Builder<EvaluationServiceSettings, Builder> { |
| 179 | + |
| 180 | + protected Builder() throws IOException { |
| 181 | + this(((ClientContext) null)); |
| 182 | + } |
| 183 | + |
| 184 | + protected Builder(ClientContext clientContext) { |
| 185 | + super(EvaluationServiceStubSettings.newBuilder(clientContext)); |
| 186 | + } |
| 187 | + |
| 188 | + protected Builder(EvaluationServiceSettings settings) { |
| 189 | + super(settings.getStubSettings().toBuilder()); |
| 190 | + } |
| 191 | + |
| 192 | + protected Builder(EvaluationServiceStubSettings.Builder stubSettings) { |
| 193 | + super(stubSettings); |
| 194 | + } |
| 195 | + |
| 196 | + private static Builder createDefault() { |
| 197 | + return new Builder(EvaluationServiceStubSettings.newBuilder()); |
| 198 | + } |
| 199 | + |
| 200 | + public EvaluationServiceStubSettings.Builder getStubSettingsBuilder() { |
| 201 | + return ((EvaluationServiceStubSettings.Builder) getStubSettings()); |
| 202 | + } |
| 203 | + |
| 204 | + /** |
| 205 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 206 | + * |
| 207 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 208 | + */ |
| 209 | + public Builder applyToAllUnaryMethods( |
| 210 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 211 | + super.applyToAllUnaryMethods( |
| 212 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 213 | + return this; |
| 214 | + } |
| 215 | + |
| 216 | + /** Returns the builder for the settings used for calls to evaluateInstances. */ |
| 217 | + public UnaryCallSettings.Builder<EvaluateInstancesRequest, EvaluateInstancesResponse> |
| 218 | + evaluateInstancesSettings() { |
| 219 | + return getStubSettingsBuilder().evaluateInstancesSettings(); |
| 220 | + } |
| 221 | + |
| 222 | + /** Returns the builder for the settings used for calls to listLocations. */ |
| 223 | + public PagedCallSettings.Builder< |
| 224 | + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> |
| 225 | + listLocationsSettings() { |
| 226 | + return getStubSettingsBuilder().listLocationsSettings(); |
| 227 | + } |
| 228 | + |
| 229 | + /** Returns the builder for the settings used for calls to getLocation. */ |
| 230 | + public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() { |
| 231 | + return getStubSettingsBuilder().getLocationSettings(); |
| 232 | + } |
| 233 | + |
| 234 | + /** Returns the builder for the settings used for calls to setIamPolicy. */ |
| 235 | + public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings() { |
| 236 | + return getStubSettingsBuilder().setIamPolicySettings(); |
| 237 | + } |
| 238 | + |
| 239 | + /** Returns the builder for the settings used for calls to getIamPolicy. */ |
| 240 | + public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() { |
| 241 | + return getStubSettingsBuilder().getIamPolicySettings(); |
| 242 | + } |
| 243 | + |
| 244 | + /** Returns the builder for the settings used for calls to testIamPermissions. */ |
| 245 | + public UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse> |
| 246 | + testIamPermissionsSettings() { |
| 247 | + return getStubSettingsBuilder().testIamPermissionsSettings(); |
| 248 | + } |
| 249 | + |
| 250 | + @Override |
| 251 | + public EvaluationServiceSettings build() throws IOException { |
| 252 | + return new EvaluationServiceSettings(this); |
| 253 | + } |
| 254 | + } |
| 255 | +} |
0 commit comments