Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Commit 184ba12

Browse files
feat(v1beta2): added ApplySoftwareUpdate API (#302)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/a01a320a-2662-4e30-b5a2-0411c0536c65/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 356380191 Source-Link: googleapis/googleapis@84cf54e docs: various clarifications, new documentation for ApplySoftwareUpdate chore: update proto annotations
1 parent 5af0c8c commit 184ba12

33 files changed

+2949
-731
lines changed

google-cloud-memcache/src/main/java/com/google/cloud/memcache/v1beta2/CloudMemcacheClient.java

+230-51
Large diffs are not rendered by default.

google-cloud-memcache/src/main/java/com/google/cloud/memcache/v1beta2/CloudMemcacheSettings.java

+23
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,17 @@ public UnaryCallSettings<ApplyParametersRequest, Operation> applyParametersSetti
138138
return ((CloudMemcacheStubSettings) getStubSettings()).applyParametersOperationSettings();
139139
}
140140

141+
/** Returns the object with the settings used for calls to applySoftwareUpdate. */
142+
public UnaryCallSettings<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateSettings() {
143+
return ((CloudMemcacheStubSettings) getStubSettings()).applySoftwareUpdateSettings();
144+
}
145+
146+
/** Returns the object with the settings used for calls to applySoftwareUpdate. */
147+
public OperationCallSettings<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
148+
applySoftwareUpdateOperationSettings() {
149+
return ((CloudMemcacheStubSettings) getStubSettings()).applySoftwareUpdateOperationSettings();
150+
}
151+
141152
public static final CloudMemcacheSettings create(CloudMemcacheStubSettings stub)
142153
throws IOException {
143154
return new CloudMemcacheSettings.Builder(stub.toBuilder()).build();
@@ -304,6 +315,18 @@ public UnaryCallSettings.Builder<ApplyParametersRequest, Operation> applyParamet
304315
return getStubSettingsBuilder().applyParametersOperationSettings();
305316
}
306317

318+
/** Returns the builder for the settings used for calls to applySoftwareUpdate. */
319+
public UnaryCallSettings.Builder<ApplySoftwareUpdateRequest, Operation>
320+
applySoftwareUpdateSettings() {
321+
return getStubSettingsBuilder().applySoftwareUpdateSettings();
322+
}
323+
324+
/** Returns the builder for the settings used for calls to applySoftwareUpdate. */
325+
public OperationCallSettings.Builder<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
326+
applySoftwareUpdateOperationSettings() {
327+
return getStubSettingsBuilder().applySoftwareUpdateOperationSettings();
328+
}
329+
307330
@Override
308331
public CloudMemcacheSettings build() throws IOException {
309332
return new CloudMemcacheSettings(this);

google-cloud-memcache/src/main/java/com/google/cloud/memcache/v1beta2/package-info.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
3434
* </ul>
3535
*
36-
* <p>Note that location_id must be refering to a GCP `region`; for example:
36+
* <p>Note that location_id must be a GCP `region`; for example:
3737
*
3838
* <ul>
3939
* <li>`projects/my-memcached-project/locations/us-central1/instances/my-memcached`

google-cloud-memcache/src/main/java/com/google/cloud/memcache/v1beta2/stub/CloudMemcacheStub.java

+11
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.api.gax.rpc.OperationCallable;
2424
import com.google.api.gax.rpc.UnaryCallable;
2525
import com.google.cloud.memcache.v1beta2.ApplyParametersRequest;
26+
import com.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest;
2627
import com.google.cloud.memcache.v1beta2.CreateInstanceRequest;
2728
import com.google.cloud.memcache.v1beta2.DeleteInstanceRequest;
2829
import com.google.cloud.memcache.v1beta2.GetInstanceRequest;
@@ -109,6 +110,16 @@ public UnaryCallable<ApplyParametersRequest, Operation> applyParametersCallable(
109110
throw new UnsupportedOperationException("Not implemented: applyParametersCallable()");
110111
}
111112

113+
public OperationCallable<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
114+
applySoftwareUpdateOperationCallable() {
115+
throw new UnsupportedOperationException(
116+
"Not implemented: applySoftwareUpdateOperationCallable()");
117+
}
118+
119+
public UnaryCallable<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateCallable() {
120+
throw new UnsupportedOperationException("Not implemented: applySoftwareUpdateCallable()");
121+
}
122+
112123
@Override
113124
public abstract void close();
114125
}

