software.amazon.awscdk.services.eks.Selector Maven / Gradle / Ivy
package software.amazon.awscdk.services.eks;
/**
* Fargate profile selector.
*
* Example:
*
*
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import software.amazon.awscdk.services.eks.*;
* Selector selector = Selector.builder()
* .namespace("namespace")
* // the properties below are optional
* .labels(Map.of(
* "labelsKey", "labels"))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.74.0 (build 6d08790)", date = "2023-03-22T19:35:49.105Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.eks.$Module.class, fqn = "@aws-cdk/aws-eks.Selector")
@software.amazon.jsii.Jsii.Proxy(Selector.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface Selector extends software.amazon.jsii.JsiiSerializable {
/**
* The Kubernetes namespace that the selector should match.
*
* You must specify a namespace for a selector. The selector only matches pods
* that are created in this namespace, but you can create multiple selectors
* to target multiple namespaces.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getNamespace();
/**
* The Kubernetes labels that the selector should match.
*
* A pod must contain
* all of the labels that are specified in the selector for it to be
* considered a match.
*
* Default: - all pods within the namespace will be selected.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.Map getLabels() {
return null;
}
/**
* @return a {@link Builder} of {@link Selector}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link Selector}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String namespace;
java.util.Map labels;
/**
* Sets the value of {@link Selector#getNamespace}
* @param namespace The Kubernetes namespace that the selector should match. This parameter is required.
* You must specify a namespace for a selector. The selector only matches pods
* that are created in this namespace, but you can create multiple selectors
* to target multiple namespaces.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder namespace(java.lang.String namespace) {
this.namespace = namespace;
return this;
}
/**
* Sets the value of {@link Selector#getLabels}
* @param labels The Kubernetes labels that the selector should match.
* A pod must contain
* all of the labels that are specified in the selector for it to be
* considered a match.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder labels(java.util.Map labels) {
this.labels = labels;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link Selector}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public Selector build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link Selector}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Selector {
private final java.lang.String namespace;
private final java.util.Map labels;
/**
* 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.namespace = software.amazon.jsii.Kernel.get(this, "namespace", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.labels = software.amazon.jsii.Kernel.get(this, "labels", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.String.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.namespace = java.util.Objects.requireNonNull(builder.namespace, "namespace is required");
this.labels = builder.labels;
}
@Override
public final java.lang.String getNamespace() {
return this.namespace;
}
@Override
public final java.util.Map getLabels() {
return this.labels;
}
@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("namespace", om.valueToTree(this.getNamespace()));
if (this.getLabels() != null) {
data.set("labels", om.valueToTree(this.getLabels()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-eks.Selector"));
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;
Selector.Jsii$Proxy that = (Selector.Jsii$Proxy) o;
if (!namespace.equals(that.namespace)) return false;
return this.labels != null ? this.labels.equals(that.labels) : that.labels == null;
}
@Override
public final int hashCode() {
int result = this.namespace.hashCode();
result = 31 * result + (this.labels != null ? this.labels.hashCode() : 0);
return result;
}
}
}