com.cloudsnorkel.cdk.github.runners.AmiBuilderProps Maven / Gradle / Ivy
Show all versions of cdk.github.runners Show documentation
package com.cloudsnorkel.cdk.github.runners;
/**
* (experimental) Properties for {@link AmiBuilder} construct.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-14T02:42:19.377Z")
@software.amazon.jsii.Jsii(module = com.cloudsnorkel.cdk.github.runners.$Module.class, fqn = "@cloudsnorkel/cdk-github-runners.AmiBuilderProps")
@software.amazon.jsii.Jsii.Proxy(AmiBuilderProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface AmiBuilderProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Image architecture.
*
* Default: Architecture.X86_64
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable com.cloudsnorkel.cdk.github.runners.Architecture getArchitecture() {
return null;
}
/**
* (experimental) Install Docker inside the image, so it can be used by the runner.
*
* Default: true
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getInstallDocker() {
return null;
}
/**
* (experimental) The instance type used to build the image.
*
* Default: m6i.large
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.InstanceType getInstanceType() {
return null;
}
/**
* (experimental) Removal policy for logs of image builds.
*
* If deployment fails on the custom resource, try setting this to RemovalPolicy.RETAIN
. This way the logs can still be viewed, and you can see why the build failed.
*
* We try to not leave anything behind when removed. But sometimes a log staying behind is useful.
*
* Default: RemovalPolicy.DESTROY
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.RemovalPolicy getLogRemovalPolicy() {
return null;
}
/**
* (experimental) The number of days log events are kept in CloudWatch Logs.
*
* When updating
* this property, unsetting it doesn't remove the log retention policy. To
* remove the retention policy, set the value to INFINITE
.
*
* Default: logs.RetentionDays.ONE_MONTH
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.logs.RetentionDays getLogRetention() {
return null;
}
/**
* (experimental) Image OS.
*
* Default: OS.LINUX
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable com.cloudsnorkel.cdk.github.runners.Os getOs() {
return null;
}
/**
* (experimental) Schedule the AMI to be rebuilt every given interval.
*
* Useful for keeping the AMI up-do-date with the latest GitHub runner version and latest OS updates.
*
* Set to zero to disable.
*
* Default: Duration.days(7)
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.Duration getRebuildInterval() {
return null;
}
/**
* (experimental) Version of GitHub Runners to install.
*
* Default: latest version available
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable com.cloudsnorkel.cdk.github.runners.RunnerVersion getRunnerVersion() {
return null;
}
/**
* (deprecated) Security group to assign to launched builder instances.
*
* Default: new security group
*
* @deprecated use {@link securityGroups }
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.ISecurityGroup getSecurityGroup() {
return null;
}
/**
* (experimental) Security groups to assign to launched builder instances.
*
* Default: new security group
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getSecurityGroups() {
return null;
}
/**
* (experimental) Where to place the network interfaces within the VPC.
*
* Only the first matched subnet will be used.
*
* Default: default VPC subnet
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.SubnetSelection getSubnetSelection() {
return null;
}
/**
* (experimental) VPC where builder instances will be launched.
*
* Default: default account VPC
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.IVpc getVpc() {
return null;
}
/**
* @return a {@link Builder} of {@link AmiBuilderProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link AmiBuilderProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
com.cloudsnorkel.cdk.github.runners.Architecture architecture;
java.lang.Boolean installDocker;
software.amazon.awscdk.services.ec2.InstanceType instanceType;
software.amazon.awscdk.RemovalPolicy logRemovalPolicy;
software.amazon.awscdk.services.logs.RetentionDays logRetention;
com.cloudsnorkel.cdk.github.runners.Os os;
software.amazon.awscdk.Duration rebuildInterval;
com.cloudsnorkel.cdk.github.runners.RunnerVersion runnerVersion;
software.amazon.awscdk.services.ec2.ISecurityGroup securityGroup;
java.util.List securityGroups;
software.amazon.awscdk.services.ec2.SubnetSelection subnetSelection;
software.amazon.awscdk.services.ec2.IVpc vpc;
/**
* Sets the value of {@link AmiBuilderProps#getArchitecture}
* @param architecture Image architecture.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder architecture(com.cloudsnorkel.cdk.github.runners.Architecture architecture) {
this.architecture = architecture;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getInstallDocker}
* @param installDocker Install Docker inside the image, so it can be used by the runner.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder installDocker(java.lang.Boolean installDocker) {
this.installDocker = installDocker;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getInstanceType}
* @param instanceType The instance type used to build the image.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder instanceType(software.amazon.awscdk.services.ec2.InstanceType instanceType) {
this.instanceType = instanceType;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getLogRemovalPolicy}
* @param logRemovalPolicy Removal policy for logs of image builds.
* If deployment fails on the custom resource, try setting this to RemovalPolicy.RETAIN
. This way the logs can still be viewed, and you can see why the build failed.
*
* We try to not leave anything behind when removed. But sometimes a log staying behind is useful.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder logRemovalPolicy(software.amazon.awscdk.RemovalPolicy logRemovalPolicy) {
this.logRemovalPolicy = logRemovalPolicy;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getLogRetention}
* @param logRetention The number of days log events are kept in CloudWatch Logs.
* When updating
* this property, unsetting it doesn't remove the log retention policy. To
* remove the retention policy, set the value to INFINITE
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder logRetention(software.amazon.awscdk.services.logs.RetentionDays logRetention) {
this.logRetention = logRetention;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getOs}
* @param os Image OS.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder os(com.cloudsnorkel.cdk.github.runners.Os os) {
this.os = os;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getRebuildInterval}
* @param rebuildInterval Schedule the AMI to be rebuilt every given interval.
* Useful for keeping the AMI up-do-date with the latest GitHub runner version and latest OS updates.
*
* Set to zero to disable.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder rebuildInterval(software.amazon.awscdk.Duration rebuildInterval) {
this.rebuildInterval = rebuildInterval;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getRunnerVersion}
* @param runnerVersion Version of GitHub Runners to install.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder runnerVersion(com.cloudsnorkel.cdk.github.runners.RunnerVersion runnerVersion) {
this.runnerVersion = runnerVersion;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getSecurityGroup}
* @param securityGroup Security group to assign to launched builder instances.
* @return {@code this}
* @deprecated use {@link securityGroups }
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder securityGroup(software.amazon.awscdk.services.ec2.ISecurityGroup securityGroup) {
this.securityGroup = securityGroup;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getSecurityGroups}
* @param securityGroups Security groups to assign to launched builder instances.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder securityGroups(java.util.List extends software.amazon.awscdk.services.ec2.ISecurityGroup> securityGroups) {
this.securityGroups = (java.util.List)securityGroups;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getSubnetSelection}
* @param subnetSelection Where to place the network interfaces within the VPC.
* Only the first matched subnet will be used.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder subnetSelection(software.amazon.awscdk.services.ec2.SubnetSelection subnetSelection) {
this.subnetSelection = subnetSelection;
return this;
}
/**
* Sets the value of {@link AmiBuilderProps#getVpc}
* @param vpc VPC where builder instances will be launched.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder vpc(software.amazon.awscdk.services.ec2.IVpc vpc) {
this.vpc = vpc;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link AmiBuilderProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public AmiBuilderProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link AmiBuilderProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements AmiBuilderProps {
private final com.cloudsnorkel.cdk.github.runners.Architecture architecture;
private final java.lang.Boolean installDocker;
private final software.amazon.awscdk.services.ec2.InstanceType instanceType;
private final software.amazon.awscdk.RemovalPolicy logRemovalPolicy;
private final software.amazon.awscdk.services.logs.RetentionDays logRetention;
private final com.cloudsnorkel.cdk.github.runners.Os os;
private final software.amazon.awscdk.Duration rebuildInterval;
private final com.cloudsnorkel.cdk.github.runners.RunnerVersion runnerVersion;
private final software.amazon.awscdk.services.ec2.ISecurityGroup securityGroup;
private final java.util.List securityGroups;
private final software.amazon.awscdk.services.ec2.SubnetSelection subnetSelection;
private final software.amazon.awscdk.services.ec2.IVpc vpc;
/**
* 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.architecture = software.amazon.jsii.Kernel.get(this, "architecture", software.amazon.jsii.NativeType.forClass(com.cloudsnorkel.cdk.github.runners.Architecture.class));
this.installDocker = software.amazon.jsii.Kernel.get(this, "installDocker", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.instanceType = software.amazon.jsii.Kernel.get(this, "instanceType", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.InstanceType.class));
this.logRemovalPolicy = software.amazon.jsii.Kernel.get(this, "logRemovalPolicy", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.RemovalPolicy.class));
this.logRetention = software.amazon.jsii.Kernel.get(this, "logRetention", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.logs.RetentionDays.class));
this.os = software.amazon.jsii.Kernel.get(this, "os", software.amazon.jsii.NativeType.forClass(com.cloudsnorkel.cdk.github.runners.Os.class));
this.rebuildInterval = software.amazon.jsii.Kernel.get(this, "rebuildInterval", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.class));
this.runnerVersion = software.amazon.jsii.Kernel.get(this, "runnerVersion", software.amazon.jsii.NativeType.forClass(com.cloudsnorkel.cdk.github.runners.RunnerVersion.class));
this.securityGroup = software.amazon.jsii.Kernel.get(this, "securityGroup", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.ISecurityGroup.class));
this.securityGroups = software.amazon.jsii.Kernel.get(this, "securityGroups", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.ISecurityGroup.class)));
this.subnetSelection = software.amazon.jsii.Kernel.get(this, "subnetSelection", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.SubnetSelection.class));
this.vpc = software.amazon.jsii.Kernel.get(this, "vpc", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.IVpc.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.architecture = builder.architecture;
this.installDocker = builder.installDocker;
this.instanceType = builder.instanceType;
this.logRemovalPolicy = builder.logRemovalPolicy;
this.logRetention = builder.logRetention;
this.os = builder.os;
this.rebuildInterval = builder.rebuildInterval;
this.runnerVersion = builder.runnerVersion;
this.securityGroup = builder.securityGroup;
this.securityGroups = (java.util.List)builder.securityGroups;
this.subnetSelection = builder.subnetSelection;
this.vpc = builder.vpc;
}
@Override
public final com.cloudsnorkel.cdk.github.runners.Architecture getArchitecture() {
return this.architecture;
}
@Override
public final java.lang.Boolean getInstallDocker() {
return this.installDocker;
}
@Override
public final software.amazon.awscdk.services.ec2.InstanceType getInstanceType() {
return this.instanceType;
}
@Override
public final software.amazon.awscdk.RemovalPolicy getLogRemovalPolicy() {
return this.logRemovalPolicy;
}
@Override
public final software.amazon.awscdk.services.logs.RetentionDays getLogRetention() {
return this.logRetention;
}
@Override
public final com.cloudsnorkel.cdk.github.runners.Os getOs() {
return this.os;
}
@Override
public final software.amazon.awscdk.Duration getRebuildInterval() {
return this.rebuildInterval;
}
@Override
public final com.cloudsnorkel.cdk.github.runners.RunnerVersion getRunnerVersion() {
return this.runnerVersion;
}
@Override
public final software.amazon.awscdk.services.ec2.ISecurityGroup getSecurityGroup() {
return this.securityGroup;
}
@Override
public final java.util.List getSecurityGroups() {
return this.securityGroups;
}
@Override
public final software.amazon.awscdk.services.ec2.SubnetSelection getSubnetSelection() {
return this.subnetSelection;
}
@Override
public final software.amazon.awscdk.services.ec2.IVpc getVpc() {
return this.vpc;
}
@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.getArchitecture() != null) {
data.set("architecture", om.valueToTree(this.getArchitecture()));
}
if (this.getInstallDocker() != null) {
data.set("installDocker", om.valueToTree(this.getInstallDocker()));
}
if (this.getInstanceType() != null) {
data.set("instanceType", om.valueToTree(this.getInstanceType()));
}
if (this.getLogRemovalPolicy() != null) {
data.set("logRemovalPolicy", om.valueToTree(this.getLogRemovalPolicy()));
}
if (this.getLogRetention() != null) {
data.set("logRetention", om.valueToTree(this.getLogRetention()));
}
if (this.getOs() != null) {
data.set("os", om.valueToTree(this.getOs()));
}
if (this.getRebuildInterval() != null) {
data.set("rebuildInterval", om.valueToTree(this.getRebuildInterval()));
}
if (this.getRunnerVersion() != null) {
data.set("runnerVersion", om.valueToTree(this.getRunnerVersion()));
}
if (this.getSecurityGroup() != null) {
data.set("securityGroup", om.valueToTree(this.getSecurityGroup()));
}
if (this.getSecurityGroups() != null) {
data.set("securityGroups", om.valueToTree(this.getSecurityGroups()));
}
if (this.getSubnetSelection() != null) {
data.set("subnetSelection", om.valueToTree(this.getSubnetSelection()));
}
if (this.getVpc() != null) {
data.set("vpc", om.valueToTree(this.getVpc()));
}
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.AmiBuilderProps"));
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;
AmiBuilderProps.Jsii$Proxy that = (AmiBuilderProps.Jsii$Proxy) o;
if (this.architecture != null ? !this.architecture.equals(that.architecture) : that.architecture != null) return false;
if (this.installDocker != null ? !this.installDocker.equals(that.installDocker) : that.installDocker != null) return false;
if (this.instanceType != null ? !this.instanceType.equals(that.instanceType) : that.instanceType != null) return false;
if (this.logRemovalPolicy != null ? !this.logRemovalPolicy.equals(that.logRemovalPolicy) : that.logRemovalPolicy != null) return false;
if (this.logRetention != null ? !this.logRetention.equals(that.logRetention) : that.logRetention != null) return false;
if (this.os != null ? !this.os.equals(that.os) : that.os != null) return false;
if (this.rebuildInterval != null ? !this.rebuildInterval.equals(that.rebuildInterval) : that.rebuildInterval != null) return false;
if (this.runnerVersion != null ? !this.runnerVersion.equals(that.runnerVersion) : that.runnerVersion != null) return false;
if (this.securityGroup != null ? !this.securityGroup.equals(that.securityGroup) : that.securityGroup != null) return false;
if (this.securityGroups != null ? !this.securityGroups.equals(that.securityGroups) : that.securityGroups != null) return false;
if (this.subnetSelection != null ? !this.subnetSelection.equals(that.subnetSelection) : that.subnetSelection != null) return false;
return this.vpc != null ? this.vpc.equals(that.vpc) : that.vpc == null;
}
@Override
public final int hashCode() {
int result = this.architecture != null ? this.architecture.hashCode() : 0;
result = 31 * result + (this.installDocker != null ? this.installDocker.hashCode() : 0);
result = 31 * result + (this.instanceType != null ? this.instanceType.hashCode() : 0);
result = 31 * result + (this.logRemovalPolicy != null ? this.logRemovalPolicy.hashCode() : 0);
result = 31 * result + (this.logRetention != null ? this.logRetention.hashCode() : 0);
result = 31 * result + (this.os != null ? this.os.hashCode() : 0);
result = 31 * result + (this.rebuildInterval != null ? this.rebuildInterval.hashCode() : 0);
result = 31 * result + (this.runnerVersion != null ? this.runnerVersion.hashCode() : 0);
result = 31 * result + (this.securityGroup != null ? this.securityGroup.hashCode() : 0);
result = 31 * result + (this.securityGroups != null ? this.securityGroups.hashCode() : 0);
result = 31 * result + (this.subnetSelection != null ? this.subnetSelection.hashCode() : 0);
result = 31 * result + (this.vpc != null ? this.vpc.hashCode() : 0);
return result;
}
}
}