
org.cdk8s.plus23.k8s.KubeRoleBindingProps Maven / Gradle / Ivy
package org.cdk8s.plus23.k8s;
/**
* RoleBinding references a role, but does not contain it.
*
* It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.75.0 (build 63bb957)", date = "2023-02-21T09:46:03.944Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.plus23.$Module.class, fqn = "cdk8s-plus-23.k8s.KubeRoleBindingProps")
@software.amazon.jsii.Jsii.Proxy(KubeRoleBindingProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface KubeRoleBindingProps extends software.amazon.jsii.JsiiSerializable {
/**
* RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace.
*
* If the RoleRef cannot be resolved, the Authorizer must return an error.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull org.cdk8s.plus23.k8s.RoleRef getRoleRef();
/**
* Standard object's metadata.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.plus23.k8s.ObjectMeta getMetadata() {
return null;
}
/**
* Subjects holds references to the objects the role applies to.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getSubjects() {
return null;
}
/**
* @return a {@link Builder} of {@link KubeRoleBindingProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link KubeRoleBindingProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
org.cdk8s.plus23.k8s.RoleRef roleRef;
org.cdk8s.plus23.k8s.ObjectMeta metadata;
java.util.List subjects;
/**
* Sets the value of {@link KubeRoleBindingProps#getRoleRef}
* @param roleRef RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. This parameter is required.
* If the RoleRef cannot be resolved, the Authorizer must return an error.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder roleRef(org.cdk8s.plus23.k8s.RoleRef roleRef) {
this.roleRef = roleRef;
return this;
}
/**
* Sets the value of {@link KubeRoleBindingProps#getMetadata}
* @param metadata Standard object's metadata.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder metadata(org.cdk8s.plus23.k8s.ObjectMeta metadata) {
this.metadata = metadata;
return this;
}
/**
* Sets the value of {@link KubeRoleBindingProps#getSubjects}
* @param subjects Subjects holds references to the objects the role applies to.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder subjects(java.util.List extends org.cdk8s.plus23.k8s.Subject> subjects) {
this.subjects = (java.util.List)subjects;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link KubeRoleBindingProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public KubeRoleBindingProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link KubeRoleBindingProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements KubeRoleBindingProps {
private final org.cdk8s.plus23.k8s.RoleRef roleRef;
private final org.cdk8s.plus23.k8s.ObjectMeta metadata;
private final java.util.List subjects;
/**
* 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.roleRef = software.amazon.jsii.Kernel.get(this, "roleRef", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.k8s.RoleRef.class));
this.metadata = software.amazon.jsii.Kernel.get(this, "metadata", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.k8s.ObjectMeta.class));
this.subjects = software.amazon.jsii.Kernel.get(this, "subjects", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.k8s.Subject.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.roleRef = java.util.Objects.requireNonNull(builder.roleRef, "roleRef is required");
this.metadata = builder.metadata;
this.subjects = (java.util.List)builder.subjects;
}
@Override
public final org.cdk8s.plus23.k8s.RoleRef getRoleRef() {
return this.roleRef;
}
@Override
public final org.cdk8s.plus23.k8s.ObjectMeta getMetadata() {
return this.metadata;
}
@Override
public final java.util.List getSubjects() {
return this.subjects;
}
@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("roleRef", om.valueToTree(this.getRoleRef()));
if (this.getMetadata() != null) {
data.set("metadata", om.valueToTree(this.getMetadata()));
}
if (this.getSubjects() != null) {
data.set("subjects", om.valueToTree(this.getSubjects()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk8s-plus-23.k8s.KubeRoleBindingProps"));
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;
KubeRoleBindingProps.Jsii$Proxy that = (KubeRoleBindingProps.Jsii$Proxy) o;
if (!roleRef.equals(that.roleRef)) return false;
if (this.metadata != null ? !this.metadata.equals(that.metadata) : that.metadata != null) return false;
return this.subjects != null ? this.subjects.equals(that.subjects) : that.subjects == null;
}
@Override
public final int hashCode() {
int result = this.roleRef.hashCode();
result = 31 * result + (this.metadata != null ? this.metadata.hashCode() : 0);
result = 31 * result + (this.subjects != null ? this.subjects.hashCode() : 0);
return result;
}
}
}