io.github.cdklabs.cdk.stacksets.SelfManagedOptions Maven / Gradle / Ivy
package io.github.cdklabs.cdk.stacksets;
/**
* (experimental) Options for StackSets that are not managed by AWS Organizations.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.83.0 (build fd4544d)", date = "2023-06-13T00:17:42.429Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdk.stacksets.$Module.class, fqn = "cdk-stacksets.SelfManagedOptions")
@software.amazon.jsii.Jsii.Proxy(SelfManagedOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface SelfManagedOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The admin role that CloudFormation will use to perform stackset operations.
*
* This role should only have permissions to be assumed by the CloudFormation service
* and to assume the execution role in each individual account.
*
* When you create the execution role it must have an assume role policy statement which
* allows sts:AssumeRole
from this admin role.
*
* To grant specific users/groups access to use this role to deploy stacksets they must have
* a policy that allows iam:GetRole
& iam:PassRole
on this role resource.
*
* Default: - a default role will be created
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.iam.IRole getAdminRole() {
return null;
}
/**
* (experimental) The name of the stackset execution role that already exists in each target AWS account.
*
* This role must be configured with a trust policy that allows sts:AssumeRole
from the adminRole
.
*
* In addition this role must have the necessary permissions to manage the resources created by the stackset.
*
* Default: - AWSCloudFormationStackSetExecutionRole
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-self-managed.html#stacksets-prereqs-accountsetup
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getExecutionRoleName() {
return null;
}
/**
* @return a {@link Builder} of {@link SelfManagedOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link SelfManagedOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.iam.IRole adminRole;
java.lang.String executionRoleName;
/**
* Sets the value of {@link SelfManagedOptions#getAdminRole}
* @param adminRole The admin role that CloudFormation will use to perform stackset operations.
* This role should only have permissions to be assumed by the CloudFormation service
* and to assume the execution role in each individual account.
*
* When you create the execution role it must have an assume role policy statement which
* allows sts:AssumeRole
from this admin role.
*
* To grant specific users/groups access to use this role to deploy stacksets they must have
* a policy that allows iam:GetRole
& iam:PassRole
on this role resource.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder adminRole(software.amazon.awscdk.services.iam.IRole adminRole) {
this.adminRole = adminRole;
return this;
}
/**
* Sets the value of {@link SelfManagedOptions#getExecutionRoleName}
* @param executionRoleName The name of the stackset execution role that already exists in each target AWS account.
* This role must be configured with a trust policy that allows sts:AssumeRole
from the adminRole
.
*
* In addition this role must have the necessary permissions to manage the resources created by the stackset.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder executionRoleName(java.lang.String executionRoleName) {
this.executionRoleName = executionRoleName;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link SelfManagedOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public SelfManagedOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link SelfManagedOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements SelfManagedOptions {
private final software.amazon.awscdk.services.iam.IRole adminRole;
private final java.lang.String executionRoleName;
/**
* 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.adminRole = software.amazon.jsii.Kernel.get(this, "adminRole", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IRole.class));
this.executionRoleName = software.amazon.jsii.Kernel.get(this, "executionRoleName", 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.adminRole = builder.adminRole;
this.executionRoleName = builder.executionRoleName;
}
@Override
public final software.amazon.awscdk.services.iam.IRole getAdminRole() {
return this.adminRole;
}
@Override
public final java.lang.String getExecutionRoleName() {
return this.executionRoleName;
}
@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.getAdminRole() != null) {
data.set("adminRole", om.valueToTree(this.getAdminRole()));
}
if (this.getExecutionRoleName() != null) {
data.set("executionRoleName", om.valueToTree(this.getExecutionRoleName()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk-stacksets.SelfManagedOptions"));
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;
SelfManagedOptions.Jsii$Proxy that = (SelfManagedOptions.Jsii$Proxy) o;
if (this.adminRole != null ? !this.adminRole.equals(that.adminRole) : that.adminRole != null) return false;
return this.executionRoleName != null ? this.executionRoleName.equals(that.executionRoleName) : that.executionRoleName == null;
}
@Override
public final int hashCode() {
int result = this.adminRole != null ? this.adminRole.hashCode() : 0;
result = 31 * result + (this.executionRoleName != null ? this.executionRoleName.hashCode() : 0);
return result;
}
}
}