software.amazon.awscdk.services.vpclattice.CfnRuleProps Maven / Gradle / Ivy
Show all versions of vpclattice Show documentation
package software.amazon.awscdk.services.vpclattice;
/**
* Properties for defining a `CfnRule`.
*
* 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.vpclattice.*;
* CfnRuleProps cfnRuleProps = CfnRuleProps.builder()
* .action(ActionProperty.builder()
* .fixedResponse(FixedResponseProperty.builder()
* .statusCode(123)
* .build())
* .forward(ForwardProperty.builder()
* .targetGroups(List.of(WeightedTargetGroupProperty.builder()
* .targetGroupIdentifier("targetGroupIdentifier")
* // the properties below are optional
* .weight(123)
* .build()))
* .build())
* .build())
* .match(MatchProperty.builder()
* .httpMatch(HttpMatchProperty.builder()
* .headerMatches(List.of(HeaderMatchProperty.builder()
* .match(HeaderMatchTypeProperty.builder()
* .contains("contains")
* .exact("exact")
* .prefix("prefix")
* .build())
* .name("name")
* // the properties below are optional
* .caseSensitive(false)
* .build()))
* .method("method")
* .pathMatch(PathMatchProperty.builder()
* .match(PathMatchTypeProperty.builder()
* .exact("exact")
* .prefix("prefix")
* .build())
* // the properties below are optional
* .caseSensitive(false)
* .build())
* .build())
* .build())
* .priority(123)
* // the properties below are optional
* .listenerIdentifier("listenerIdentifier")
* .name("name")
* .serviceIdentifier("serviceIdentifier")
* .tags(List.of(CfnTag.builder()
* .key("key")
* .value("value")
* .build()))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.74.0 (build 6d08790)", date = "2023-05-19T23:09:23.231Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.vpclattice.$Module.class, fqn = "@aws-cdk/aws-vpclattice.CfnRuleProps")
@software.amazon.jsii.Jsii.Proxy(CfnRuleProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface CfnRuleProps extends software.amazon.jsii.JsiiSerializable {
/**
* Describes the action for a rule.
*
* Each rule must include exactly one of the following types of actions: forward
or fixed-response
, and it must be the last action to be performed.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.Object getAction();
/**
* The rule match.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.Object getMatch();
/**
* The priority assigned to the rule.
*
* Each rule for a specific listener must have a unique priority. The lower the priority number the higher the priority.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.Number getPriority();
/**
* The ID or Amazon Resource Name (ARN) of the listener.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getListenerIdentifier() {
return null;
}
/**
* The name of the rule.
*
* The name must be unique within the listener. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.
*
* If you don't specify a name, CloudFormation generates one. However, if you specify a name, and later want to replace the resource, you must specify a new name.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getName() {
return null;
}
/**
* The ID or Amazon Resource Name (ARN) of the service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getServiceIdentifier() {
return null;
}
/**
* The tags for the rule.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getTags() {
return null;
}
/**
* @return a {@link Builder} of {@link CfnRuleProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link CfnRuleProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Object action;
java.lang.Object match;
java.lang.Number priority;
java.lang.String listenerIdentifier;
java.lang.String name;
java.lang.String serviceIdentifier;
java.util.List tags;
/**
* Sets the value of {@link CfnRuleProps#getAction}
* @param action Describes the action for a rule. This parameter is required.
* Each rule must include exactly one of the following types of actions: forward
or fixed-response
, and it must be the last action to be performed.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder action(software.amazon.awscdk.core.IResolvable action) {
this.action = action;
return this;
}
/**
* Sets the value of {@link CfnRuleProps#getAction}
* @param action Describes the action for a rule. This parameter is required.
* Each rule must include exactly one of the following types of actions: forward
or fixed-response
, and it must be the last action to be performed.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder action(software.amazon.awscdk.services.vpclattice.CfnRule.ActionProperty action) {
this.action = action;
return this;
}
/**
* Sets the value of {@link CfnRuleProps#getMatch}
* @param match The rule match. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder match(software.amazon.awscdk.core.IResolvable match) {
this.match = match;
return this;
}
/**
* Sets the value of {@link CfnRuleProps#getMatch}
* @param match The rule match. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder match(software.amazon.awscdk.services.vpclattice.CfnRule.MatchProperty match) {
this.match = match;
return this;
}
/**
* Sets the value of {@link CfnRuleProps#getPriority}
* @param priority The priority assigned to the rule. This parameter is required.
* Each rule for a specific listener must have a unique priority. The lower the priority number the higher the priority.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder priority(java.lang.Number priority) {
this.priority = priority;
return this;
}
/**
* Sets the value of {@link CfnRuleProps#getListenerIdentifier}
* @param listenerIdentifier The ID or Amazon Resource Name (ARN) of the listener.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder listenerIdentifier(java.lang.String listenerIdentifier) {
this.listenerIdentifier = listenerIdentifier;
return this;
}
/**
* Sets the value of {@link CfnRuleProps#getName}
* @param name The name of the rule.
* The name must be unique within the listener. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.
*
* If you don't specify a name, CloudFormation generates one. However, if you specify a name, and later want to replace the resource, you must specify a new name.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder name(java.lang.String name) {
this.name = name;
return this;
}
/**
* Sets the value of {@link CfnRuleProps#getServiceIdentifier}
* @param serviceIdentifier The ID or Amazon Resource Name (ARN) of the service.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder serviceIdentifier(java.lang.String serviceIdentifier) {
this.serviceIdentifier = serviceIdentifier;
return this;
}
/**
* Sets the value of {@link CfnRuleProps#getTags}
* @param tags The tags for the rule.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder tags(java.util.List extends software.amazon.awscdk.core.CfnTag> tags) {
this.tags = (java.util.List)tags;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link CfnRuleProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public CfnRuleProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link CfnRuleProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements CfnRuleProps {
private final java.lang.Object action;
private final java.lang.Object match;
private final java.lang.Number priority;
private final java.lang.String listenerIdentifier;
private final java.lang.String name;
private final java.lang.String serviceIdentifier;
private final java.util.List tags;
/**
* 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.action = software.amazon.jsii.Kernel.get(this, "action", software.amazon.jsii.NativeType.forClass(java.lang.Object.class));
this.match = software.amazon.jsii.Kernel.get(this, "match", software.amazon.jsii.NativeType.forClass(java.lang.Object.class));
this.priority = software.amazon.jsii.Kernel.get(this, "priority", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.listenerIdentifier = software.amazon.jsii.Kernel.get(this, "listenerIdentifier", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.name = software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.serviceIdentifier = software.amazon.jsii.Kernel.get(this, "serviceIdentifier", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.tags = software.amazon.jsii.Kernel.get(this, "tags", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.CfnTag.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.action = java.util.Objects.requireNonNull(builder.action, "action is required");
this.match = java.util.Objects.requireNonNull(builder.match, "match is required");
this.priority = java.util.Objects.requireNonNull(builder.priority, "priority is required");
this.listenerIdentifier = builder.listenerIdentifier;
this.name = builder.name;
this.serviceIdentifier = builder.serviceIdentifier;
this.tags = (java.util.List)builder.tags;
}
@Override
public final java.lang.Object getAction() {
return this.action;
}
@Override
public final java.lang.Object getMatch() {
return this.match;
}
@Override
public final java.lang.Number getPriority() {
return this.priority;
}
@Override
public final java.lang.String getListenerIdentifier() {
return this.listenerIdentifier;
}
@Override
public final java.lang.String getName() {
return this.name;
}
@Override
public final java.lang.String getServiceIdentifier() {
return this.serviceIdentifier;
}
@Override
public final java.util.List getTags() {
return this.tags;
}
@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("action", om.valueToTree(this.getAction()));
data.set("match", om.valueToTree(this.getMatch()));
data.set("priority", om.valueToTree(this.getPriority()));
if (this.getListenerIdentifier() != null) {
data.set("listenerIdentifier", om.valueToTree(this.getListenerIdentifier()));
}
if (this.getName() != null) {
data.set("name", om.valueToTree(this.getName()));
}
if (this.getServiceIdentifier() != null) {
data.set("serviceIdentifier", om.valueToTree(this.getServiceIdentifier()));
}
if (this.getTags() != null) {
data.set("tags", om.valueToTree(this.getTags()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-vpclattice.CfnRuleProps"));
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;
CfnRuleProps.Jsii$Proxy that = (CfnRuleProps.Jsii$Proxy) o;
if (!action.equals(that.action)) return false;
if (!match.equals(that.match)) return false;
if (!priority.equals(that.priority)) return false;
if (this.listenerIdentifier != null ? !this.listenerIdentifier.equals(that.listenerIdentifier) : that.listenerIdentifier != null) return false;
if (this.name != null ? !this.name.equals(that.name) : that.name != null) return false;
if (this.serviceIdentifier != null ? !this.serviceIdentifier.equals(that.serviceIdentifier) : that.serviceIdentifier != null) return false;
return this.tags != null ? this.tags.equals(that.tags) : that.tags == null;
}
@Override
public final int hashCode() {
int result = this.action.hashCode();
result = 31 * result + (this.match.hashCode());
result = 31 * result + (this.priority.hashCode());
result = 31 * result + (this.listenerIdentifier != null ? this.listenerIdentifier.hashCode() : 0);
result = 31 * result + (this.name != null ? this.name.hashCode() : 0);
result = 31 * result + (this.serviceIdentifier != null ? this.serviceIdentifier.hashCode() : 0);
result = 31 * result + (this.tags != null ? this.tags.hashCode() : 0);
return result;
}
}
}