|
| 1 | +/* |
| 2 | + * Copyright 2020 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 | +package com.google.cloud.aiplatform.v1beta1; |
| 17 | + |
| 18 | +import static com.google.cloud.aiplatform.v1beta1.MigrationServiceClient.SearchMigratableResourcesPagedResponse; |
| 19 | + |
| 20 | +import com.google.api.core.ApiFunction; |
| 21 | +import com.google.api.core.BetaApi; |
| 22 | +import com.google.api.gax.core.GoogleCredentialsProvider; |
| 23 | +import com.google.api.gax.core.InstantiatingExecutorProvider; |
| 24 | +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; |
| 25 | +import com.google.api.gax.rpc.ApiClientHeaderProvider; |
| 26 | +import com.google.api.gax.rpc.ClientContext; |
| 27 | +import com.google.api.gax.rpc.ClientSettings; |
| 28 | +import com.google.api.gax.rpc.OperationCallSettings; |
| 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.MigrationServiceStubSettings; |
| 33 | +import com.google.longrunning.Operation; |
| 34 | +import java.io.IOException; |
| 35 | +import java.util.List; |
| 36 | +import javax.annotation.Generated; |
| 37 | + |
| 38 | +// AUTO-GENERATED DOCUMENTATION AND CLASS |
| 39 | +/** |
| 40 | + * Settings class to configure an instance of {@link MigrationServiceClient}. |
| 41 | + * |
| 42 | + * <p>The default instance has everything set to sensible defaults: |
| 43 | + * |
| 44 | + * <ul> |
| 45 | + * <li>The default service address (aiplatform.googleapis.com) and default port (443) are used. |
| 46 | + * <li>Credentials are acquired automatically through Application Default Credentials. |
| 47 | + * <li>Retries are configured for idempotent methods but not for non-idempotent methods. |
| 48 | + * </ul> |
| 49 | + * |
| 50 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 51 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 52 | + * |
| 53 | + * <p>For example, to set the total timeout of searchMigratableResources to 30 seconds: |
| 54 | + * |
| 55 | + * <pre> |
| 56 | + * <code> |
| 57 | + * MigrationServiceSettings.Builder migrationServiceSettingsBuilder = |
| 58 | + * MigrationServiceSettings.newBuilder(); |
| 59 | + * migrationServiceSettingsBuilder |
| 60 | + * .searchMigratableResourcesSettings() |
| 61 | + * .setRetrySettings( |
| 62 | + * migrationServiceSettingsBuilder.searchMigratableResourcesSettings().getRetrySettings().toBuilder() |
| 63 | + * .setTotalTimeout(Duration.ofSeconds(30)) |
| 64 | + * .build()); |
| 65 | + * MigrationServiceSettings migrationServiceSettings = migrationServiceSettingsBuilder.build(); |
| 66 | + * </code> |
| 67 | + * </pre> |
| 68 | + */ |
| 69 | +@Generated("by gapic-generator") |
| 70 | +@BetaApi |
| 71 | +public class MigrationServiceSettings extends ClientSettings<MigrationServiceSettings> { |
| 72 | + /** Returns the object with the settings used for calls to searchMigratableResources. */ |
| 73 | + public PagedCallSettings< |
| 74 | + SearchMigratableResourcesRequest, |
| 75 | + SearchMigratableResourcesResponse, |
| 76 | + SearchMigratableResourcesPagedResponse> |
| 77 | + searchMigratableResourcesSettings() { |
| 78 | + return ((MigrationServiceStubSettings) getStubSettings()).searchMigratableResourcesSettings(); |
| 79 | + } |
| 80 | + |
| 81 | + /** Returns the object with the settings used for calls to batchMigrateResources. */ |
| 82 | + public UnaryCallSettings<BatchMigrateResourcesRequest, Operation> |
| 83 | + batchMigrateResourcesSettings() { |
| 84 | + return ((MigrationServiceStubSettings) getStubSettings()).batchMigrateResourcesSettings(); |
| 85 | + } |
| 86 | + |
| 87 | + /** Returns the object with the settings used for calls to batchMigrateResources. */ |
| 88 | + @BetaApi( |
| 89 | + "The surface for long-running operations is not stable yet and may change in the future.") |
| 90 | + public OperationCallSettings< |
| 91 | + BatchMigrateResourcesRequest, |
| 92 | + BatchMigrateResourcesResponse, |
| 93 | + BatchMigrateResourcesOperationMetadata> |
| 94 | + batchMigrateResourcesOperationSettings() { |
| 95 | + return ((MigrationServiceStubSettings) getStubSettings()) |
| 96 | + .batchMigrateResourcesOperationSettings(); |
| 97 | + } |
| 98 | + |
| 99 | + public static final MigrationServiceSettings create(MigrationServiceStubSettings stub) |
| 100 | + throws IOException { |
| 101 | + return new MigrationServiceSettings.Builder(stub.toBuilder()).build(); |
| 102 | + } |
| 103 | + |
| 104 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 105 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 106 | + return MigrationServiceStubSettings.defaultExecutorProviderBuilder(); |
| 107 | + } |
| 108 | + |
| 109 | + /** Returns the default service endpoint. */ |
| 110 | + public static String getDefaultEndpoint() { |
| 111 | + return MigrationServiceStubSettings.getDefaultEndpoint(); |
| 112 | + } |
| 113 | + |
| 114 | + /** Returns the default service scopes. */ |
| 115 | + public static List<String> getDefaultServiceScopes() { |
| 116 | + return MigrationServiceStubSettings.getDefaultServiceScopes(); |
| 117 | + } |
| 118 | + |
| 119 | + /** Returns a builder for the default credentials for this service. */ |
| 120 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 121 | + return MigrationServiceStubSettings.defaultCredentialsProviderBuilder(); |
| 122 | + } |
| 123 | + |
| 124 | + /** Returns a builder for the default ChannelProvider for this service. */ |
| 125 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 126 | + return MigrationServiceStubSettings.defaultGrpcTransportProviderBuilder(); |
| 127 | + } |
| 128 | + |
| 129 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 130 | + return MigrationServiceStubSettings.defaultTransportChannelProvider(); |
| 131 | + } |
| 132 | + |
| 133 | + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") |
| 134 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 135 | + return MigrationServiceStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 136 | + } |
| 137 | + |
| 138 | + /** Returns a new builder for this class. */ |
| 139 | + public static Builder newBuilder() { |
| 140 | + return Builder.createDefault(); |
| 141 | + } |
| 142 | + |
| 143 | + /** Returns a new builder for this class. */ |
| 144 | + public static Builder newBuilder(ClientContext clientContext) { |
| 145 | + return new Builder(clientContext); |
| 146 | + } |
| 147 | + |
| 148 | + /** Returns a builder containing all the values of this settings class. */ |
| 149 | + public Builder toBuilder() { |
| 150 | + return new Builder(this); |
| 151 | + } |
| 152 | + |
| 153 | + protected MigrationServiceSettings(Builder settingsBuilder) throws IOException { |
| 154 | + super(settingsBuilder); |
| 155 | + } |
| 156 | + |
| 157 | + /** Builder for MigrationServiceSettings. */ |
| 158 | + public static class Builder extends ClientSettings.Builder<MigrationServiceSettings, Builder> { |
| 159 | + protected Builder() throws IOException { |
| 160 | + this((ClientContext) null); |
| 161 | + } |
| 162 | + |
| 163 | + protected Builder(ClientContext clientContext) { |
| 164 | + super(MigrationServiceStubSettings.newBuilder(clientContext)); |
| 165 | + } |
| 166 | + |
| 167 | + private static Builder createDefault() { |
| 168 | + return new Builder(MigrationServiceStubSettings.newBuilder()); |
| 169 | + } |
| 170 | + |
| 171 | + protected Builder(MigrationServiceSettings settings) { |
| 172 | + super(settings.getStubSettings().toBuilder()); |
| 173 | + } |
| 174 | + |
| 175 | + protected Builder(MigrationServiceStubSettings.Builder stubSettings) { |
| 176 | + super(stubSettings); |
| 177 | + } |
| 178 | + |
| 179 | + public MigrationServiceStubSettings.Builder getStubSettingsBuilder() { |
| 180 | + return ((MigrationServiceStubSettings.Builder) getStubSettings()); |
| 181 | + } |
| 182 | + |
| 183 | + // NEXT_MAJOR_VER: remove 'throws Exception' |
| 184 | + /** |
| 185 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 186 | + * |
| 187 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 188 | + */ |
| 189 | + public Builder applyToAllUnaryMethods( |
| 190 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception { |
| 191 | + super.applyToAllUnaryMethods( |
| 192 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 193 | + return this; |
| 194 | + } |
| 195 | + |
| 196 | + /** Returns the builder for the settings used for calls to searchMigratableResources. */ |
| 197 | + public PagedCallSettings.Builder< |
| 198 | + SearchMigratableResourcesRequest, |
| 199 | + SearchMigratableResourcesResponse, |
| 200 | + SearchMigratableResourcesPagedResponse> |
| 201 | + searchMigratableResourcesSettings() { |
| 202 | + return getStubSettingsBuilder().searchMigratableResourcesSettings(); |
| 203 | + } |
| 204 | + |
| 205 | + /** Returns the builder for the settings used for calls to batchMigrateResources. */ |
| 206 | + public UnaryCallSettings.Builder<BatchMigrateResourcesRequest, Operation> |
| 207 | + batchMigrateResourcesSettings() { |
| 208 | + return getStubSettingsBuilder().batchMigrateResourcesSettings(); |
| 209 | + } |
| 210 | + |
| 211 | + /** Returns the builder for the settings used for calls to batchMigrateResources. */ |
| 212 | + @BetaApi( |
| 213 | + "The surface for long-running operations is not stable yet and may change in the future.") |
| 214 | + public OperationCallSettings.Builder< |
| 215 | + BatchMigrateResourcesRequest, |
| 216 | + BatchMigrateResourcesResponse, |
| 217 | + BatchMigrateResourcesOperationMetadata> |
| 218 | + batchMigrateResourcesOperationSettings() { |
| 219 | + return getStubSettingsBuilder().batchMigrateResourcesOperationSettings(); |
| 220 | + } |
| 221 | + |
| 222 | + @Override |
| 223 | + public MigrationServiceSettings build() throws IOException { |
| 224 | + return new MigrationServiceSettings(this); |
| 225 | + } |
| 226 | + } |
| 227 | +} |
0 commit comments