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.area120.tables.v1alpha; 18 19 import static com.google.area120.tables.v1alpha.TablesServiceClient.ListRowsPagedResponse; 20 import static com.google.area120.tables.v1alpha.TablesServiceClient.ListTablesPagedResponse; 21 import static com.google.area120.tables.v1alpha.TablesServiceClient.ListWorkspacesPagedResponse; 22 23 import com.google.api.core.ApiFunction; 24 import com.google.api.core.BetaApi; 25 import com.google.api.gax.core.GoogleCredentialsProvider; 26 import com.google.api.gax.core.InstantiatingExecutorProvider; 27 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; 28 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; 29 import com.google.api.gax.rpc.ApiClientHeaderProvider; 30 import com.google.api.gax.rpc.ClientContext; 31 import com.google.api.gax.rpc.ClientSettings; 32 import com.google.api.gax.rpc.PagedCallSettings; 33 import com.google.api.gax.rpc.TransportChannelProvider; 34 import com.google.api.gax.rpc.UnaryCallSettings; 35 import com.google.area120.tables.v1alpha.stub.TablesServiceStubSettings; 36 import com.google.area120.tables.v1alpha1.BatchCreateRowsRequest; 37 import com.google.area120.tables.v1alpha1.BatchCreateRowsResponse; 38 import com.google.area120.tables.v1alpha1.BatchDeleteRowsRequest; 39 import com.google.area120.tables.v1alpha1.BatchUpdateRowsRequest; 40 import com.google.area120.tables.v1alpha1.BatchUpdateRowsResponse; 41 import com.google.area120.tables.v1alpha1.CreateRowRequest; 42 import com.google.area120.tables.v1alpha1.DeleteRowRequest; 43 import com.google.area120.tables.v1alpha1.GetRowRequest; 44 import com.google.area120.tables.v1alpha1.GetTableRequest; 45 import com.google.area120.tables.v1alpha1.GetWorkspaceRequest; 46 import com.google.area120.tables.v1alpha1.ListRowsRequest; 47 import com.google.area120.tables.v1alpha1.ListRowsResponse; 48 import com.google.area120.tables.v1alpha1.ListTablesRequest; 49 import com.google.area120.tables.v1alpha1.ListTablesResponse; 50 import com.google.area120.tables.v1alpha1.ListWorkspacesRequest; 51 import com.google.area120.tables.v1alpha1.ListWorkspacesResponse; 52 import com.google.area120.tables.v1alpha1.Row; 53 import com.google.area120.tables.v1alpha1.Table; 54 import com.google.area120.tables.v1alpha1.UpdateRowRequest; 55 import com.google.area120.tables.v1alpha1.Workspace; 56 import com.google.protobuf.Empty; 57 import java.io.IOException; 58 import java.util.List; 59 import javax.annotation.Generated; 60 61 // AUTO-GENERATED DOCUMENTATION AND CLASS. 62 /** 63 * Settings class to configure an instance of {@link TablesServiceClient}. 64 * 65 * <p>The default instance has everything set to sensible defaults: 66 * 67 * <ul> 68 * <li>The default service address (area120tables.googleapis.com) and default port (443) are used. 69 * <li>Credentials are acquired automatically through Application Default Credentials. 70 * <li>Retries are configured for idempotent methods but not for non-idempotent methods. 71 * </ul> 72 * 73 * <p>The builder of this class is recursive, so contained classes are themselves builders. When 74 * build() is called, the tree of builders is called to create the complete settings object. 75 * 76 * <p>For example, to set the total timeout of getTable to 30 seconds: 77 * 78 * <pre>{@code 79 * // This snippet has been automatically generated and should be regarded as a code template only. 80 * // It will require modifications to work: 81 * // - It may require correct/in-range values for request initialization. 82 * // - It may require specifying regional endpoints when creating the service client as shown in 83 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 84 * TablesServiceSettings.Builder tablesServiceSettingsBuilder = TablesServiceSettings.newBuilder(); 85 * tablesServiceSettingsBuilder 86 * .getTableSettings() 87 * .setRetrySettings( 88 * tablesServiceSettingsBuilder 89 * .getTableSettings() 90 * .getRetrySettings() 91 * .toBuilder() 92 * .setTotalTimeout(Duration.ofSeconds(30)) 93 * .build()); 94 * TablesServiceSettings tablesServiceSettings = tablesServiceSettingsBuilder.build(); 95 * }</pre> 96 */ 97 @BetaApi 98 @Generated("by gapic-generator-java") 99 public class TablesServiceSettings extends ClientSettings<TablesServiceSettings> { 100 101 /** Returns the object with the settings used for calls to getTable. */ getTableSettings()102 public UnaryCallSettings<GetTableRequest, Table> getTableSettings() { 103 return ((TablesServiceStubSettings) getStubSettings()).getTableSettings(); 104 } 105 106 /** Returns the object with the settings used for calls to listTables. */ 107 public PagedCallSettings<ListTablesRequest, ListTablesResponse, ListTablesPagedResponse> listTablesSettings()108 listTablesSettings() { 109 return ((TablesServiceStubSettings) getStubSettings()).listTablesSettings(); 110 } 111 112 /** Returns the object with the settings used for calls to getWorkspace. */ getWorkspaceSettings()113 public UnaryCallSettings<GetWorkspaceRequest, Workspace> getWorkspaceSettings() { 114 return ((TablesServiceStubSettings) getStubSettings()).getWorkspaceSettings(); 115 } 116 117 /** Returns the object with the settings used for calls to listWorkspaces. */ 118 public PagedCallSettings< 119 ListWorkspacesRequest, ListWorkspacesResponse, ListWorkspacesPagedResponse> listWorkspacesSettings()120 listWorkspacesSettings() { 121 return ((TablesServiceStubSettings) getStubSettings()).listWorkspacesSettings(); 122 } 123 124 /** Returns the object with the settings used for calls to getRow. */ getRowSettings()125 public UnaryCallSettings<GetRowRequest, Row> getRowSettings() { 126 return ((TablesServiceStubSettings) getStubSettings()).getRowSettings(); 127 } 128 129 /** Returns the object with the settings used for calls to listRows. */ 130 public PagedCallSettings<ListRowsRequest, ListRowsResponse, ListRowsPagedResponse> listRowsSettings()131 listRowsSettings() { 132 return ((TablesServiceStubSettings) getStubSettings()).listRowsSettings(); 133 } 134 135 /** Returns the object with the settings used for calls to createRow. */ createRowSettings()136 public UnaryCallSettings<CreateRowRequest, Row> createRowSettings() { 137 return ((TablesServiceStubSettings) getStubSettings()).createRowSettings(); 138 } 139 140 /** Returns the object with the settings used for calls to batchCreateRows. */ 141 public UnaryCallSettings<BatchCreateRowsRequest, BatchCreateRowsResponse> batchCreateRowsSettings()142 batchCreateRowsSettings() { 143 return ((TablesServiceStubSettings) getStubSettings()).batchCreateRowsSettings(); 144 } 145 146 /** Returns the object with the settings used for calls to updateRow. */ updateRowSettings()147 public UnaryCallSettings<UpdateRowRequest, Row> updateRowSettings() { 148 return ((TablesServiceStubSettings) getStubSettings()).updateRowSettings(); 149 } 150 151 /** Returns the object with the settings used for calls to batchUpdateRows. */ 152 public UnaryCallSettings<BatchUpdateRowsRequest, BatchUpdateRowsResponse> batchUpdateRowsSettings()153 batchUpdateRowsSettings() { 154 return ((TablesServiceStubSettings) getStubSettings()).batchUpdateRowsSettings(); 155 } 156 157 /** Returns the object with the settings used for calls to deleteRow. */ deleteRowSettings()158 public UnaryCallSettings<DeleteRowRequest, Empty> deleteRowSettings() { 159 return ((TablesServiceStubSettings) getStubSettings()).deleteRowSettings(); 160 } 161 162 /** Returns the object with the settings used for calls to batchDeleteRows. */ batchDeleteRowsSettings()163 public UnaryCallSettings<BatchDeleteRowsRequest, Empty> batchDeleteRowsSettings() { 164 return ((TablesServiceStubSettings) getStubSettings()).batchDeleteRowsSettings(); 165 } 166 create(TablesServiceStubSettings stub)167 public static final TablesServiceSettings create(TablesServiceStubSettings stub) 168 throws IOException { 169 return new TablesServiceSettings.Builder(stub.toBuilder()).build(); 170 } 171 172 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()173 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 174 return TablesServiceStubSettings.defaultExecutorProviderBuilder(); 175 } 176 177 /** Returns the default service endpoint. */ getDefaultEndpoint()178 public static String getDefaultEndpoint() { 179 return TablesServiceStubSettings.getDefaultEndpoint(); 180 } 181 182 /** Returns the default service scopes. */ getDefaultServiceScopes()183 public static List<String> getDefaultServiceScopes() { 184 return TablesServiceStubSettings.getDefaultServiceScopes(); 185 } 186 187 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()188 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 189 return TablesServiceStubSettings.defaultCredentialsProviderBuilder(); 190 } 191 192 /** Returns a builder for the default gRPC ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()193 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 194 return TablesServiceStubSettings.defaultGrpcTransportProviderBuilder(); 195 } 196 197 /** Returns a builder for the default REST ChannelProvider for this service. */ 198 @BetaApi 199 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()200 defaultHttpJsonTransportProviderBuilder() { 201 return TablesServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); 202 } 203 defaultTransportChannelProvider()204 public static TransportChannelProvider defaultTransportChannelProvider() { 205 return TablesServiceStubSettings.defaultTransportChannelProvider(); 206 } 207 208 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()209 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 210 return TablesServiceStubSettings.defaultApiClientHeaderProviderBuilder(); 211 } 212 213 /** Returns a new gRPC builder for this class. */ newBuilder()214 public static Builder newBuilder() { 215 return Builder.createDefault(); 216 } 217 218 /** Returns a new REST builder for this class. */ 219 @BetaApi newHttpJsonBuilder()220 public static Builder newHttpJsonBuilder() { 221 return Builder.createHttpJsonDefault(); 222 } 223 224 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)225 public static Builder newBuilder(ClientContext clientContext) { 226 return new Builder(clientContext); 227 } 228 229 /** Returns a builder containing all the values of this settings class. */ toBuilder()230 public Builder toBuilder() { 231 return new Builder(this); 232 } 233 TablesServiceSettings(Builder settingsBuilder)234 protected TablesServiceSettings(Builder settingsBuilder) throws IOException { 235 super(settingsBuilder); 236 } 237 238 /** Builder for TablesServiceSettings. */ 239 public static class Builder extends ClientSettings.Builder<TablesServiceSettings, Builder> { 240 Builder()241 protected Builder() throws IOException { 242 this(((ClientContext) null)); 243 } 244 Builder(ClientContext clientContext)245 protected Builder(ClientContext clientContext) { 246 super(TablesServiceStubSettings.newBuilder(clientContext)); 247 } 248 Builder(TablesServiceSettings settings)249 protected Builder(TablesServiceSettings settings) { 250 super(settings.getStubSettings().toBuilder()); 251 } 252 Builder(TablesServiceStubSettings.Builder stubSettings)253 protected Builder(TablesServiceStubSettings.Builder stubSettings) { 254 super(stubSettings); 255 } 256 createDefault()257 private static Builder createDefault() { 258 return new Builder(TablesServiceStubSettings.newBuilder()); 259 } 260 261 @BetaApi createHttpJsonDefault()262 private static Builder createHttpJsonDefault() { 263 return new Builder(TablesServiceStubSettings.newHttpJsonBuilder()); 264 } 265 getStubSettingsBuilder()266 public TablesServiceStubSettings.Builder getStubSettingsBuilder() { 267 return ((TablesServiceStubSettings.Builder) getStubSettings()); 268 } 269 270 /** 271 * Applies the given settings updater function to all of the unary API methods in this service. 272 * 273 * <p>Note: This method does not support applying settings to streaming methods. 274 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)275 public Builder applyToAllUnaryMethods( 276 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 277 super.applyToAllUnaryMethods( 278 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 279 return this; 280 } 281 282 /** Returns the builder for the settings used for calls to getTable. */ getTableSettings()283 public UnaryCallSettings.Builder<GetTableRequest, Table> getTableSettings() { 284 return getStubSettingsBuilder().getTableSettings(); 285 } 286 287 /** Returns the builder for the settings used for calls to listTables. */ 288 public PagedCallSettings.Builder<ListTablesRequest, ListTablesResponse, ListTablesPagedResponse> listTablesSettings()289 listTablesSettings() { 290 return getStubSettingsBuilder().listTablesSettings(); 291 } 292 293 /** Returns the builder for the settings used for calls to getWorkspace. */ getWorkspaceSettings()294 public UnaryCallSettings.Builder<GetWorkspaceRequest, Workspace> getWorkspaceSettings() { 295 return getStubSettingsBuilder().getWorkspaceSettings(); 296 } 297 298 /** Returns the builder for the settings used for calls to listWorkspaces. */ 299 public PagedCallSettings.Builder< 300 ListWorkspacesRequest, ListWorkspacesResponse, ListWorkspacesPagedResponse> listWorkspacesSettings()301 listWorkspacesSettings() { 302 return getStubSettingsBuilder().listWorkspacesSettings(); 303 } 304 305 /** Returns the builder for the settings used for calls to getRow. */ getRowSettings()306 public UnaryCallSettings.Builder<GetRowRequest, Row> getRowSettings() { 307 return getStubSettingsBuilder().getRowSettings(); 308 } 309 310 /** Returns the builder for the settings used for calls to listRows. */ 311 public PagedCallSettings.Builder<ListRowsRequest, ListRowsResponse, ListRowsPagedResponse> listRowsSettings()312 listRowsSettings() { 313 return getStubSettingsBuilder().listRowsSettings(); 314 } 315 316 /** Returns the builder for the settings used for calls to createRow. */ createRowSettings()317 public UnaryCallSettings.Builder<CreateRowRequest, Row> createRowSettings() { 318 return getStubSettingsBuilder().createRowSettings(); 319 } 320 321 /** Returns the builder for the settings used for calls to batchCreateRows. */ 322 public UnaryCallSettings.Builder<BatchCreateRowsRequest, BatchCreateRowsResponse> batchCreateRowsSettings()323 batchCreateRowsSettings() { 324 return getStubSettingsBuilder().batchCreateRowsSettings(); 325 } 326 327 /** Returns the builder for the settings used for calls to updateRow. */ updateRowSettings()328 public UnaryCallSettings.Builder<UpdateRowRequest, Row> updateRowSettings() { 329 return getStubSettingsBuilder().updateRowSettings(); 330 } 331 332 /** Returns the builder for the settings used for calls to batchUpdateRows. */ 333 public UnaryCallSettings.Builder<BatchUpdateRowsRequest, BatchUpdateRowsResponse> batchUpdateRowsSettings()334 batchUpdateRowsSettings() { 335 return getStubSettingsBuilder().batchUpdateRowsSettings(); 336 } 337 338 /** Returns the builder for the settings used for calls to deleteRow. */ deleteRowSettings()339 public UnaryCallSettings.Builder<DeleteRowRequest, Empty> deleteRowSettings() { 340 return getStubSettingsBuilder().deleteRowSettings(); 341 } 342 343 /** Returns the builder for the settings used for calls to batchDeleteRows. */ batchDeleteRowsSettings()344 public UnaryCallSettings.Builder<BatchDeleteRowsRequest, Empty> batchDeleteRowsSettings() { 345 return getStubSettingsBuilder().batchDeleteRowsSettings(); 346 } 347 348 @Override build()349 public TablesServiceSettings build() throws IOException { 350 return new TablesServiceSettings(this); 351 } 352 } 353 } 354