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

fix!: AutoscalingPolicyName now uses locations instead of regions #118

Merged
merged 3 commits into from Apr 1, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Large diffs are not rendered by default.

Expand Up @@ -49,16 +49,16 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of createAutoscalingPolicy to 30 seconds:
* <p>For example, to set the total timeout of updateAutoscalingPolicy to 30 seconds:
*
* <pre>
* <code>
* AutoscalingPolicyServiceSettings.Builder autoscalingPolicyServiceSettingsBuilder =
* AutoscalingPolicyServiceSettings.newBuilder();
* autoscalingPolicyServiceSettingsBuilder
* .createAutoscalingPolicySettings()
* .updateAutoscalingPolicySettings()
* .setRetrySettings(
* autoscalingPolicyServiceSettingsBuilder.createAutoscalingPolicySettings().getRetrySettings().toBuilder()
* autoscalingPolicyServiceSettingsBuilder.updateAutoscalingPolicySettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* AutoscalingPolicyServiceSettings autoscalingPolicyServiceSettings = autoscalingPolicyServiceSettingsBuilder.build();
Expand All @@ -69,20 +69,20 @@
@BetaApi
public class AutoscalingPolicyServiceSettings
extends ClientSettings<AutoscalingPolicyServiceSettings> {
/** Returns the object with the settings used for calls to createAutoscalingPolicy. */
public UnaryCallSettings<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings() {
return ((AutoscalingPolicyServiceStubSettings) getStubSettings())
.createAutoscalingPolicySettings();
}

/** Returns the object with the settings used for calls to updateAutoscalingPolicy. */
public UnaryCallSettings<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
updateAutoscalingPolicySettings() {
return ((AutoscalingPolicyServiceStubSettings) getStubSettings())
.updateAutoscalingPolicySettings();
}

/** Returns the object with the settings used for calls to createAutoscalingPolicy. */
public UnaryCallSettings<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings() {
return ((AutoscalingPolicyServiceStubSettings) getStubSettings())
.createAutoscalingPolicySettings();
}

/** Returns the object with the settings used for calls to getAutoscalingPolicy. */
public UnaryCallSettings<GetAutoscalingPolicyRequest, AutoscalingPolicy>
getAutoscalingPolicySettings() {
Expand Down Expand Up @@ -205,18 +205,18 @@ public Builder applyToAllUnaryMethods(
return this;
}

/** Returns the builder for the settings used for calls to createAutoscalingPolicy. */
public UnaryCallSettings.Builder<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings() {
return getStubSettingsBuilder().createAutoscalingPolicySettings();
}

/** Returns the builder for the settings used for calls to updateAutoscalingPolicy. */
public UnaryCallSettings.Builder<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
updateAutoscalingPolicySettings() {
return getStubSettingsBuilder().updateAutoscalingPolicySettings();
}

/** Returns the builder for the settings used for calls to createAutoscalingPolicy. */
public UnaryCallSettings.Builder<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings() {
return getStubSettingsBuilder().createAutoscalingPolicySettings();
}

/** Returns the builder for the settings used for calls to getAutoscalingPolicy. */
public UnaryCallSettings.Builder<GetAutoscalingPolicyRequest, AutoscalingPolicy>
getAutoscalingPolicySettings() {
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -28,9 +28,8 @@
* <pre>
* <code>
* try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.create()) {
* String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
* AutoscalingPolicy policy = AutoscalingPolicy.newBuilder().build();
* AutoscalingPolicy response = autoscalingPolicyServiceClient.createAutoscalingPolicy(formattedParent, policy);
* AutoscalingPolicy response = autoscalingPolicyServiceClient.updateAutoscalingPolicy(policy);
* }
* </code>
* </pre>
Expand Down
Expand Up @@ -40,16 +40,16 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public abstract class AutoscalingPolicyServiceStub implements BackgroundResource {

public UnaryCallable<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: createAutoscalingPolicyCallable()");
}

public UnaryCallable<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
updateAutoscalingPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: updateAutoscalingPolicyCallable()");
}

public UnaryCallable<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: createAutoscalingPolicyCallable()");
}

public UnaryCallable<GetAutoscalingPolicyRequest, AutoscalingPolicy>
getAutoscalingPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: getAutoscalingPolicyCallable()");
Expand Down
Expand Up @@ -71,16 +71,16 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of createAutoscalingPolicy to 30 seconds:
* <p>For example, to set the total timeout of updateAutoscalingPolicy to 30 seconds:
*
* <pre>
* <code>
* AutoscalingPolicyServiceStubSettings.Builder autoscalingPolicyServiceSettingsBuilder =
* AutoscalingPolicyServiceStubSettings.newBuilder();
* autoscalingPolicyServiceSettingsBuilder
* .createAutoscalingPolicySettings()
* .updateAutoscalingPolicySettings()
* .setRetrySettings(
* autoscalingPolicyServiceSettingsBuilder.createAutoscalingPolicySettings().getRetrySettings().toBuilder()
* autoscalingPolicyServiceSettingsBuilder.updateAutoscalingPolicySettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* AutoscalingPolicyServiceStubSettings autoscalingPolicyServiceSettings = autoscalingPolicyServiceSettingsBuilder.build();
Expand All @@ -95,10 +95,10 @@ public class AutoscalingPolicyServiceStubSettings
private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
ImmutableList.<String>builder().add("https://www.googleapis.com/auth/cloud-platform").build();

private final UnaryCallSettings<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings;
private final UnaryCallSettings<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
updateAutoscalingPolicySettings;
private final UnaryCallSettings<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings;
private final UnaryCallSettings<GetAutoscalingPolicyRequest, AutoscalingPolicy>
getAutoscalingPolicySettings;
private final PagedCallSettings<
Expand All @@ -109,18 +109,18 @@ public class AutoscalingPolicyServiceStubSettings
private final UnaryCallSettings<DeleteAutoscalingPolicyRequest, Empty>
deleteAutoscalingPolicySettings;

/** Returns the object with the settings used for calls to createAutoscalingPolicy. */
public UnaryCallSettings<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings() {
return createAutoscalingPolicySettings;
}

/** Returns the object with the settings used for calls to updateAutoscalingPolicy. */
public UnaryCallSettings<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
updateAutoscalingPolicySettings() {
return updateAutoscalingPolicySettings;
}

/** Returns the object with the settings used for calls to createAutoscalingPolicy. */
public UnaryCallSettings<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings() {
return createAutoscalingPolicySettings;
}

/** Returns the object with the settings used for calls to getAutoscalingPolicy. */
public UnaryCallSettings<GetAutoscalingPolicyRequest, AutoscalingPolicy>
getAutoscalingPolicySettings() {
Expand Down Expand Up @@ -211,8 +211,8 @@ public Builder toBuilder() {
protected AutoscalingPolicyServiceStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);

createAutoscalingPolicySettings = settingsBuilder.createAutoscalingPolicySettings().build();
updateAutoscalingPolicySettings = settingsBuilder.updateAutoscalingPolicySettings().build();
createAutoscalingPolicySettings = settingsBuilder.createAutoscalingPolicySettings().build();
getAutoscalingPolicySettings = settingsBuilder.getAutoscalingPolicySettings().build();
listAutoscalingPoliciesSettings = settingsBuilder.listAutoscalingPoliciesSettings().build();
deleteAutoscalingPolicySettings = settingsBuilder.deleteAutoscalingPolicySettings().build();
Expand Down Expand Up @@ -295,10 +295,10 @@ public static class Builder
extends StubSettings.Builder<AutoscalingPolicyServiceStubSettings, Builder> {
private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;

private final UnaryCallSettings.Builder<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings;
private final UnaryCallSettings.Builder<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
updateAutoscalingPolicySettings;
private final UnaryCallSettings.Builder<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings;
private final UnaryCallSettings.Builder<GetAutoscalingPolicyRequest, AutoscalingPolicy>
getAutoscalingPolicySettings;
private final PagedCallSettings.Builder<
Expand Down Expand Up @@ -350,10 +350,10 @@ protected Builder() {
protected Builder(ClientContext clientContext) {
super(clientContext);

createAutoscalingPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

updateAutoscalingPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

createAutoscalingPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

getAutoscalingPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

listAutoscalingPoliciesSettings =
Expand All @@ -363,8 +363,8 @@ protected Builder(ClientContext clientContext) {

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
createAutoscalingPolicySettings,
updateAutoscalingPolicySettings,
createAutoscalingPolicySettings,
getAutoscalingPolicySettings,
listAutoscalingPoliciesSettings,
deleteAutoscalingPolicySettings);
Expand All @@ -384,13 +384,13 @@ private static Builder createDefault() {
private static Builder initDefaults(Builder builder) {

builder
.createAutoscalingPolicySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.updateAutoscalingPolicySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));

builder
.updateAutoscalingPolicySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.createAutoscalingPolicySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));

builder
Expand All @@ -414,16 +414,16 @@ private static Builder initDefaults(Builder builder) {
protected Builder(AutoscalingPolicyServiceStubSettings settings) {
super(settings);

createAutoscalingPolicySettings = settings.createAutoscalingPolicySettings.toBuilder();
updateAutoscalingPolicySettings = settings.updateAutoscalingPolicySettings.toBuilder();
createAutoscalingPolicySettings = settings.createAutoscalingPolicySettings.toBuilder();
getAutoscalingPolicySettings = settings.getAutoscalingPolicySettings.toBuilder();
listAutoscalingPoliciesSettings = settings.listAutoscalingPoliciesSettings.toBuilder();
deleteAutoscalingPolicySettings = settings.deleteAutoscalingPolicySettings.toBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
createAutoscalingPolicySettings,
updateAutoscalingPolicySettings,
createAutoscalingPolicySettings,
getAutoscalingPolicySettings,
listAutoscalingPoliciesSettings,
deleteAutoscalingPolicySettings);
Expand All @@ -445,18 +445,18 @@ public Builder applyToAllUnaryMethods(
return unaryMethodSettingsBuilders;
}

/** Returns the builder for the settings used for calls to createAutoscalingPolicy. */
public UnaryCallSettings.Builder<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings() {
return createAutoscalingPolicySettings;
}

/** Returns the builder for the settings used for calls to updateAutoscalingPolicy. */
public UnaryCallSettings.Builder<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
updateAutoscalingPolicySettings() {
return updateAutoscalingPolicySettings;
}

/** Returns the builder for the settings used for calls to createAutoscalingPolicy. */
public UnaryCallSettings.Builder<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
createAutoscalingPolicySettings() {
return createAutoscalingPolicySettings;
}

/** Returns the builder for the settings used for calls to getAutoscalingPolicy. */
public UnaryCallSettings.Builder<GetAutoscalingPolicyRequest, AutoscalingPolicy>
getAutoscalingPolicySettings() {
Expand Down
Expand Up @@ -470,13 +470,13 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(1000L))
.setRetryDelayMultiplier(2.0)
.setMaxRetryDelay(Duration.ofMillis(10000L))
.setInitialRetryDelay(Duration.ofMillis(500L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(5000L))
.setInitialRpcTimeout(Duration.ZERO) // ignored
.setRpcTimeoutMultiplier(1.0) // ignored
.setMaxRpcTimeout(Duration.ZERO) // ignored
.setTotalTimeout(Duration.ofMillis(900000L))
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
builder
.updateClusterOperationSettings()
Expand All @@ -493,13 +493,13 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(1000L))
.setRetryDelayMultiplier(2.0)
.setMaxRetryDelay(Duration.ofMillis(10000L))
.setInitialRetryDelay(Duration.ofMillis(500L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(5000L))
.setInitialRpcTimeout(Duration.ZERO) // ignored
.setRpcTimeoutMultiplier(1.0) // ignored
.setMaxRpcTimeout(Duration.ZERO) // ignored
.setTotalTimeout(Duration.ofMillis(900000L))
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
builder
.deleteClusterOperationSettings()
Expand All @@ -516,13 +516,13 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(1000L))
.setRetryDelayMultiplier(2.0)
.setMaxRetryDelay(Duration.ofMillis(10000L))
.setInitialRetryDelay(Duration.ofMillis(500L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(5000L))
.setInitialRpcTimeout(Duration.ZERO) // ignored
.setRpcTimeoutMultiplier(1.0) // ignored
.setMaxRpcTimeout(Duration.ZERO) // ignored
.setTotalTimeout(Duration.ofMillis(900000L))
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
builder
.diagnoseClusterOperationSettings()
Expand All @@ -539,13 +539,13 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(1000L))
.setRetryDelayMultiplier(2.0)
.setMaxRetryDelay(Duration.ofMillis(10000L))
.setInitialRetryDelay(Duration.ofMillis(500L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(5000L))
.setInitialRpcTimeout(Duration.ZERO) // ignored
.setRpcTimeoutMultiplier(1.0) // ignored
.setMaxRpcTimeout(Duration.ZERO) // ignored
.setTotalTimeout(Duration.ofMillis(30000L))
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));

return builder;
Expand Down