google-cloud-memcache/src/main/java/com/google/cloud/memcache/v1beta2/stub/CloudMemcacheStubSettings.java

+76-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.google.api.gax.rpc.UnaryCallSettings;
4646
import com.google.api.gax.rpc.UnaryCallable;
4747
import com.google.cloud.memcache.v1beta2.ApplyParametersRequest;
48+
import com.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest;
4849
import com.google.cloud.memcache.v1beta2.CreateInstanceRequest;
4950
import com.google.cloud.memcache.v1beta2.DeleteInstanceRequest;
5051
import com.google.cloud.memcache.v1beta2.GetInstanceRequest;
@@ -123,6 +124,10 @@ public class CloudMemcacheStubSettings extends StubSettings<CloudMemcacheStubSet
123124
private final UnaryCallSettings<ApplyParametersRequest, Operation> applyParametersSettings;
124125
private final OperationCallSettings<ApplyParametersRequest, Instance, OperationMetadata>
125126
applyParametersOperationSettings;
127+
private final UnaryCallSettings<ApplySoftwareUpdateRequest, Operation>
128+
applySoftwareUpdateSettings;
129+
private final OperationCallSettings<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
130+
applySoftwareUpdateOperationSettings;
126131

127132
private static final PagedListDescriptor<ListInstancesRequest, ListInstancesResponse, Instance>
128133
LIST_INSTANCES_PAGE_STR_DESC =
@@ -243,6 +248,17 @@ public UnaryCallSettings<ApplyParametersRequest, Operation> applyParametersSetti
243248
return applyParametersOperationSettings;
244249
}
245250

251+
/** Returns the object with the settings used for calls to applySoftwareUpdate. */
252+
public UnaryCallSettings<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateSettings() {
253+
return applySoftwareUpdateSettings;
254+
}
255+
256+
/** Returns the object with the settings used for calls to applySoftwareUpdate. */
257+
public OperationCallSettings<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
258+
applySoftwareUpdateOperationSettings() {
259+
return applySoftwareUpdateOperationSettings;
260+
}
261+
246262
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
247263
public CloudMemcacheStub createStub() throws IOException {
248264
if (getTransportChannelProvider()
@@ -324,6 +340,9 @@ protected CloudMemcacheStubSettings(Builder settingsBuilder) throws IOException
324340
deleteInstanceOperationSettings = settingsBuilder.deleteInstanceOperationSettings().build();
325341
applyParametersSettings = settingsBuilder.applyParametersSettings().build();
326342
applyParametersOperationSettings = settingsBuilder.applyParametersOperationSettings().build();
343+
applySoftwareUpdateSettings = settingsBuilder.applySoftwareUpdateSettings().build();
344+
applySoftwareUpdateOperationSettings =
345+
settingsBuilder.applySoftwareUpdateOperationSettings().build();
327346
}
328347

329348
/** Builder for CloudMemcacheStubSettings. */
@@ -354,6 +373,11 @@ public static class Builder extends StubSettings.Builder<CloudMemcacheStubSettin
354373
applyParametersSettings;
355374
private final OperationCallSettings.Builder<ApplyParametersRequest, Instance, OperationMetadata>
356375
applyParametersOperationSettings;
376+
private final UnaryCallSettings.Builder<ApplySoftwareUpdateRequest, Operation>
377+
applySoftwareUpdateSettings;
378+
private final OperationCallSettings.Builder<
379+
ApplySoftwareUpdateRequest, Instance, OperationMetadata>
380+
applySoftwareUpdateOperationSettings;
357381
private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
358382
RETRYABLE_CODE_DEFINITIONS;
359383

@@ -400,6 +424,8 @@ protected Builder(ClientContext clientContext) {
400424
deleteInstanceOperationSettings = OperationCallSettings.newBuilder();
401425
applyParametersSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
402426
applyParametersOperationSettings = OperationCallSettings.newBuilder();
427+
applySoftwareUpdateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
428+
applySoftwareUpdateOperationSettings = OperationCallSettings.newBuilder();
403429

404430
unaryMethodSettingsBuilders =
405431
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
@@ -409,7 +435,8 @@ protected Builder(ClientContext clientContext) {
409435
updateInstanceSettings,
410436
updateParametersSettings,
411437
deleteInstanceSettings,
412-
applyParametersSettings);
438+
applyParametersSettings,
439+
applySoftwareUpdateSettings);
413440
initDefaults(this);
414441
}
415442

