com.aliyun.ros.cdk.ecs.SecurityGroupIngress Maven / Gradle / Ivy
package com.aliyun.ros.cdk.ecs;
/**
* This class encapsulates and extends the ROS resource type ALIYUN::ECS::SecurityGroupIngress
, which is used to create an inbound rule for a security group.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.85.0 (build 08ee592)", date = "2024-08-22T08:56:20.385Z")
@software.amazon.jsii.Jsii(module = com.aliyun.ros.cdk.ecs.$Module.class, fqn = "@alicloud/ros-cdk-ecs.SecurityGroupIngress")
public class SecurityGroupIngress extends com.aliyun.ros.cdk.core.Resource {
protected SecurityGroupIngress(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected SecurityGroupIngress(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* Param scope - scope in which this resource is defined Param id - scoped id of the resource Param props - resource properties.
*
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
* @param enableResourcePropertyConstraint
*/
public SecurityGroupIngress(final @org.jetbrains.annotations.NotNull com.aliyun.ros.cdk.core.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull com.aliyun.ros.cdk.ecs.SecurityGroupIngressProps props, final @org.jetbrains.annotations.Nullable java.lang.Boolean enableResourcePropertyConstraint) {
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"), java.util.Objects.requireNonNull(props, "props is required"), enableResourcePropertyConstraint });
}
/**
* Param scope - scope in which this resource is defined Param id - scoped id of the resource Param props - resource properties.
*
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
*/
public SecurityGroupIngress(final @org.jetbrains.annotations.NotNull com.aliyun.ros.cdk.core.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull com.aliyun.ros.cdk.ecs.SecurityGroupIngressProps 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"), java.util.Objects.requireNonNull(props, "props is required") });
}
protected @org.jetbrains.annotations.NotNull java.lang.Boolean getEnableResourcePropertyConstraint() {
return software.amazon.jsii.Kernel.get(this, "enableResourcePropertyConstraint", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
protected void setEnableResourcePropertyConstraint(final @org.jetbrains.annotations.NotNull java.lang.Boolean value) {
software.amazon.jsii.Kernel.set(this, "enableResourcePropertyConstraint", java.util.Objects.requireNonNull(value, "enableResourcePropertyConstraint is required"));
}
protected @org.jetbrains.annotations.NotNull java.lang.String getId() {
return software.amazon.jsii.Kernel.get(this, "id", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
protected void setId(final @org.jetbrains.annotations.NotNull java.lang.String value) {
software.amazon.jsii.Kernel.set(this, "id", java.util.Objects.requireNonNull(value, "id is required"));
}
protected @org.jetbrains.annotations.NotNull com.aliyun.ros.cdk.ecs.SecurityGroupIngressProps getProps() {
return software.amazon.jsii.Kernel.get(this, "props", software.amazon.jsii.NativeType.forClass(com.aliyun.ros.cdk.ecs.SecurityGroupIngressProps.class));
}
protected void setProps(final @org.jetbrains.annotations.NotNull com.aliyun.ros.cdk.ecs.SecurityGroupIngressProps value) {
software.amazon.jsii.Kernel.set(this, "props", java.util.Objects.requireNonNull(value, "props is required"));
}
protected @org.jetbrains.annotations.NotNull com.aliyun.ros.cdk.core.Construct getScope() {
return software.amazon.jsii.Kernel.get(this, "scope", software.amazon.jsii.NativeType.forClass(com.aliyun.ros.cdk.core.Construct.class));
}
protected void setScope(final @org.jetbrains.annotations.NotNull com.aliyun.ros.cdk.core.Construct value) {
software.amazon.jsii.Kernel.set(this, "scope", java.util.Objects.requireNonNull(value, "scope is required"));
}
/**
* A fluent builder for {@link com.aliyun.ros.cdk.ecs.SecurityGroupIngress}.
*/
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.
* @param enableResourcePropertyConstraint
*/
public static Builder create(final com.aliyun.ros.cdk.core.Construct scope, final java.lang.String id, final java.lang.Boolean enableResourcePropertyConstraint) {
return new Builder(scope, id, enableResourcePropertyConstraint);
}
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
public static Builder create(final com.aliyun.ros.cdk.core.Construct scope, final java.lang.String id) {
return new Builder(scope, id, null);
}
private final com.aliyun.ros.cdk.core.Construct scope;
private final java.lang.String id;
private final java.lang.Boolean enableResourcePropertyConstraint;
private final com.aliyun.ros.cdk.ecs.SecurityGroupIngressProps.Builder props;
private Builder(final com.aliyun.ros.cdk.core.Construct scope, final java.lang.String id, final java.lang.Boolean enableResourcePropertyConstraint) {
this.scope = scope;
this.id = id;
this.enableResourcePropertyConstraint = enableResourcePropertyConstraint;
this.props = new com.aliyun.ros.cdk.ecs.SecurityGroupIngressProps.Builder();
}
/**
* Property ipProtocol: Ip protocol for in rule.
*
* @return {@code this}
* @param ipProtocol Property ipProtocol: Ip protocol for in rule. This parameter is required.
*/
public Builder ipProtocol(final java.lang.String ipProtocol) {
this.props.ipProtocol(ipProtocol);
return this;
}
/**
* Property ipProtocol: Ip protocol for in rule.
*
* @return {@code this}
* @param ipProtocol Property ipProtocol: Ip protocol for in rule. This parameter is required.
*/
public Builder ipProtocol(final com.aliyun.ros.cdk.core.IResolvable ipProtocol) {
this.props.ipProtocol(ipProtocol);
return this;
}
/**
* Property portRange: Ip protocol relative port range.
*
* For tcp and udp, the port rang is [1,65535], using format '1/200'For icmp|gre|all protocel, the port range should be '-1/-1'
*
* @return {@code this}
* @param portRange Property portRange: Ip protocol relative port range. This parameter is required.
*/
public Builder portRange(final java.lang.String portRange) {
this.props.portRange(portRange);
return this;
}
/**
* Property portRange: Ip protocol relative port range.
*
* For tcp and udp, the port rang is [1,65535], using format '1/200'For icmp|gre|all protocel, the port range should be '-1/-1'
*
* @return {@code this}
* @param portRange Property portRange: Ip protocol relative port range. This parameter is required.
*/
public Builder portRange(final com.aliyun.ros.cdk.core.IResolvable portRange) {
this.props.portRange(portRange);
return this;
}
/**
* Property description: Description of the security group rule, [1, 512] characters.
*
* The default is empty.
*
* @return {@code this}
* @param description Property description: Description of the security group rule, [1, 512] characters. This parameter is required.
*/
public Builder description(final java.lang.String description) {
this.props.description(description);
return this;
}
/**
* Property description: Description of the security group rule, [1, 512] characters.
*
* The default is empty.
*
* @return {@code this}
* @param description Property description: Description of the security group rule, [1, 512] characters. This parameter is required.
*/
public Builder description(final com.aliyun.ros.cdk.core.IResolvable description) {
this.props.description(description);
return this;
}
/**
* Property ipv6SourceCidrIp: Source IPv6 CIDR address segment.
*
* Supports IP address ranges in CIDR format and IPv6 format.
* Note Only VPC type IP addresses are supported.
*
* @return {@code this}
* @param ipv6SourceCidrIp Property ipv6SourceCidrIp: Source IPv6 CIDR address segment. This parameter is required.
*/
public Builder ipv6SourceCidrIp(final java.lang.String ipv6SourceCidrIp) {
this.props.ipv6SourceCidrIp(ipv6SourceCidrIp);
return this;
}
/**
* Property ipv6SourceCidrIp: Source IPv6 CIDR address segment.
*
* Supports IP address ranges in CIDR format and IPv6 format.
* Note Only VPC type IP addresses are supported.
*
* @return {@code this}
* @param ipv6SourceCidrIp Property ipv6SourceCidrIp: Source IPv6 CIDR address segment. This parameter is required.
*/
public Builder ipv6SourceCidrIp(final com.aliyun.ros.cdk.core.IResolvable ipv6SourceCidrIp) {
this.props.ipv6SourceCidrIp(ipv6SourceCidrIp);
return this;
}
/**
* Property nicType: Network type, could be 'internet' or 'intranet'.
*
* Default value is internet.
*
* @return {@code this}
* @param nicType Property nicType: Network type, could be 'internet' or 'intranet'. This parameter is required.
*/
public Builder nicType(final java.lang.String nicType) {
this.props.nicType(nicType);
return this;
}
/**
* Property nicType: Network type, could be 'internet' or 'intranet'.
*
* Default value is internet.
*
* @return {@code this}
* @param nicType Property nicType: Network type, could be 'internet' or 'intranet'. This parameter is required.
*/
public Builder nicType(final com.aliyun.ros.cdk.core.IResolvable nicType) {
this.props.nicType(nicType);
return this;
}
/**
* Property policy: Authorization policies, parameter values can be: accept (accepted access), drop (denied access).
*
* Default value is accept.
*
* @return {@code this}
* @param policy Property policy: Authorization policies, parameter values can be: accept (accepted access), drop (denied access). This parameter is required.
*/
public Builder policy(final java.lang.String policy) {
this.props.policy(policy);
return this;
}
/**
* Property policy: Authorization policies, parameter values can be: accept (accepted access), drop (denied access).
*
* Default value is accept.
*
* @return {@code this}
* @param policy Property policy: Authorization policies, parameter values can be: accept (accepted access), drop (denied access). This parameter is required.
*/
public Builder policy(final com.aliyun.ros.cdk.core.IResolvable policy) {
this.props.policy(policy);
return this;
}
/**
* Property priority: Authorization policies priority range[1, 100].
*
* @return {@code this}
* @param priority Property priority: Authorization policies priority range[1, 100]. This parameter is required.
*/
public Builder priority(final java.lang.Number priority) {
this.props.priority(priority);
return this;
}
/**
* Property priority: Authorization policies priority range[1, 100].
*
* @return {@code this}
* @param priority Property priority: Authorization policies priority range[1, 100]. This parameter is required.
*/
public Builder priority(final com.aliyun.ros.cdk.core.IResolvable priority) {
this.props.priority(priority);
return this;
}
/**
* Property securityGroupId: Id of the security group.
*
* @return {@code this}
* @param securityGroupId Property securityGroupId: Id of the security group. This parameter is required.
*/
public Builder securityGroupId(final java.lang.String securityGroupId) {
this.props.securityGroupId(securityGroupId);
return this;
}
/**
* Property securityGroupId: Id of the security group.
*
* @return {@code this}
* @param securityGroupId Property securityGroupId: Id of the security group. This parameter is required.
*/
public Builder securityGroupId(final com.aliyun.ros.cdk.core.IResolvable securityGroupId) {
this.props.securityGroupId(securityGroupId);
return this;
}
/**
* Property sourceCidrIp: The source IPv4 CIDR block to which you want to control access.
*
* CIDR blocks and IPv4 addresses are supported.
*
* @return {@code this}
* @param sourceCidrIp Property sourceCidrIp: The source IPv4 CIDR block to which you want to control access. This parameter is required.
*/
public Builder sourceCidrIp(final java.lang.String sourceCidrIp) {
this.props.sourceCidrIp(sourceCidrIp);
return this;
}
/**
* Property sourceCidrIp: The source IPv4 CIDR block to which you want to control access.
*
* CIDR blocks and IPv4 addresses are supported.
*
* @return {@code this}
* @param sourceCidrIp Property sourceCidrIp: The source IPv4 CIDR block to which you want to control access. This parameter is required.
*/
public Builder sourceCidrIp(final com.aliyun.ros.cdk.core.IResolvable sourceCidrIp) {
this.props.sourceCidrIp(sourceCidrIp);
return this;
}
/**
* Property sourceGroupId: Source Group Id.
*
* @return {@code this}
* @param sourceGroupId Property sourceGroupId: Source Group Id. This parameter is required.
*/
public Builder sourceGroupId(final java.lang.String sourceGroupId) {
this.props.sourceGroupId(sourceGroupId);
return this;
}
/**
* Property sourceGroupId: Source Group Id.
*
* @return {@code this}
* @param sourceGroupId Property sourceGroupId: Source Group Id. This parameter is required.
*/
public Builder sourceGroupId(final com.aliyun.ros.cdk.core.IResolvable sourceGroupId) {
this.props.sourceGroupId(sourceGroupId);
return this;
}
/**
* Property sourceGroupOwnerId: Source Group Owner Account ID.
*
* @return {@code this}
* @param sourceGroupOwnerId Property sourceGroupOwnerId: Source Group Owner Account ID. This parameter is required.
*/
public Builder sourceGroupOwnerId(final java.lang.String sourceGroupOwnerId) {
this.props.sourceGroupOwnerId(sourceGroupOwnerId);
return this;
}
/**
* Property sourceGroupOwnerId: Source Group Owner Account ID.
*
* @return {@code this}
* @param sourceGroupOwnerId Property sourceGroupOwnerId: Source Group Owner Account ID. This parameter is required.
*/
public Builder sourceGroupOwnerId(final com.aliyun.ros.cdk.core.IResolvable sourceGroupOwnerId) {
this.props.sourceGroupOwnerId(sourceGroupOwnerId);
return this;
}
/**
* Property sourcePortRange: The range of the ports enabled by the source security group for the transport layer protocol.
*
* Valid values: TCP/UDP: Value range: 1 to 65535. The start port and the end port are separated by a slash (/). Correct example: 1/200. Incorrect example: 200/1.ICMP: -1/-1.GRE: -1/-1.ALL: -1/-1.
*
* @return {@code this}
* @param sourcePortRange Property sourcePortRange: The range of the ports enabled by the source security group for the transport layer protocol. This parameter is required.
*/
public Builder sourcePortRange(final java.lang.String sourcePortRange) {
this.props.sourcePortRange(sourcePortRange);
return this;
}
/**
* Property sourcePortRange: The range of the ports enabled by the source security group for the transport layer protocol.
*
* Valid values: TCP/UDP: Value range: 1 to 65535. The start port and the end port are separated by a slash (/). Correct example: 1/200. Incorrect example: 200/1.ICMP: -1/-1.GRE: -1/-1.ALL: -1/-1.
*
* @return {@code this}
* @param sourcePortRange Property sourcePortRange: The range of the ports enabled by the source security group for the transport layer protocol. This parameter is required.
*/
public Builder sourcePortRange(final com.aliyun.ros.cdk.core.IResolvable sourcePortRange) {
this.props.sourcePortRange(sourcePortRange);
return this;
}
/**
* Property sourcePrefixListId: The ID of the source prefix list to which you want to control access.
*
* You can call the DescribePrefixLists operation to query the IDs of available prefix lists. Take note of the following items:
*
*
* - If a security group is in the classic network, you cannot configure prefix lists in the security group rules.
* - If you specify the SourceCidrIp, Ipv6SourceCidrIp, or SourceGroupId parameter, this parameter is ignored.
*
*
* @return {@code this}
* @param sourcePrefixListId Property sourcePrefixListId: The ID of the source prefix list to which you want to control access. This parameter is required.
*/
public Builder sourcePrefixListId(final java.lang.String sourcePrefixListId) {
this.props.sourcePrefixListId(sourcePrefixListId);
return this;
}
/**
* Property sourcePrefixListId: The ID of the source prefix list to which you want to control access.
*
* You can call the DescribePrefixLists operation to query the IDs of available prefix lists. Take note of the following items:
*
*
* - If a security group is in the classic network, you cannot configure prefix lists in the security group rules.
* - If you specify the SourceCidrIp, Ipv6SourceCidrIp, or SourceGroupId parameter, this parameter is ignored.
*
*
* @return {@code this}
* @param sourcePrefixListId Property sourcePrefixListId: The ID of the source prefix list to which you want to control access. This parameter is required.
*/
public Builder sourcePrefixListId(final com.aliyun.ros.cdk.core.IResolvable sourcePrefixListId) {
this.props.sourcePrefixListId(sourcePrefixListId);
return this;
}
/**
* @return a newly built instance of {@link com.aliyun.ros.cdk.ecs.SecurityGroupIngress}.
*/
@Override
public com.aliyun.ros.cdk.ecs.SecurityGroupIngress build() {
return new com.aliyun.ros.cdk.ecs.SecurityGroupIngress(
this.scope,
this.id,
this.props.build(),
this.enableResourcePropertyConstraint
);
}
}
}