com.pepperize.cdk.autoscaling_gitlab_runner.GitlabRunnerAutoscalingJobRunnerProps Maven / Gradle / Ivy
Show all versions of cdk-autoscaling-gitlab-runner Show documentation
package com.pepperize.cdk.autoscaling_gitlab_runner;
/**
* The runner EC2 instances configuration.
*
* If not set, the defaults will be used.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.98.0 (build 00b106d)", date = "2024-05-01T02:44:42.316Z")
@software.amazon.jsii.Jsii(module = com.pepperize.cdk.autoscaling_gitlab_runner.$Module.class, fqn = "@pepperize/cdk-autoscaling-gitlab-runner.GitlabRunnerAutoscalingJobRunnerProps")
@software.amazon.jsii.Jsii.Proxy(GitlabRunnerAutoscalingJobRunnerProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface GitlabRunnerAutoscalingJobRunnerProps extends software.amazon.jsii.JsiiSerializable {
/**
* The runner EC2 instances configuration.
*
* If not set, the defaults will be used.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull com.pepperize.cdk.autoscaling_gitlab_runner.RunnerConfiguration getConfiguration();
/**
* The runner’s authentication token, which is obtained during runner registration.
*
* Not the same as the registration token.
*
* @see https://docs.gitlab.com/ee/api/runners.html#register-a-new-runner
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ssm.IStringParameter getToken();
/**
* Instance type for runner EC2 instances.
*
* It's a combination of a class and size.
*
* Default: InstanceType.of(InstanceClass.T3, InstanceSize.MICRO)
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.InstanceType getInstanceType() {
return null;
}
/**
* Optionally pass a custom EC2 KeyPair, that will be used by the manager to connect to the job runner instances.
*
*
* - Example: aws secretsmanager create-secret --name AnyKeyPairSecret --secret-string "{\"theKeyPairName\":\"
\",\"theKeyPairName.pub\":\"\"}"
* - Additionally configure an unique key pair configuration.machine.machineOptions.keypairName
*
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.secretsmanager.ISecret getKeyPair() {
return null;
}
/**
* An Amazon Machine Image ID for the Runners EC2 instances.
*
* If empty the latest Ubuntu 20.04 focal will be looked up.
*
* Any operating system supported by Docker Machine's provisioner.
*
* @see https://gitlab.com/gitlab-org/ci-cd/docker-machine/-/tree/main/libmachine/provision
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.IMachineImage getMachineImage() {
return null;
}
/**
* Optionally pass an IAM role, that get's assigned to the EC2 runner instances via Instance Profile.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.iam.IRole getRole() {
return null;
}
/**
* @return a {@link Builder} of {@link GitlabRunnerAutoscalingJobRunnerProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link GitlabRunnerAutoscalingJobRunnerProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
com.pepperize.cdk.autoscaling_gitlab_runner.RunnerConfiguration configuration;
software.amazon.awscdk.services.ssm.IStringParameter token;
software.amazon.awscdk.services.ec2.InstanceType instanceType;
software.amazon.awscdk.services.secretsmanager.ISecret keyPair;
software.amazon.awscdk.services.ec2.IMachineImage machineImage;
software.amazon.awscdk.services.iam.IRole role;
/**
* Sets the value of {@link GitlabRunnerAutoscalingJobRunnerProps#getConfiguration}
* @param configuration The runner EC2 instances configuration. This parameter is required.
* If not set, the defaults will be used.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder configuration(com.pepperize.cdk.autoscaling_gitlab_runner.RunnerConfiguration configuration) {
this.configuration = configuration;
return this;
}
/**
* Sets the value of {@link GitlabRunnerAutoscalingJobRunnerProps#getToken}
* @param token The runner’s authentication token, which is obtained during runner registration. This parameter is required.
* Not the same as the registration token.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder token(software.amazon.awscdk.services.ssm.IStringParameter token) {
this.token = token;
return this;
}
/**
* Sets the value of {@link GitlabRunnerAutoscalingJobRunnerProps#getInstanceType}
* @param instanceType Instance type for runner EC2 instances.
* It's a combination of a class and size.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder instanceType(software.amazon.awscdk.services.ec2.InstanceType instanceType) {
this.instanceType = instanceType;
return this;
}
/**
* Sets the value of {@link GitlabRunnerAutoscalingJobRunnerProps#getKeyPair}
* @param keyPair Optionally pass a custom EC2 KeyPair, that will be used by the manager to connect to the job runner instances.
*
* - Example: aws secretsmanager create-secret --name AnyKeyPairSecret --secret-string "{\"theKeyPairName\":\"
\",\"theKeyPairName.pub\":\"\"}"
* - Additionally configure an unique key pair configuration.machine.machineOptions.keypairName
*
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder keyPair(software.amazon.awscdk.services.secretsmanager.ISecret keyPair) {
this.keyPair = keyPair;
return this;
}
/**
* Sets the value of {@link GitlabRunnerAutoscalingJobRunnerProps#getMachineImage}
* @param machineImage An Amazon Machine Image ID for the Runners EC2 instances.
* If empty the latest Ubuntu 20.04 focal will be looked up.
*
* Any operating system supported by Docker Machine's provisioner.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder machineImage(software.amazon.awscdk.services.ec2.IMachineImage machineImage) {
this.machineImage = machineImage;
return this;
}
/**
* Sets the value of {@link GitlabRunnerAutoscalingJobRunnerProps#getRole}
* @param role Optionally pass an IAM role, that get's assigned to the EC2 runner instances via Instance Profile.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder role(software.amazon.awscdk.services.iam.IRole role) {
this.role = role;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link GitlabRunnerAutoscalingJobRunnerProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public GitlabRunnerAutoscalingJobRunnerProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link GitlabRunnerAutoscalingJobRunnerProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements GitlabRunnerAutoscalingJobRunnerProps {
private final com.pepperize.cdk.autoscaling_gitlab_runner.RunnerConfiguration configuration;
private final software.amazon.awscdk.services.ssm.IStringParameter token;
private final software.amazon.awscdk.services.ec2.InstanceType instanceType;
private final software.amazon.awscdk.services.secretsmanager.ISecret keyPair;
private final software.amazon.awscdk.services.ec2.IMachineImage machineImage;
private final software.amazon.awscdk.services.iam.IRole role;
/**
* 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.configuration = software.amazon.jsii.Kernel.get(this, "configuration", software.amazon.jsii.NativeType.forClass(com.pepperize.cdk.autoscaling_gitlab_runner.RunnerConfiguration.class));
this.token = software.amazon.jsii.Kernel.get(this, "token", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ssm.IStringParameter.class));
this.instanceType = software.amazon.jsii.Kernel.get(this, "instanceType", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.InstanceType.class));
this.keyPair = software.amazon.jsii.Kernel.get(this, "keyPair", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.secretsmanager.ISecret.class));
this.machineImage = software.amazon.jsii.Kernel.get(this, "machineImage", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.IMachineImage.class));
this.role = software.amazon.jsii.Kernel.get(this, "role", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IRole.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.configuration = java.util.Objects.requireNonNull(builder.configuration, "configuration is required");
this.token = java.util.Objects.requireNonNull(builder.token, "token is required");
this.instanceType = builder.instanceType;
this.keyPair = builder.keyPair;
this.machineImage = builder.machineImage;
this.role = builder.role;
}
@Override
public final com.pepperize.cdk.autoscaling_gitlab_runner.RunnerConfiguration getConfiguration() {
return this.configuration;
}
@Override
public final software.amazon.awscdk.services.ssm.IStringParameter getToken() {
return this.token;
}
@Override
public final software.amazon.awscdk.services.ec2.InstanceType getInstanceType() {
return this.instanceType;
}
@Override
public final software.amazon.awscdk.services.secretsmanager.ISecret getKeyPair() {
return this.keyPair;
}
@Override
public final software.amazon.awscdk.services.ec2.IMachineImage getMachineImage() {
return this.machineImage;
}
@Override
public final software.amazon.awscdk.services.iam.IRole getRole() {
return this.role;
}
@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();
data.set("configuration", om.valueToTree(this.getConfiguration()));
data.set("token", om.valueToTree(this.getToken()));
if (this.getInstanceType() != null) {
data.set("instanceType", om.valueToTree(this.getInstanceType()));
}
if (this.getKeyPair() != null) {
data.set("keyPair", om.valueToTree(this.getKeyPair()));
}
if (this.getMachineImage() != null) {
data.set("machineImage", om.valueToTree(this.getMachineImage()));
}
if (this.getRole() != null) {
data.set("role", om.valueToTree(this.getRole()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@pepperize/cdk-autoscaling-gitlab-runner.GitlabRunnerAutoscalingJobRunnerProps"));
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;
GitlabRunnerAutoscalingJobRunnerProps.Jsii$Proxy that = (GitlabRunnerAutoscalingJobRunnerProps.Jsii$Proxy) o;
if (!configuration.equals(that.configuration)) return false;
if (!token.equals(that.token)) return false;
if (this.instanceType != null ? !this.instanceType.equals(that.instanceType) : that.instanceType != null) return false;
if (this.keyPair != null ? !this.keyPair.equals(that.keyPair) : that.keyPair != null) return false;
if (this.machineImage != null ? !this.machineImage.equals(that.machineImage) : that.machineImage != null) return false;
return this.role != null ? this.role.equals(that.role) : that.role == null;
}
@Override
public final int hashCode() {
int result = this.configuration.hashCode();
result = 31 * result + (this.token.hashCode());
result = 31 * result + (this.instanceType != null ? this.instanceType.hashCode() : 0);
result = 31 * result + (this.keyPair != null ? this.keyPair.hashCode() : 0);
result = 31 * result + (this.machineImage != null ? this.machineImage.hashCode() : 0);
result = 31 * result + (this.role != null ? this.role.hashCode() : 0);
return result;
}
}
}