|
| 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.GenAiTuningServiceClient.ListLocationsPagedResponse; |
| 20 | +import static com.google.cloud.aiplatform.v1beta1.GenAiTuningServiceClient.ListTuningJobsPagedResponse; |
| 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.PagedCallSettings; |
| 31 | +import com.google.api.gax.rpc.TransportChannelProvider; |
| 32 | +import com.google.api.gax.rpc.UnaryCallSettings; |
| 33 | +import com.google.cloud.aiplatform.v1beta1.stub.GenAiTuningServiceStubSettings; |
| 34 | +import com.google.cloud.location.GetLocationRequest; |
| 35 | +import com.google.cloud.location.ListLocationsRequest; |
| 36 | +import com.google.cloud.location.ListLocationsResponse; |
| 37 | +import com.google.cloud.location.Location; |
| 38 | +import com.google.iam.v1.GetIamPolicyRequest; |
| 39 | +import com.google.iam.v1.Policy; |
| 40 | +import com.google.iam.v1.SetIamPolicyRequest; |
| 41 | +import com.google.iam.v1.TestIamPermissionsRequest; |
| 42 | +import com.google.iam.v1.TestIamPermissionsResponse; |
| 43 | +import com.google.protobuf.Empty; |
| 44 | +import java.io.IOException; |
| 45 | +import java.util.List; |
| 46 | +import javax.annotation.Generated; |
| 47 | + |
| 48 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 49 | +/** |
| 50 | + * Settings class to configure an instance of {@link GenAiTuningServiceClient}. |
| 51 | + * |
| 52 | + * <p>The default instance has everything set to sensible defaults: |
| 53 | + * |
| 54 | + * <ul> |
| 55 | + * <li>The default service address (aiplatform.googleapis.com) and default port (443) are used. |
| 56 | + * <li>Credentials are acquired automatically through Application Default Credentials. |
| 57 | + * <li>Retries are configured for idempotent methods but not for non-idempotent methods. |
| 58 | + * </ul> |
| 59 | + * |
| 60 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 61 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 62 | + * |
| 63 | + * <p>For example, to set the total timeout of createTuningJob to 30 seconds: |
| 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 | + * GenAiTuningServiceSettings.Builder genAiTuningServiceSettingsBuilder = |
| 72 | + * GenAiTuningServiceSettings.newBuilder(); |
| 73 | + * genAiTuningServiceSettingsBuilder |
| 74 | + * .createTuningJobSettings() |
| 75 | + * .setRetrySettings( |
| 76 | + * genAiTuningServiceSettingsBuilder |
| 77 | + * .createTuningJobSettings() |
| 78 | + * .getRetrySettings() |
| 79 | + * .toBuilder() |
| 80 | + * .setTotalTimeout(Duration.ofSeconds(30)) |
| 81 | + * .build()); |
| 82 | + * GenAiTuningServiceSettings genAiTuningServiceSettings = |
| 83 | + * genAiTuningServiceSettingsBuilder.build(); |
| 84 | + * }</pre> |
| 85 | + */ |
| 86 | +@BetaApi |
| 87 | +@Generated("by gapic-generator-java") |
| 88 | +public class GenAiTuningServiceSettings extends ClientSettings<GenAiTuningServiceSettings> { |
| 89 | + |
| 90 | + /** Returns the object with the settings used for calls to createTuningJob. */ |
| 91 | + public UnaryCallSettings<CreateTuningJobRequest, TuningJob> createTuningJobSettings() { |
| 92 | + return ((GenAiTuningServiceStubSettings) getStubSettings()).createTuningJobSettings(); |
| 93 | + } |
| 94 | + |
| 95 | + /** Returns the object with the settings used for calls to getTuningJob. */ |
| 96 | + public UnaryCallSettings<GetTuningJobRequest, TuningJob> getTuningJobSettings() { |
| 97 | + return ((GenAiTuningServiceStubSettings) getStubSettings()).getTuningJobSettings(); |
| 98 | + } |
| 99 | + |
| 100 | + /** Returns the object with the settings used for calls to listTuningJobs. */ |
| 101 | + public PagedCallSettings< |
| 102 | + ListTuningJobsRequest, ListTuningJobsResponse, ListTuningJobsPagedResponse> |
| 103 | + listTuningJobsSettings() { |
| 104 | + return ((GenAiTuningServiceStubSettings) getStubSettings()).listTuningJobsSettings(); |
| 105 | + } |
| 106 | + |
| 107 | + /** Returns the object with the settings used for calls to cancelTuningJob. */ |
| 108 | + public UnaryCallSettings<CancelTuningJobRequest, Empty> cancelTuningJobSettings() { |
| 109 | + return ((GenAiTuningServiceStubSettings) getStubSettings()).cancelTuningJobSettings(); |
| 110 | + } |
| 111 | + |
| 112 | + /** Returns the object with the settings used for calls to listLocations. */ |
| 113 | + public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> |
| 114 | + listLocationsSettings() { |
| 115 | + return ((GenAiTuningServiceStubSettings) getStubSettings()).listLocationsSettings(); |
| 116 | + } |
| 117 | + |
| 118 | + /** Returns the object with the settings used for calls to getLocation. */ |
| 119 | + public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() { |
| 120 | + return ((GenAiTuningServiceStubSettings) getStubSettings()).getLocationSettings(); |
| 121 | + } |
| 122 | + |
| 123 | + /** Returns the object with the settings used for calls to setIamPolicy. */ |
| 124 | + public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() { |
| 125 | + return ((GenAiTuningServiceStubSettings) getStubSettings()).setIamPolicySettings(); |
| 126 | + } |
| 127 | + |
| 128 | + /** Returns the object with the settings used for calls to getIamPolicy. */ |
| 129 | + public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() { |
| 130 | + return ((GenAiTuningServiceStubSettings) getStubSettings()).getIamPolicySettings(); |
| 131 | + } |
| 132 | + |
| 133 | + /** Returns the object with the settings used for calls to testIamPermissions. */ |
| 134 | + public UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse> |
| 135 | + testIamPermissionsSettings() { |
| 136 | + return ((GenAiTuningServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); |
| 137 | + } |
| 138 | + |
| 139 | + public static final GenAiTuningServiceSettings create(GenAiTuningServiceStubSettings stub) |
| 140 | + throws IOException { |
| 141 | + return new GenAiTuningServiceSettings.Builder(stub.toBuilder()).build(); |
| 142 | + } |
| 143 | + |
| 144 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 145 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 146 | + return GenAiTuningServiceStubSettings.defaultExecutorProviderBuilder(); |
| 147 | + } |
| 148 | + |
| 149 | + /** Returns the default service endpoint. */ |
| 150 | + public static String getDefaultEndpoint() { |
| 151 | + return GenAiTuningServiceStubSettings.getDefaultEndpoint(); |
| 152 | + } |
| 153 | + |
| 154 | + /** Returns the default service scopes. */ |
| 155 | + public static List<String> getDefaultServiceScopes() { |
| 156 | + return GenAiTuningServiceStubSettings.getDefaultServiceScopes(); |
| 157 | + } |
| 158 | + |
| 159 | + /** Returns a builder for the default credentials for this service. */ |
| 160 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 161 | + return GenAiTuningServiceStubSettings.defaultCredentialsProviderBuilder(); |
| 162 | + } |
| 163 | + |
| 164 | + /** Returns a builder for the default ChannelProvider for this service. */ |
| 165 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 166 | + return GenAiTuningServiceStubSettings.defaultGrpcTransportProviderBuilder(); |
| 167 | + } |
| 168 | + |
| 169 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 170 | + return GenAiTuningServiceStubSettings.defaultTransportChannelProvider(); |
| 171 | + } |
| 172 | + |
| 173 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 174 | + return GenAiTuningServiceStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 175 | + } |
| 176 | + |
| 177 | + /** Returns a new builder for this class. */ |
| 178 | + public static Builder newBuilder() { |
| 179 | + return Builder.createDefault(); |
| 180 | + } |
| 181 | + |
| 182 | + /** Returns a new builder for this class. */ |
| 183 | + public static Builder newBuilder(ClientContext clientContext) { |
| 184 | + return new Builder(clientContext); |
| 185 | + } |
| 186 | + |
| 187 | + /** Returns a builder containing all the values of this settings class. */ |
| 188 | + public Builder toBuilder() { |
| 189 | + return new Builder(this); |
| 190 | + } |
| 191 | + |
| 192 | + protected GenAiTuningServiceSettings(Builder settingsBuilder) throws IOException { |
| 193 | + super(settingsBuilder); |
| 194 | + } |
| 195 | + |
| 196 | + /** Builder for GenAiTuningServiceSettings. */ |
| 197 | + public static class Builder extends ClientSettings.Builder<GenAiTuningServiceSettings, Builder> { |
| 198 | + |
| 199 | + protected Builder() throws IOException { |
| 200 | + this(((ClientContext) null)); |
| 201 | + } |
| 202 | + |
| 203 | + protected Builder(ClientContext clientContext) { |
| 204 | + super(GenAiTuningServiceStubSettings.newBuilder(clientContext)); |
| 205 | + } |
| 206 | + |
| 207 | + protected Builder(GenAiTuningServiceSettings settings) { |
| 208 | + super(settings.getStubSettings().toBuilder()); |
| 209 | + } |
| 210 | + |
| 211 | + protected Builder(GenAiTuningServiceStubSettings.Builder stubSettings) { |
| 212 | + super(stubSettings); |
| 213 | + } |
| 214 | + |
| 215 | + private static Builder createDefault() { |
| 216 | + return new Builder(GenAiTuningServiceStubSettings.newBuilder()); |
| 217 | + } |
| 218 | + |
| 219 | + public GenAiTuningServiceStubSettings.Builder getStubSettingsBuilder() { |
| 220 | + return ((GenAiTuningServiceStubSettings.Builder) getStubSettings()); |
| 221 | + } |
| 222 | + |
| 223 | + /** |
| 224 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 225 | + * |
| 226 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 227 | + */ |
| 228 | + public Builder applyToAllUnaryMethods( |
| 229 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 230 | + super.applyToAllUnaryMethods( |
| 231 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 232 | + return this; |
| 233 | + } |
| 234 | + |
| 235 | + /** Returns the builder for the settings used for calls to createTuningJob. */ |
| 236 | + public UnaryCallSettings.Builder<CreateTuningJobRequest, TuningJob> createTuningJobSettings() { |
| 237 | + return getStubSettingsBuilder().createTuningJobSettings(); |
| 238 | + } |
| 239 | + |
| 240 | + /** Returns the builder for the settings used for calls to getTuningJob. */ |
| 241 | + public UnaryCallSettings.Builder<GetTuningJobRequest, TuningJob> getTuningJobSettings() { |
| 242 | + return getStubSettingsBuilder().getTuningJobSettings(); |
| 243 | + } |
| 244 | + |
| 245 | + /** Returns the builder for the settings used for calls to listTuningJobs. */ |
| 246 | + public PagedCallSettings.Builder< |
| 247 | + ListTuningJobsRequest, ListTuningJobsResponse, ListTuningJobsPagedResponse> |
| 248 | + listTuningJobsSettings() { |
| 249 | + return getStubSettingsBuilder().listTuningJobsSettings(); |
| 250 | + } |
| 251 | + |
| 252 | + /** Returns the builder for the settings used for calls to cancelTuningJob. */ |
| 253 | + public UnaryCallSettings.Builder<CancelTuningJobRequest, Empty> cancelTuningJobSettings() { |
| 254 | + return getStubSettingsBuilder().cancelTuningJobSettings(); |
| 255 | + } |
| 256 | + |
| 257 | + /** Returns the builder for the settings used for calls to listLocations. */ |
| 258 | + public PagedCallSettings.Builder< |
| 259 | + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> |
| 260 | + listLocationsSettings() { |
| 261 | + return getStubSettingsBuilder().listLocationsSettings(); |
| 262 | + } |
| 263 | + |
| 264 | + /** Returns the builder for the settings used for calls to getLocation. */ |
| 265 | + public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() { |
| 266 | + return getStubSettingsBuilder().getLocationSettings(); |
| 267 | + } |
| 268 | + |
| 269 | + /** Returns the builder for the settings used for calls to setIamPolicy. */ |
| 270 | + public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings() { |
| 271 | + return getStubSettingsBuilder().setIamPolicySettings(); |
| 272 | + } |
| 273 | + |
| 274 | + /** Returns the builder for the settings used for calls to getIamPolicy. */ |
| 275 | + public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() { |
| 276 | + return getStubSettingsBuilder().getIamPolicySettings(); |
| 277 | + } |
| 278 | + |
| 279 | + /** Returns the builder for the settings used for calls to testIamPermissions. */ |
| 280 | + public UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse> |
| 281 | + testIamPermissionsSettings() { |
| 282 | + return getStubSettingsBuilder().testIamPermissionsSettings(); |
| 283 | + } |
| 284 | + |
| 285 | + @Override |
| 286 | + public GenAiTuningServiceSettings build() throws IOException { |
| 287 | + return new GenAiTuningServiceSettings(this); |
| 288 | + } |
| 289 | + } |
| 290 | +} |
0 commit comments