com.cloudsnorkel.cdk.github.runners.FastLaunchOptions Maven / Gradle / Ivy
Show all versions of cdk.github.runners Show documentation
package com.cloudsnorkel.cdk.github.runners;
/**
* (experimental) Options for fast launch.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-14T02:42:19.441Z")
@software.amazon.jsii.Jsii(module = com.cloudsnorkel.cdk.github.runners.$Module.class, fqn = "@cloudsnorkel/cdk-github-runners.FastLaunchOptions")
@software.amazon.jsii.Jsii.Proxy(FastLaunchOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface FastLaunchOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Enable fast launch for AMIs generated by this builder.
*
* It creates a snapshot of the root volume and uses it to launch new instances faster.
*
* This is only supported for Windows AMIs.
*
* Default: false
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getEnabled() {
return null;
}
/**
* (experimental) The maximum number of parallel instances that are launched for creating resources.
*
* Must be at least 6.
*
* Default: 6
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMaxParallelLaunches() {
return null;
}
/**
* (experimental) The number of pre-provisioned snapshots to keep on hand for a fast-launch enabled Windows AMI.
*
* Default: 1
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getTargetResourceCount() {
return null;
}
/**
* @return a {@link Builder} of {@link FastLaunchOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link FastLaunchOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Boolean enabled;
java.lang.Number maxParallelLaunches;
java.lang.Number targetResourceCount;
/**
* Sets the value of {@link FastLaunchOptions#getEnabled}
* @param enabled Enable fast launch for AMIs generated by this builder.
* It creates a snapshot of the root volume and uses it to launch new instances faster.
*
* This is only supported for Windows AMIs.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enabled(java.lang.Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* Sets the value of {@link FastLaunchOptions#getMaxParallelLaunches}
* @param maxParallelLaunches The maximum number of parallel instances that are launched for creating resources.
* Must be at least 6.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxParallelLaunches(java.lang.Number maxParallelLaunches) {
this.maxParallelLaunches = maxParallelLaunches;
return this;
}
/**
* Sets the value of {@link FastLaunchOptions#getTargetResourceCount}
* @param targetResourceCount The number of pre-provisioned snapshots to keep on hand for a fast-launch enabled Windows AMI.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder targetResourceCount(java.lang.Number targetResourceCount) {
this.targetResourceCount = targetResourceCount;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link FastLaunchOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public FastLaunchOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link FastLaunchOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements FastLaunchOptions {
private final java.lang.Boolean enabled;
private final java.lang.Number maxParallelLaunches;
private final java.lang.Number targetResourceCount;
/**
* 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.enabled = software.amazon.jsii.Kernel.get(this, "enabled", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.maxParallelLaunches = software.amazon.jsii.Kernel.get(this, "maxParallelLaunches", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.targetResourceCount = software.amazon.jsii.Kernel.get(this, "targetResourceCount", software.amazon.jsii.NativeType.forClass(java.lang.Number.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.enabled = builder.enabled;
this.maxParallelLaunches = builder.maxParallelLaunches;
this.targetResourceCount = builder.targetResourceCount;
}
@Override
public final java.lang.Boolean getEnabled() {
return this.enabled;
}
@Override
public final java.lang.Number getMaxParallelLaunches() {
return this.maxParallelLaunches;
}
@Override
public final java.lang.Number getTargetResourceCount() {
return this.targetResourceCount;
}
@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.getEnabled() != null) {
data.set("enabled", om.valueToTree(this.getEnabled()));
}
if (this.getMaxParallelLaunches() != null) {
data.set("maxParallelLaunches", om.valueToTree(this.getMaxParallelLaunches()));
}
if (this.getTargetResourceCount() != null) {
data.set("targetResourceCount", om.valueToTree(this.getTargetResourceCount()));
}
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.FastLaunchOptions"));
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;
FastLaunchOptions.Jsii$Proxy that = (FastLaunchOptions.Jsii$Proxy) o;
if (this.enabled != null ? !this.enabled.equals(that.enabled) : that.enabled != null) return false;
if (this.maxParallelLaunches != null ? !this.maxParallelLaunches.equals(that.maxParallelLaunches) : that.maxParallelLaunches != null) return false;
return this.targetResourceCount != null ? this.targetResourceCount.equals(that.targetResourceCount) : that.targetResourceCount == null;
}
@Override
public final int hashCode() {
int result = this.enabled != null ? this.enabled.hashCode() : 0;
result = 31 * result + (this.maxParallelLaunches != null ? this.maxParallelLaunches.hashCode() : 0);
result = 31 * result + (this.targetResourceCount != null ? this.targetResourceCount.hashCode() : 0);
return result;
}
}
}