@@ -428,6 +455,9 @@ protected Builder(CloudMemcacheStubSettings settings) {
428455
deleteInstanceOperationSettings = settings.deleteInstanceOperationSettings.toBuilder();
429456
applyParametersSettings = settings.applyParametersSettings.toBuilder();
430457
applyParametersOperationSettings = settings.applyParametersOperationSettings.toBuilder();
458+
applySoftwareUpdateSettings = settings.applySoftwareUpdateSettings.toBuilder();
459+
applySoftwareUpdateOperationSettings =
460+
settings.applySoftwareUpdateOperationSettings.toBuilder();
431461

432462
unaryMethodSettingsBuilders =
433463
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
@@ -437,7 +467,8 @@ protected Builder(CloudMemcacheStubSettings settings) {
437467
updateInstanceSettings,
438468
updateParametersSettings,
439469
deleteInstanceSettings,
440-
applyParametersSettings);
470+
applyParametersSettings,
471+
applySoftwareUpdateSettings);
441472
}
442473

443474
private static Builder createDefault() {
@@ -487,6 +518,11 @@ private static Builder initDefaults(Builder builder) {
487518
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
488519
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
489520

521+
builder
522+
.applySoftwareUpdateSettings()
523+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
524+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
525+
490526
builder
491527
.createInstanceOperationSettings()
492528
.setInitialCallSettings(
@@ -607,6 +643,30 @@ private static Builder initDefaults(Builder builder) {
607643
.setTotalTimeout(Duration.ofMillis(300000L))
608644
.build()));
609645

646+
builder
647+
.applySoftwareUpdateOperationSettings()
648+
.setInitialCallSettings(
649+
UnaryCallSettings
650+
.<ApplySoftwareUpdateRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
651+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
652+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
653+
.build())
654+
.setResponseTransformer(
655+
ProtoOperationTransformers.ResponseTransformer.create(Instance.class))
656+
.setMetadataTransformer(
657+
ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class))
658+
.setPollingAlgorithm(
659+
OperationTimedPollAlgorithm.create(
660+
RetrySettings.newBuilder()
661+
.setInitialRetryDelay(Duration.ofMillis(5000L))
662+
.setRetryDelayMultiplier(1.5)
663+
.setMaxRetryDelay(Duration.ofMillis(45000L))
664+
.setInitialRpcTimeout(Duration.ZERO)
665+
.setRpcTimeoutMultiplier(1.0)
666+
.setMaxRpcTimeout(Duration.ZERO)
667+
.setTotalTimeout(Duration.ofMillis(300000L))
668+
.build()));
669+
610670
return builder;
611671
}
612672

@@ -704,6 +764,20 @@ public UnaryCallSettings.Builder<ApplyParametersRequest, Operation> applyParamet
704764
return applyParametersOperationSettings;
705765
}
706766

