com.cloudsnorkel.cdk.github.runners.ProviderRetryOptions Maven / Gradle / Ivy
Show all versions of cdk.github.runners Show documentation
package com.cloudsnorkel.cdk.github.runners;
/**
* (experimental) Retry options for providers.
*
* The default is to retry 23 times for about 24 hours with increasing interval.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-14T02:42:19.530Z")
@software.amazon.jsii.Jsii(module = com.cloudsnorkel.cdk.github.runners.$Module.class, fqn = "@cloudsnorkel/cdk-github-runners.ProviderRetryOptions")
@software.amazon.jsii.Jsii.Proxy(ProviderRetryOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface ProviderRetryOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Multiplication for how much longer the wait interval gets on every retry.
*
* Default: 1.3
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getBackoffRate() {
return null;
}
/**
* (experimental) How much time to wait after first retryable failure.
*
* This interval will be multiplied by {@link backoffRate} each retry.
*
* Default: 1 minute
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.Duration getInterval() {
return null;
}
/**
* (experimental) How many times to retry.
*
* Default: 23
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMaxAttempts() {
return null;
}
/**
* (experimental) Set to true to retry provider on supported failures.
*
* Which failures generate a retry depends on the specific provider.
*
* Default: true
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getRetry() {
return null;
}
/**
* @return a {@link Builder} of {@link ProviderRetryOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ProviderRetryOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Number backoffRate;
software.amazon.awscdk.Duration interval;
java.lang.Number maxAttempts;
java.lang.Boolean retry;
/**
* Sets the value of {@link ProviderRetryOptions#getBackoffRate}
* @param backoffRate Multiplication for how much longer the wait interval gets on every retry.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder backoffRate(java.lang.Number backoffRate) {
this.backoffRate = backoffRate;
return this;
}
/**
* Sets the value of {@link ProviderRetryOptions#getInterval}
* @param interval How much time to wait after first retryable failure.
* This interval will be multiplied by {@link backoffRate} each retry.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder interval(software.amazon.awscdk.Duration interval) {
this.interval = interval;
return this;
}
/**
* Sets the value of {@link ProviderRetryOptions#getMaxAttempts}
* @param maxAttempts How many times to retry.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxAttempts(java.lang.Number maxAttempts) {
this.maxAttempts = maxAttempts;
return this;
}
/**
* Sets the value of {@link ProviderRetryOptions#getRetry}
* @param retry Set to true to retry provider on supported failures.
* Which failures generate a retry depends on the specific provider.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder retry(java.lang.Boolean retry) {
this.retry = retry;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ProviderRetryOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public ProviderRetryOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ProviderRetryOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ProviderRetryOptions {
private final java.lang.Number backoffRate;
private final software.amazon.awscdk.Duration interval;
private final java.lang.Number maxAttempts;
private final java.lang.Boolean retry;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.backoffRate = software.amazon.jsii.Kernel.get(this, "backoffRate", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.interval = software.amazon.jsii.Kernel.get(this, "interval", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.class));
this.maxAttempts = software.amazon.jsii.Kernel.get(this, "maxAttempts", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.retry = software.amazon.jsii.Kernel.get(this, "retry", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.backoffRate = builder.backoffRate;
this.interval = builder.interval;
this.maxAttempts = builder.maxAttempts;
this.retry = builder.retry;
}
@Override
public final java.lang.Number getBackoffRate() {
return this.backoffRate;
}
@Override
public final software.amazon.awscdk.Duration getInterval() {
return this.interval;
}
@Override
public final java.lang.Number getMaxAttempts() {
return this.maxAttempts;
}
@Override
public final java.lang.Boolean getRetry() {
return this.retry;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getBackoffRate() != null) {
data.set("backoffRate", om.valueToTree(this.getBackoffRate()));
}
if (this.getInterval() != null) {
data.set("interval", om.valueToTree(this.getInterval()));
}
if (this.getMaxAttempts() != null) {
data.set("maxAttempts", om.valueToTree(this.getMaxAttempts()));
}
if (this.getRetry() != null) {
data.set("retry", om.valueToTree(this.getRetry()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@cloudsnorkel/cdk-github-runners.ProviderRetryOptions"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProviderRetryOptions.Jsii$Proxy that = (ProviderRetryOptions.Jsii$Proxy) o;
if (this.backoffRate != null ? !this.backoffRate.equals(that.backoffRate) : that.backoffRate != null) return false;
if (this.interval != null ? !this.interval.equals(that.interval) : that.interval != null) return false;
if (this.maxAttempts != null ? !this.maxAttempts.equals(that.maxAttempts) : that.maxAttempts != null) return false;
return this.retry != null ? this.retry.equals(that.retry) : that.retry == null;
}
@Override
public final int hashCode() {
int result = this.backoffRate != null ? this.backoffRate.hashCode() : 0;
result = 31 * result + (this.interval != null ? this.interval.hashCode() : 0);
result = 31 * result + (this.maxAttempts != null ? this.maxAttempts.hashCode() : 0);
result = 31 * result + (this.retry != null ? this.retry.hashCode() : 0);
return result;
}
}
}