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