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

feat(v1beta2): added ApplySoftwareUpdate API #302

Merged
merged 3 commits into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ public UnaryCallSettings<ApplyParametersRequest, Operation> applyParametersSetti
return ((CloudMemcacheStubSettings) getStubSettings()).applyParametersOperationSettings();
}

/** Returns the object with the settings used for calls to applySoftwareUpdate. */
public UnaryCallSettings<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateSettings() {
return ((CloudMemcacheStubSettings) getStubSettings()).applySoftwareUpdateSettings();
}

/** Returns the object with the settings used for calls to applySoftwareUpdate. */
public OperationCallSettings<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationSettings() {
return ((CloudMemcacheStubSettings) getStubSettings()).applySoftwareUpdateOperationSettings();
}

public static final CloudMemcacheSettings create(CloudMemcacheStubSettings stub)
throws IOException {
return new CloudMemcacheSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -304,6 +315,18 @@ public UnaryCallSettings.Builder<ApplyParametersRequest, Operation> applyParamet
return getStubSettingsBuilder().applyParametersOperationSettings();
}

/** Returns the builder for the settings used for calls to applySoftwareUpdate. */
public UnaryCallSettings.Builder<ApplySoftwareUpdateRequest, Operation>
applySoftwareUpdateSettings() {
return getStubSettingsBuilder().applySoftwareUpdateSettings();
}

/** Returns the builder for the settings used for calls to applySoftwareUpdate. */
public OperationCallSettings.Builder<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationSettings() {
return getStubSettingsBuilder().applySoftwareUpdateOperationSettings();
}

