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