• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.osconfig.v1.stub;
18 
19 import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchDeploymentsPagedResponse;
20 import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse;
21 import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchJobsPagedResponse;
22 
23 import com.google.api.gax.core.BackgroundResource;
24 import com.google.api.gax.core.BackgroundResourceAggregation;
25 import com.google.api.gax.grpc.GrpcCallSettings;
26 import com.google.api.gax.grpc.GrpcStubCallableFactory;
27 import com.google.api.gax.rpc.ClientContext;
28 import com.google.api.gax.rpc.UnaryCallable;
29 import com.google.cloud.osconfig.v1.PatchDeployments;
30 import com.google.cloud.osconfig.v1.PatchJobs;
31 import com.google.common.collect.ImmutableMap;
32 import com.google.longrunning.stub.GrpcOperationsStub;
33 import com.google.protobuf.Empty;
34 import io.grpc.MethodDescriptor;
35 import io.grpc.protobuf.ProtoUtils;
36 import java.io.IOException;
37 import java.util.concurrent.TimeUnit;
38 import javax.annotation.Generated;
39 
40 // AUTO-GENERATED DOCUMENTATION AND CLASS.
41 /**
42  * gRPC stub implementation for the OsConfigService service API.
43  *
44  * <p>This class is for advanced usage and reflects the underlying API directly.
45  */
46 @Generated("by gapic-generator-java")
47 public class GrpcOsConfigServiceStub extends OsConfigServiceStub {
48   private static final MethodDescriptor<PatchJobs.ExecutePatchJobRequest, PatchJobs.PatchJob>
49       executePatchJobMethodDescriptor =
50           MethodDescriptor.<PatchJobs.ExecutePatchJobRequest, PatchJobs.PatchJob>newBuilder()
51               .setType(MethodDescriptor.MethodType.UNARY)
52               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/ExecutePatchJob")
53               .setRequestMarshaller(
54                   ProtoUtils.marshaller(PatchJobs.ExecutePatchJobRequest.getDefaultInstance()))
55               .setResponseMarshaller(ProtoUtils.marshaller(PatchJobs.PatchJob.getDefaultInstance()))
56               .build();
57 
58   private static final MethodDescriptor<PatchJobs.GetPatchJobRequest, PatchJobs.PatchJob>
59       getPatchJobMethodDescriptor =
60           MethodDescriptor.<PatchJobs.GetPatchJobRequest, PatchJobs.PatchJob>newBuilder()
61               .setType(MethodDescriptor.MethodType.UNARY)
62               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/GetPatchJob")
63               .setRequestMarshaller(
64                   ProtoUtils.marshaller(PatchJobs.GetPatchJobRequest.getDefaultInstance()))
65               .setResponseMarshaller(ProtoUtils.marshaller(PatchJobs.PatchJob.getDefaultInstance()))
66               .build();
67 
68   private static final MethodDescriptor<PatchJobs.CancelPatchJobRequest, PatchJobs.PatchJob>
69       cancelPatchJobMethodDescriptor =
70           MethodDescriptor.<PatchJobs.CancelPatchJobRequest, PatchJobs.PatchJob>newBuilder()
71               .setType(MethodDescriptor.MethodType.UNARY)
72               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/CancelPatchJob")
73               .setRequestMarshaller(
74                   ProtoUtils.marshaller(PatchJobs.CancelPatchJobRequest.getDefaultInstance()))
75               .setResponseMarshaller(ProtoUtils.marshaller(PatchJobs.PatchJob.getDefaultInstance()))
76               .build();
77 
78   private static final MethodDescriptor<
79           PatchJobs.ListPatchJobsRequest, PatchJobs.ListPatchJobsResponse>
80       listPatchJobsMethodDescriptor =
81           MethodDescriptor
82               .<PatchJobs.ListPatchJobsRequest, PatchJobs.ListPatchJobsResponse>newBuilder()
83               .setType(MethodDescriptor.MethodType.UNARY)
84               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/ListPatchJobs")
85               .setRequestMarshaller(
86                   ProtoUtils.marshaller(PatchJobs.ListPatchJobsRequest.getDefaultInstance()))
87               .setResponseMarshaller(
88                   ProtoUtils.marshaller(PatchJobs.ListPatchJobsResponse.getDefaultInstance()))
89               .build();
90 
91   private static final MethodDescriptor<
92           PatchJobs.ListPatchJobInstanceDetailsRequest,
93           PatchJobs.ListPatchJobInstanceDetailsResponse>
94       listPatchJobInstanceDetailsMethodDescriptor =
95           MethodDescriptor
96               .<PatchJobs.ListPatchJobInstanceDetailsRequest,
97                   PatchJobs.ListPatchJobInstanceDetailsResponse>
98                   newBuilder()
99               .setType(MethodDescriptor.MethodType.UNARY)
100               .setFullMethodName(
101                   "google.cloud.osconfig.v1.OsConfigService/ListPatchJobInstanceDetails")
102               .setRequestMarshaller(
103                   ProtoUtils.marshaller(
104                       PatchJobs.ListPatchJobInstanceDetailsRequest.getDefaultInstance()))
105               .setResponseMarshaller(
106                   ProtoUtils.marshaller(
107                       PatchJobs.ListPatchJobInstanceDetailsResponse.getDefaultInstance()))
108               .build();
109 
110   private static final MethodDescriptor<
111           PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
112       createPatchDeploymentMethodDescriptor =
113           MethodDescriptor
114               .<PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
115                   newBuilder()
116               .setType(MethodDescriptor.MethodType.UNARY)
117               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/CreatePatchDeployment")
118               .setRequestMarshaller(
119                   ProtoUtils.marshaller(
120                       PatchDeployments.CreatePatchDeploymentRequest.getDefaultInstance()))
121               .setResponseMarshaller(
122                   ProtoUtils.marshaller(PatchDeployments.PatchDeployment.getDefaultInstance()))
123               .build();
124 
125   private static final MethodDescriptor<
126           PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment>
127       getPatchDeploymentMethodDescriptor =
128           MethodDescriptor
129               .<PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment>
130                   newBuilder()
131               .setType(MethodDescriptor.MethodType.UNARY)
132               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/GetPatchDeployment")
133               .setRequestMarshaller(
134                   ProtoUtils.marshaller(
135                       PatchDeployments.GetPatchDeploymentRequest.getDefaultInstance()))
136               .setResponseMarshaller(
137                   ProtoUtils.marshaller(PatchDeployments.PatchDeployment.getDefaultInstance()))
138               .build();
139 
140   private static final MethodDescriptor<
141           PatchDeployments.ListPatchDeploymentsRequest,
142           PatchDeployments.ListPatchDeploymentsResponse>
143       listPatchDeploymentsMethodDescriptor =
144           MethodDescriptor
145               .<PatchDeployments.ListPatchDeploymentsRequest,
146                   PatchDeployments.ListPatchDeploymentsResponse>
147                   newBuilder()
148               .setType(MethodDescriptor.MethodType.UNARY)
149               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/ListPatchDeployments")
150               .setRequestMarshaller(
151                   ProtoUtils.marshaller(
152                       PatchDeployments.ListPatchDeploymentsRequest.getDefaultInstance()))
153               .setResponseMarshaller(
154                   ProtoUtils.marshaller(
155                       PatchDeployments.ListPatchDeploymentsResponse.getDefaultInstance()))
156               .build();
157 
158   private static final MethodDescriptor<PatchDeployments.DeletePatchDeploymentRequest, Empty>
159       deletePatchDeploymentMethodDescriptor =
160           MethodDescriptor.<PatchDeployments.DeletePatchDeploymentRequest, Empty>newBuilder()
161               .setType(MethodDescriptor.MethodType.UNARY)
162               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/DeletePatchDeployment")
163               .setRequestMarshaller(
164                   ProtoUtils.marshaller(
165                       PatchDeployments.DeletePatchDeploymentRequest.getDefaultInstance()))
166               .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
167               .build();
168 
169   private static final MethodDescriptor<
170           PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
171       updatePatchDeploymentMethodDescriptor =
172           MethodDescriptor
173               .<PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
174                   newBuilder()
175               .setType(MethodDescriptor.MethodType.UNARY)
176               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/UpdatePatchDeployment")
177               .setRequestMarshaller(
178                   ProtoUtils.marshaller(
179                       PatchDeployments.UpdatePatchDeploymentRequest.getDefaultInstance()))
180               .setResponseMarshaller(
181                   ProtoUtils.marshaller(PatchDeployments.PatchDeployment.getDefaultInstance()))
182               .build();
183 
184   private static final MethodDescriptor<
185           PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment>
186       pausePatchDeploymentMethodDescriptor =
187           MethodDescriptor
188               .<PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment>
189                   newBuilder()
190               .setType(MethodDescriptor.MethodType.UNARY)
191               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/PausePatchDeployment")
192               .setRequestMarshaller(
193                   ProtoUtils.marshaller(
194                       PatchDeployments.PausePatchDeploymentRequest.getDefaultInstance()))
195               .setResponseMarshaller(
196                   ProtoUtils.marshaller(PatchDeployments.PatchDeployment.getDefaultInstance()))
197               .build();
198 
199   private static final MethodDescriptor<
200           PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment>
201       resumePatchDeploymentMethodDescriptor =
202           MethodDescriptor
203               .<PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment>
204                   newBuilder()
205               .setType(MethodDescriptor.MethodType.UNARY)
206               .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/ResumePatchDeployment")
207               .setRequestMarshaller(
208                   ProtoUtils.marshaller(
209                       PatchDeployments.ResumePatchDeploymentRequest.getDefaultInstance()))
210               .setResponseMarshaller(
211                   ProtoUtils.marshaller(PatchDeployments.PatchDeployment.getDefaultInstance()))
212               .build();
213 
214   private final UnaryCallable<PatchJobs.ExecutePatchJobRequest, PatchJobs.PatchJob>
215       executePatchJobCallable;
216   private final UnaryCallable<PatchJobs.GetPatchJobRequest, PatchJobs.PatchJob> getPatchJobCallable;
217   private final UnaryCallable<PatchJobs.CancelPatchJobRequest, PatchJobs.PatchJob>
218       cancelPatchJobCallable;
219   private final UnaryCallable<PatchJobs.ListPatchJobsRequest, PatchJobs.ListPatchJobsResponse>
220       listPatchJobsCallable;
221   private final UnaryCallable<PatchJobs.ListPatchJobsRequest, ListPatchJobsPagedResponse>
222       listPatchJobsPagedCallable;
223   private final UnaryCallable<
224           PatchJobs.ListPatchJobInstanceDetailsRequest,
225           PatchJobs.ListPatchJobInstanceDetailsResponse>
226       listPatchJobInstanceDetailsCallable;
227   private final UnaryCallable<
228           PatchJobs.ListPatchJobInstanceDetailsRequest, ListPatchJobInstanceDetailsPagedResponse>
229       listPatchJobInstanceDetailsPagedCallable;
230   private final UnaryCallable<
231           PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
232       createPatchDeploymentCallable;
233   private final UnaryCallable<
234           PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment>
235       getPatchDeploymentCallable;
236   private final UnaryCallable<
237           PatchDeployments.ListPatchDeploymentsRequest,
238           PatchDeployments.ListPatchDeploymentsResponse>
239       listPatchDeploymentsCallable;
240   private final UnaryCallable<
241           PatchDeployments.ListPatchDeploymentsRequest, ListPatchDeploymentsPagedResponse>
242       listPatchDeploymentsPagedCallable;
243   private final UnaryCallable<PatchDeployments.DeletePatchDeploymentRequest, Empty>
244       deletePatchDeploymentCallable;
245   private final UnaryCallable<
246           PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
247       updatePatchDeploymentCallable;
248   private final UnaryCallable<
249           PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment>
250       pausePatchDeploymentCallable;
251   private final UnaryCallable<
252           PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment>
253       resumePatchDeploymentCallable;
254 
255   private final BackgroundResource backgroundResources;
256   private final GrpcOperationsStub operationsStub;
257   private final GrpcStubCallableFactory callableFactory;
258 
create(OsConfigServiceStubSettings settings)259   public static final GrpcOsConfigServiceStub create(OsConfigServiceStubSettings settings)
260       throws IOException {
261     return new GrpcOsConfigServiceStub(settings, ClientContext.create(settings));
262   }
263 
create(ClientContext clientContext)264   public static final GrpcOsConfigServiceStub create(ClientContext clientContext)
265       throws IOException {
266     return new GrpcOsConfigServiceStub(
267         OsConfigServiceStubSettings.newBuilder().build(), clientContext);
268   }
269 
create( ClientContext clientContext, GrpcStubCallableFactory callableFactory)270   public static final GrpcOsConfigServiceStub create(
271       ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
272     return new GrpcOsConfigServiceStub(
273         OsConfigServiceStubSettings.newBuilder().build(), clientContext, callableFactory);
274   }
275 
276   /**
277    * Constructs an instance of GrpcOsConfigServiceStub, using the given settings. This is protected
278    * so that it is easy to make a subclass, but otherwise, the static factory methods should be
279    * preferred.
280    */
GrpcOsConfigServiceStub( OsConfigServiceStubSettings settings, ClientContext clientContext)281   protected GrpcOsConfigServiceStub(
282       OsConfigServiceStubSettings settings, ClientContext clientContext) throws IOException {
283     this(settings, clientContext, new GrpcOsConfigServiceCallableFactory());
284   }
285 
286   /**
287    * Constructs an instance of GrpcOsConfigServiceStub, using the given settings. This is protected
288    * so that it is easy to make a subclass, but otherwise, the static factory methods should be
289    * preferred.
290    */
GrpcOsConfigServiceStub( OsConfigServiceStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory)291   protected GrpcOsConfigServiceStub(
292       OsConfigServiceStubSettings settings,
293       ClientContext clientContext,
294       GrpcStubCallableFactory callableFactory)
295       throws IOException {
296     this.callableFactory = callableFactory;
297     this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
298 
299     GrpcCallSettings<PatchJobs.ExecutePatchJobRequest, PatchJobs.PatchJob>
300         executePatchJobTransportSettings =
301             GrpcCallSettings.<PatchJobs.ExecutePatchJobRequest, PatchJobs.PatchJob>newBuilder()
302                 .setMethodDescriptor(executePatchJobMethodDescriptor)
303                 .setParamsExtractor(
304                     request -> {
305                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
306                       params.put("parent", String.valueOf(request.getParent()));
307                       return params.build();
308                     })
309                 .build();
310     GrpcCallSettings<PatchJobs.GetPatchJobRequest, PatchJobs.PatchJob>
311         getPatchJobTransportSettings =
312             GrpcCallSettings.<PatchJobs.GetPatchJobRequest, PatchJobs.PatchJob>newBuilder()
313                 .setMethodDescriptor(getPatchJobMethodDescriptor)
314                 .setParamsExtractor(
315                     request -> {
316                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
317                       params.put("name", String.valueOf(request.getName()));
318                       return params.build();
319                     })
320                 .build();
321     GrpcCallSettings<PatchJobs.CancelPatchJobRequest, PatchJobs.PatchJob>
322         cancelPatchJobTransportSettings =
323             GrpcCallSettings.<PatchJobs.CancelPatchJobRequest, PatchJobs.PatchJob>newBuilder()
324                 .setMethodDescriptor(cancelPatchJobMethodDescriptor)
325                 .setParamsExtractor(
326                     request -> {
327                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
328                       params.put("name", String.valueOf(request.getName()));
329                       return params.build();
330                     })
331                 .build();
332     GrpcCallSettings<PatchJobs.ListPatchJobsRequest, PatchJobs.ListPatchJobsResponse>
333         listPatchJobsTransportSettings =
334             GrpcCallSettings
335                 .<PatchJobs.ListPatchJobsRequest, PatchJobs.ListPatchJobsResponse>newBuilder()
336                 .setMethodDescriptor(listPatchJobsMethodDescriptor)
337                 .setParamsExtractor(
338                     request -> {
339                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
340                       params.put("parent", String.valueOf(request.getParent()));
341                       return params.build();
342                     })
343                 .build();
344     GrpcCallSettings<
345             PatchJobs.ListPatchJobInstanceDetailsRequest,
346             PatchJobs.ListPatchJobInstanceDetailsResponse>
347         listPatchJobInstanceDetailsTransportSettings =
348             GrpcCallSettings
349                 .<PatchJobs.ListPatchJobInstanceDetailsRequest,
350                     PatchJobs.ListPatchJobInstanceDetailsResponse>
351                     newBuilder()
352                 .setMethodDescriptor(listPatchJobInstanceDetailsMethodDescriptor)
353                 .setParamsExtractor(
354                     request -> {
355                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
356                       params.put("parent", String.valueOf(request.getParent()));
357                       return params.build();
358                     })
359                 .build();
360     GrpcCallSettings<
361             PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
362         createPatchDeploymentTransportSettings =
363             GrpcCallSettings
364                 .<PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
365                     newBuilder()
366                 .setMethodDescriptor(createPatchDeploymentMethodDescriptor)
367                 .setParamsExtractor(
368                     request -> {
369                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
370                       params.put("parent", String.valueOf(request.getParent()));
371                       return params.build();
372                     })
373                 .build();
374     GrpcCallSettings<PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment>
375         getPatchDeploymentTransportSettings =
376             GrpcCallSettings
377                 .<PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment>
378                     newBuilder()
379                 .setMethodDescriptor(getPatchDeploymentMethodDescriptor)
380                 .setParamsExtractor(
381                     request -> {
382                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
383                       params.put("name", String.valueOf(request.getName()));
384                       return params.build();
385                     })
386                 .build();
387     GrpcCallSettings<
388             PatchDeployments.ListPatchDeploymentsRequest,
389             PatchDeployments.ListPatchDeploymentsResponse>
390         listPatchDeploymentsTransportSettings =
391             GrpcCallSettings
392                 .<PatchDeployments.ListPatchDeploymentsRequest,
393                     PatchDeployments.ListPatchDeploymentsResponse>
394                     newBuilder()
395                 .setMethodDescriptor(listPatchDeploymentsMethodDescriptor)
396                 .setParamsExtractor(
397                     request -> {
398                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
399                       params.put("parent", String.valueOf(request.getParent()));
400                       return params.build();
401                     })
402                 .build();
403     GrpcCallSettings<PatchDeployments.DeletePatchDeploymentRequest, Empty>
404         deletePatchDeploymentTransportSettings =
405             GrpcCallSettings.<PatchDeployments.DeletePatchDeploymentRequest, Empty>newBuilder()
406                 .setMethodDescriptor(deletePatchDeploymentMethodDescriptor)
407                 .setParamsExtractor(
408                     request -> {
409                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
410                       params.put("name", String.valueOf(request.getName()));
411                       return params.build();
412                     })
413                 .build();
414     GrpcCallSettings<
415             PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
416         updatePatchDeploymentTransportSettings =
417             GrpcCallSettings
418                 .<PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
419                     newBuilder()
420                 .setMethodDescriptor(updatePatchDeploymentMethodDescriptor)
421                 .setParamsExtractor(
422                     request -> {
423                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
424                       params.put(
425                           "patch_deployment.name",
426                           String.valueOf(request.getPatchDeployment().getName()));
427                       return params.build();
428                     })
429                 .build();
430     GrpcCallSettings<PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment>
431         pausePatchDeploymentTransportSettings =
432             GrpcCallSettings
433                 .<PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment>
434                     newBuilder()
435                 .setMethodDescriptor(pausePatchDeploymentMethodDescriptor)
436                 .setParamsExtractor(
437                     request -> {
438                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
439                       params.put("name", String.valueOf(request.getName()));
440                       return params.build();
441                     })
442                 .build();
443     GrpcCallSettings<
444             PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment>
445         resumePatchDeploymentTransportSettings =
446             GrpcCallSettings
447                 .<PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment>
448                     newBuilder()
449                 .setMethodDescriptor(resumePatchDeploymentMethodDescriptor)
450                 .setParamsExtractor(
451                     request -> {
452                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
453                       params.put("name", String.valueOf(request.getName()));
454                       return params.build();
455                     })
456                 .build();
457 
458     this.executePatchJobCallable =
459         callableFactory.createUnaryCallable(
460             executePatchJobTransportSettings, settings.executePatchJobSettings(), clientContext);
461     this.getPatchJobCallable =
462         callableFactory.createUnaryCallable(
463             getPatchJobTransportSettings, settings.getPatchJobSettings(), clientContext);
464     this.cancelPatchJobCallable =
465         callableFactory.createUnaryCallable(
466             cancelPatchJobTransportSettings, settings.cancelPatchJobSettings(), clientContext);
467     this.listPatchJobsCallable =
468         callableFactory.createUnaryCallable(
469             listPatchJobsTransportSettings, settings.listPatchJobsSettings(), clientContext);
470     this.listPatchJobsPagedCallable =
471         callableFactory.createPagedCallable(
472             listPatchJobsTransportSettings, settings.listPatchJobsSettings(), clientContext);
473     this.listPatchJobInstanceDetailsCallable =
474         callableFactory.createUnaryCallable(
475             listPatchJobInstanceDetailsTransportSettings,
476             settings.listPatchJobInstanceDetailsSettings(),
477             clientContext);
478     this.listPatchJobInstanceDetailsPagedCallable =
479         callableFactory.createPagedCallable(
480             listPatchJobInstanceDetailsTransportSettings,
481             settings.listPatchJobInstanceDetailsSettings(),
482             clientContext);
483     this.createPatchDeploymentCallable =
484         callableFactory.createUnaryCallable(
485             createPatchDeploymentTransportSettings,
486             settings.createPatchDeploymentSettings(),
487             clientContext);
488     this.getPatchDeploymentCallable =
489         callableFactory.createUnaryCallable(
490             getPatchDeploymentTransportSettings,
491             settings.getPatchDeploymentSettings(),
492             clientContext);
493     this.listPatchDeploymentsCallable =
494         callableFactory.createUnaryCallable(
495             listPatchDeploymentsTransportSettings,
496             settings.listPatchDeploymentsSettings(),
497             clientContext);
498     this.listPatchDeploymentsPagedCallable =
499         callableFactory.createPagedCallable(
500             listPatchDeploymentsTransportSettings,
501             settings.listPatchDeploymentsSettings(),
502             clientContext);
503     this.deletePatchDeploymentCallable =
504         callableFactory.createUnaryCallable(
505             deletePatchDeploymentTransportSettings,
506             settings.deletePatchDeploymentSettings(),
507             clientContext);
508     this.updatePatchDeploymentCallable =
509         callableFactory.createUnaryCallable(
510             updatePatchDeploymentTransportSettings,
511             settings.updatePatchDeploymentSettings(),
512             clientContext);
513     this.pausePatchDeploymentCallable =
514         callableFactory.createUnaryCallable(
515             pausePatchDeploymentTransportSettings,
516             settings.pausePatchDeploymentSettings(),
517             clientContext);
518     this.resumePatchDeploymentCallable =
519         callableFactory.createUnaryCallable(
520             resumePatchDeploymentTransportSettings,
521             settings.resumePatchDeploymentSettings(),
522             clientContext);
523 
524     this.backgroundResources =
525         new BackgroundResourceAggregation(clientContext.getBackgroundResources());
526   }
527 
getOperationsStub()528   public GrpcOperationsStub getOperationsStub() {
529     return operationsStub;
530   }
531 
532   @Override
533   public UnaryCallable<PatchJobs.ExecutePatchJobRequest, PatchJobs.PatchJob>
executePatchJobCallable()534       executePatchJobCallable() {
535     return executePatchJobCallable;
536   }
537 
538   @Override
getPatchJobCallable()539   public UnaryCallable<PatchJobs.GetPatchJobRequest, PatchJobs.PatchJob> getPatchJobCallable() {
540     return getPatchJobCallable;
541   }
542 
543   @Override
544   public UnaryCallable<PatchJobs.CancelPatchJobRequest, PatchJobs.PatchJob>
cancelPatchJobCallable()545       cancelPatchJobCallable() {
546     return cancelPatchJobCallable;
547   }
548 
549   @Override
550   public UnaryCallable<PatchJobs.ListPatchJobsRequest, PatchJobs.ListPatchJobsResponse>
listPatchJobsCallable()551       listPatchJobsCallable() {
552     return listPatchJobsCallable;
553   }
554 
555   @Override
556   public UnaryCallable<PatchJobs.ListPatchJobsRequest, ListPatchJobsPagedResponse>
listPatchJobsPagedCallable()557       listPatchJobsPagedCallable() {
558     return listPatchJobsPagedCallable;
559   }
560 
561   @Override
562   public UnaryCallable<
563           PatchJobs.ListPatchJobInstanceDetailsRequest,
564           PatchJobs.ListPatchJobInstanceDetailsResponse>
listPatchJobInstanceDetailsCallable()565       listPatchJobInstanceDetailsCallable() {
566     return listPatchJobInstanceDetailsCallable;
567   }
568 
569   @Override
570   public UnaryCallable<
571           PatchJobs.ListPatchJobInstanceDetailsRequest, ListPatchJobInstanceDetailsPagedResponse>
listPatchJobInstanceDetailsPagedCallable()572       listPatchJobInstanceDetailsPagedCallable() {
573     return listPatchJobInstanceDetailsPagedCallable;
574   }
575 
576   @Override
577   public UnaryCallable<
578           PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
createPatchDeploymentCallable()579       createPatchDeploymentCallable() {
580     return createPatchDeploymentCallable;
581   }
582 
583   @Override
584   public UnaryCallable<PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment>
getPatchDeploymentCallable()585       getPatchDeploymentCallable() {
586     return getPatchDeploymentCallable;
587   }
588 
589   @Override
590   public UnaryCallable<
591           PatchDeployments.ListPatchDeploymentsRequest,
592           PatchDeployments.ListPatchDeploymentsResponse>
listPatchDeploymentsCallable()593       listPatchDeploymentsCallable() {
594     return listPatchDeploymentsCallable;
595   }
596 
597   @Override
598   public UnaryCallable<
599           PatchDeployments.ListPatchDeploymentsRequest, ListPatchDeploymentsPagedResponse>
listPatchDeploymentsPagedCallable()600       listPatchDeploymentsPagedCallable() {
601     return listPatchDeploymentsPagedCallable;
602   }
603 
604   @Override
605   public UnaryCallable<PatchDeployments.DeletePatchDeploymentRequest, Empty>
deletePatchDeploymentCallable()606       deletePatchDeploymentCallable() {
607     return deletePatchDeploymentCallable;
608   }
609 
610   @Override
611   public UnaryCallable<
612           PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
updatePatchDeploymentCallable()613       updatePatchDeploymentCallable() {
614     return updatePatchDeploymentCallable;
615   }
616 
617   @Override
618   public UnaryCallable<
619           PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment>
pausePatchDeploymentCallable()620       pausePatchDeploymentCallable() {
621     return pausePatchDeploymentCallable;
622   }
623 
624   @Override
625   public UnaryCallable<
626           PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment>
resumePatchDeploymentCallable()627       resumePatchDeploymentCallable() {
628     return resumePatchDeploymentCallable;
629   }
630 
631   @Override
close()632   public final void close() {
633     try {
634       backgroundResources.close();
635     } catch (RuntimeException e) {
636       throw e;
637     } catch (Exception e) {
638       throw new IllegalStateException("Failed to close resource", e);
639     }
640   }
641 
642   @Override
shutdown()643   public void shutdown() {
644     backgroundResources.shutdown();
645   }
646 
647   @Override
isShutdown()648   public boolean isShutdown() {
649     return backgroundResources.isShutdown();
650   }
651 
652   @Override
isTerminated()653   public boolean isTerminated() {
654     return backgroundResources.isTerminated();
655   }
656 
657   @Override
shutdownNow()658   public void shutdownNow() {
659     backgroundResources.shutdownNow();
660   }
661 
662   @Override
awaitTermination(long duration, TimeUnit unit)663   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
664     return backgroundResources.awaitTermination(duration, unit);
665   }
666 }
667