767+
/** Returns the builder for the settings used for calls to applySoftwareUpdate. */
768+
public UnaryCallSettings.Builder<ApplySoftwareUpdateRequest, Operation>
769+
applySoftwareUpdateSettings() {
770+
return applySoftwareUpdateSettings;
771+
}
772+
773+
/** Returns the builder for the settings used for calls to applySoftwareUpdate. */
774+
@BetaApi(
775+
"The surface for use by generated code is not stable yet and may change in the future.")
776+
public OperationCallSettings.Builder<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
777+
applySoftwareUpdateOperationSettings() {
778+
return applySoftwareUpdateOperationSettings;
779+
}
780+
707781
@Override
708782
public CloudMemcacheStubSettings build() throws IOException {
709783
return new CloudMemcacheStubSettings(this);

google-cloud-memcache/src/main/java/com/google/cloud/memcache/v1beta2/stub/GrpcCloudMemcacheStub.java

+47
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.google.api.gax.rpc.RequestParamsExtractor;
2929
import com.google.api.gax.rpc.UnaryCallable;
3030
import com.google.cloud.memcache.v1beta2.ApplyParametersRequest;
31+
import com.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest;
3132
import com.google.cloud.memcache.v1beta2.CreateInstanceRequest;
3233
import com.google.cloud.memcache.v1beta2.DeleteInstanceRequest;
3334
import com.google.cloud.memcache.v1beta2.GetInstanceRequest;
@@ -126,6 +127,16 @@ public class GrpcCloudMemcacheStub extends CloudMemcacheStub {
126127
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
127128
.build();
128129

130+
private static final MethodDescriptor<ApplySoftwareUpdateRequest, Operation>
131+
applySoftwareUpdateMethodDescriptor =
132+
MethodDescriptor.<ApplySoftwareUpdateRequest, Operation>newBuilder()
133+
.setType(MethodDescriptor.MethodType.UNARY)
134+
.setFullMethodName("google.cloud.memcache.v1beta2.CloudMemcache/ApplySoftwareUpdate")
135+
.setRequestMarshaller(
136+
ProtoUtils.marshaller(ApplySoftwareUpdateRequest.getDefaultInstance()))
137+
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
138+
.build();
139+
129140
private final UnaryCallable<ListInstancesRequest, ListInstancesResponse> listInstancesCallable;
130141
private final UnaryCallable<ListInstancesRequest, ListInstancesPagedResponse>
131142
listInstancesPagedCallable;
@@ -145,6 +156,9 @@ public class GrpcCloudMemcacheStub extends CloudMemcacheStub {
145156
private final UnaryCallable<ApplyParametersRequest, Operation> applyParametersCallable;
146157
private final OperationCallable<ApplyParametersRequest, Instance, OperationMetadata>
147158
applyParametersOperationCallable;
159+
private final UnaryCallable<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateCallable;
160+
private final OperationCallable<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
161+
applySoftwareUpdateOperationCallable;
148162

149163
private final BackgroundResource backgroundResources;
150164
private final GrpcOperationsStub operationsStub;
@@ -279,6 +293,19 @@ public Map<String, String> extract(ApplyParametersRequest request) {
279293
}
280294
})
281295
.build();
296+
GrpcCallSettings<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateTransportSettings =
297+
GrpcCallSettings.<ApplySoftwareUpdateRequest, Operation>newBuilder()
298+
.setMethodDescriptor(applySoftwareUpdateMethodDescriptor)
299+
.setParamsExtractor(
300+
new RequestParamsExtractor<ApplySoftwareUpdateRequest>() {
301+
@Override
302+
public Map<String, String> extract(ApplySoftwareUpdateRequest request) {
303+
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
304+
params.put("instance", String.valueOf(request.getInstance()));
305+
return params.build();
306+
}
307+
})
308+
.build();
282309

283310
this.listInstancesCallable =
284311
callableFactory.createUnaryCallable(
@@ -334,6 +361,17 @@ public Map<String, String> extract(ApplyParametersRequest request) {
334361
settings.applyParametersOperationSettings(),
335362
clientContext,
336363
operationsStub);
364+
this.applySoftwareUpdateCallable =
365+
callableFactory.createUnaryCallable(
366+
applySoftwareUpdateTransportSettings,
367+
settings.applySoftwareUpdateSettings(),
368+
clientContext);
369+
this.applySoftwareUpdateOperationCallable =
370+
callableFactory.createOperationCallable(
371+
applySoftwareUpdateTransportSettings,
372+
settings.applySoftwareUpdateOperationSettings(),
373+
clientContext,
374+
operationsStub);
337375

338376
this.backgroundResources =
339377
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
@@ -401,6 +439,15 @@ public UnaryCallable<ApplyParametersRequest, Operation> applyParametersCallable(
401439
return applyParametersOperationCallable;
402440
}
403441

442+
public UnaryCallable<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateCallable() {
443+
return applySoftwareUpdateCallable;
444+
}
445+
446+
public OperationCallable<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
447+
applySoftwareUpdateOperationCallable() {
448+
return applySoftwareUpdateOperationCallable;
449+
}
450+
404451
@Override
405452
public final void close() {
406453
shutdown();

0 commit comments

Comments
 (0)