@Override
public CloudMemcacheSettings build() throws IOException {
return new CloudMemcacheSettings(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* </ul>
*
* <p>Note that location_id must be refering to a GCP `region`; for example:
* <p>Note that location_id must be a GCP `region`; for example:
*
* <ul>
* <li>`projects/my-memcached-project/locations/us-central1/instances/my-memcached`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.memcache.v1beta2.ApplyParametersRequest;
import com.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest;
import com.google.cloud.memcache.v1beta2.CreateInstanceRequest;
import com.google.cloud.memcache.v1beta2.DeleteInstanceRequest;
import com.google.cloud.memcache.v1beta2.GetInstanceRequest;
Expand Down Expand Up @@ -109,6 +110,16 @@ public UnaryCallable<ApplyParametersRequest, Operation> applyParametersCallable(
throw new UnsupportedOperationException("Not implemented: applyParametersCallable()");
}

public OperationCallable<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationCallable() {
throw new UnsupportedOperationException(
"Not implemented: applySoftwareUpdateOperationCallable()");
}

public UnaryCallable<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateCallable() {
throw new UnsupportedOperationException("Not implemented: applySoftwareUpdateCallable()");
}

@Override
public abstract void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.memcache.v1beta2.ApplyParametersRequest;
import com.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest;
import com.google.cloud.memcache.v1beta2.CreateInstanceRequest;
import com.google.cloud.memcache.v1beta2.DeleteInstanceRequest;
import com.google.cloud.memcache.v1beta2.GetInstanceRequest;
Expand Down Expand Up @@ -123,6 +124,10 @@ public class CloudMemcacheStubSettings extends StubSettings<CloudMemcacheStubSet
private final UnaryCallSettings<ApplyParametersRequest, Operation> applyParametersSettings;
private final OperationCallSettings<ApplyParametersRequest, Instance, OperationMetadata>
applyParametersOperationSettings;
private final UnaryCallSettings<ApplySoftwareUpdateRequest, Operation>
applySoftwareUpdateSettings;
private final OperationCallSettings<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationSettings;

private static final PagedListDescriptor<ListInstancesRequest, ListInstancesResponse, Instance>
LIST_INSTANCES_PAGE_STR_DESC =
Expand Down Expand Up @@ -243,6 +248,17 @@ public UnaryCallSettings<ApplyParametersRequest, Operation> applyParametersSetti
return applyParametersOperationSettings;
}

/** Returns the object with the settings used for calls to applySoftwareUpdate. */
public UnaryCallSettings<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateSettings() {
return applySoftwareUpdateSettings;
}

/** Returns the object with the settings used for calls to applySoftwareUpdate. */
public OperationCallSettings<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationSettings() {
return applySoftwareUpdateOperationSettings;
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public CloudMemcacheStub createStub() throws IOException {
if (getTransportChannelProvider()
Expand Down Expand Up @@ -324,6 +340,9 @@ protected CloudMemcacheStubSettings(Builder settingsBuilder) throws IOException
deleteInstanceOperationSettings = settingsBuilder.deleteInstanceOperationSettings().build();
applyParametersSettings = settingsBuilder.applyParametersSettings().build();
applyParametersOperationSettings = settingsBuilder.applyParametersOperationSettings().build();
applySoftwareUpdateSettings = settingsBuilder.applySoftwareUpdateSettings().build();
applySoftwareUpdateOperationSettings =
settingsBuilder.applySoftwareUpdateOperationSettings().build();
}

/** Builder for CloudMemcacheStubSettings. */
Expand Down Expand Up @@ -354,6 +373,11 @@ public static class Builder extends StubSettings.Builder<CloudMemcacheStubSettin
applyParametersSettings;
private final OperationCallSettings.Builder<ApplyParametersRequest, Instance, OperationMetadata>
applyParametersOperationSettings;
private final UnaryCallSettings.Builder<ApplySoftwareUpdateRequest, Operation>
applySoftwareUpdateSettings;
private final OperationCallSettings.Builder<
ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationSettings;
private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
RETRYABLE_CODE_DEFINITIONS;

Expand Down Expand Up @@ -400,6 +424,8 @@ protected Builder(ClientContext clientContext) {
deleteInstanceOperationSettings = OperationCallSettings.newBuilder();
applyParametersSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
applyParametersOperationSettings = OperationCallSettings.newBuilder();
applySoftwareUpdateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
applySoftwareUpdateOperationSettings = OperationCallSettings.newBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
Expand All @@ -409,7 +435,8 @@ protected Builder(ClientContext clientContext) {
updateInstanceSettings,
updateParametersSettings,
deleteInstanceSettings,
applyParametersSettings);
applyParametersSettings,
applySoftwareUpdateSettings);
initDefaults(this);
}

Expand All @@ -428,6 +455,9 @@ protected Builder(CloudMemcacheStubSettings settings) {
deleteInstanceOperationSettings = settings.deleteInstanceOperationSettings.toBuilder();
applyParametersSettings = settings.applyParametersSettings.toBuilder();
applyParametersOperationSettings = settings.applyParametersOperationSettings.toBuilder();
applySoftwareUpdateSettings = settings.applySoftwareUpdateSettings.toBuilder();
applySoftwareUpdateOperationSettings =
settings.applySoftwareUpdateOperationSettings.toBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
Expand All @@ -437,7 +467,8 @@ protected Builder(CloudMemcacheStubSettings settings) {
updateInstanceSettings,
updateParametersSettings,
deleteInstanceSettings,
applyParametersSettings);
applyParametersSettings,
applySoftwareUpdateSettings);
}

private static Builder createDefault() {
Expand Down Expand Up @@ -487,6 +518,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));

builder
.applySoftwareUpdateSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));

builder
.createInstanceOperationSettings()
.setInitialCallSettings(
Expand Down Expand Up @@ -607,6 +643,30 @@ private static Builder initDefaults(Builder builder) {
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));

builder
.applySoftwareUpdateOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.<ApplySoftwareUpdateRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Instance.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(45000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));

return builder;
}

Expand Down Expand Up @@ -704,6 +764,20 @@ public UnaryCallSettings.Builder<ApplyParametersRequest, Operation> applyParamet
return applyParametersOperationSettings;
}

