org.cdk8s.plus22.ServiceAccount Maven / Gradle / Ivy
Show all versions of cdk8s-plus-22 Show documentation
package org.cdk8s.plus22;
/**
* A service account provides an identity for processes that run in a Pod.
*
* When you (a human) access the cluster (for example, using kubectl), you are
* authenticated by the apiserver as a particular User Account (currently this
* is usually admin, unless your cluster administrator has customized your
* cluster). Processes in containers inside pods can also contact the apiserver.
* When they do, they are authenticated as a particular Service Account (for
* example, default).
*
* @see https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.47.0 (build 86d2c33)", date = "2021-12-08T00:16:55.121Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = org.cdk8s.plus22.$Module.class, fqn = "cdk8s-plus-22.ServiceAccount")
public class ServiceAccount extends org.cdk8s.plus22.Resource implements org.cdk8s.plus22.IServiceAccount {
protected ServiceAccount(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected ServiceAccount(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public ServiceAccount(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable org.cdk8s.plus22.ServiceAccountProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), props });
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public ServiceAccount(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* Imports a service account from the cluster as a reference.
*
* @param name The name of the service account resource. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.plus22.IServiceAccount fromServiceAccountName(final @org.jetbrains.annotations.NotNull java.lang.String name) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.plus22.ServiceAccount.class, "fromServiceAccountName", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus22.IServiceAccount.class), new Object[] { java.util.Objects.requireNonNull(name, "name is required") });
}
/**
* Allow a secret to be accessed by pods using this service account.
*
* @param secret The secret. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void addSecret(final @org.jetbrains.annotations.NotNull org.cdk8s.plus22.ISecret secret) {
software.amazon.jsii.Kernel.call(this, "addSecret", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(secret, "secret is required") });
}
/**
* The underlying cdk8s API object.
*
* @see base.Resource.apiObject
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
protected @org.jetbrains.annotations.NotNull org.cdk8s.ApiObject getApiObject() {
return software.amazon.jsii.Kernel.get(this, "apiObject", software.amazon.jsii.NativeType.forClass(org.cdk8s.ApiObject.class));
}
/**
* List of secrets allowed to be used by pods running using this service account.
*
* Returns a copy. To add a secret, use addSecret()
.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.util.List getSecrets() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "secrets", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus22.ISecret.class))));
}
/**
* A fluent builder for {@link org.cdk8s.plus22.ServiceAccount}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private org.cdk8s.plus22.ServiceAccountProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
}
/**
* Metadata that all persisted resources must have, which includes all objects users must create.
*
* @return {@code this}
* @param metadata Metadata that all persisted resources must have, which includes all objects users must create. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder metadata(final org.cdk8s.ApiObjectMetadata metadata) {
this.props().metadata(metadata);
return this;
}
/**
* List of secrets allowed to be used by pods running using this ServiceAccount.
*
* @return {@code this}
* @see https://kubernetes.io/docs/concepts/configuration/secret
* @param secrets List of secrets allowed to be used by pods running using this ServiceAccount. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder secrets(final java.util.List extends org.cdk8s.plus22.ISecret> secrets) {
this.props().secrets(secrets);
return this;
}
/**
* @returns a newly built instance of {@link org.cdk8s.plus22.ServiceAccount}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public org.cdk8s.plus22.ServiceAccount build() {
return new org.cdk8s.plus22.ServiceAccount(
this.scope,
this.id,
this.props != null ? this.props.build() : null
);
}
private org.cdk8s.plus22.ServiceAccountProps.Builder props() {
if (this.props == null) {
this.props = new org.cdk8s.plus22.ServiceAccountProps.Builder();
}
return this.props;
}
}
}