/** Returns the builder for the settings used for calls to applySoftwareUpdate. */
public UnaryCallSettings.Builder<ApplySoftwareUpdateRequest, Operation>
applySoftwareUpdateSettings() {
return applySoftwareUpdateSettings;
}

/** Returns the builder for the settings used for calls to applySoftwareUpdate. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationSettings() {
return applySoftwareUpdateOperationSettings;
}

@Override
public CloudMemcacheStubSettings build() throws IOException {
return new CloudMemcacheStubSettings(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.api.gax.rpc.RequestParamsExtractor;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.memcache.v1beta2.ApplyParametersRequest;
import com.google.cloud.memcache.v1beta2.ApplySoftwareUpdateRequest;
import com.google.cloud.memcache.v1beta2.CreateInstanceRequest;
import com.google.cloud.memcache.v1beta2.DeleteInstanceRequest;
import com.google.cloud.memcache.v1beta2.GetInstanceRequest;
Expand Down Expand Up @@ -126,6 +127,16 @@ public class GrpcCloudMemcacheStub extends CloudMemcacheStub {
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();

private static final MethodDescriptor<ApplySoftwareUpdateRequest, Operation>
applySoftwareUpdateMethodDescriptor =
MethodDescriptor.<ApplySoftwareUpdateRequest, Operation>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.memcache.v1beta2.CloudMemcache/ApplySoftwareUpdate")
.setRequestMarshaller(
ProtoUtils.marshaller(ApplySoftwareUpdateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();

private final UnaryCallable<ListInstancesRequest, ListInstancesResponse> listInstancesCallable;
private final UnaryCallable<ListInstancesRequest, ListInstancesPagedResponse>
listInstancesPagedCallable;
Expand All @@ -145,6 +156,9 @@ public class GrpcCloudMemcacheStub extends CloudMemcacheStub {
private final UnaryCallable<ApplyParametersRequest, Operation> applyParametersCallable;
private final OperationCallable<ApplyParametersRequest, Instance, OperationMetadata>
applyParametersOperationCallable;
private final UnaryCallable<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateCallable;
private final OperationCallable<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationCallable;

private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
Expand Down Expand Up @@ -279,6 +293,19 @@ public Map<String, String> extract(ApplyParametersRequest request) {
}
})
.build();
GrpcCallSettings<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateTransportSettings =
GrpcCallSettings.<ApplySoftwareUpdateRequest, Operation>newBuilder()
.setMethodDescriptor(applySoftwareUpdateMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<ApplySoftwareUpdateRequest>() {
@Override
public Map<String, String> extract(ApplySoftwareUpdateRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("instance", String.valueOf(request.getInstance()));
return params.build();
}
})
.build();

this.listInstancesCallable =
callableFactory.createUnaryCallable(
Expand Down Expand Up @@ -334,6 +361,17 @@ public Map<String, String> extract(ApplyParametersRequest request) {
settings.applyParametersOperationSettings(),
clientContext,
operationsStub);
this.applySoftwareUpdateCallable =
callableFactory.createUnaryCallable(
applySoftwareUpdateTransportSettings,
settings.applySoftwareUpdateSettings(),
clientContext);
this.applySoftwareUpdateOperationCallable =
callableFactory.createOperationCallable(
applySoftwareUpdateTransportSettings,
settings.applySoftwareUpdateOperationSettings(),
clientContext,
operationsStub);

this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
Expand Down Expand Up @@ -401,6 +439,15 @@ public UnaryCallable<ApplyParametersRequest, Operation> applyParametersCallable(
return applyParametersOperationCallable;
}

public UnaryCallable<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateCallable() {
return applySoftwareUpdateCallable;
}

public OperationCallable<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationCallable() {
return applySoftwareUpdateOperationCallable;
}

@Override
public final void close() {
shutdown();
Expand Down
Loading