Class: AWSCDK::EC2::SecurityGroupProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ec2/security_group_props.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vpc:, allow_all_ipv6_outbound: nil, allow_all_outbound: nil, description: nil, disable_inline_rules: nil, security_group_name: nil) ⇒ SecurityGroupProps

Returns a new instance of SecurityGroupProps.

Parameters:

  • vpc (AWSCDK::EC2::IVPC)

    The VPC in which to create the security group.

  • allow_all_ipv6_outbound (Boolean, nil) (defaults to: nil)

    Whether to allow all outbound ipv6 traffic by default.

  • allow_all_outbound (Boolean, nil) (defaults to: nil)

    Whether to allow all outbound traffic by default.

  • description (String, nil) (defaults to: nil)

    A description of the security group.

  • disable_inline_rules (Boolean, nil) (defaults to: nil)

    Whether to disable inline ingress and egress rule optimization.

  • security_group_name (String, nil) (defaults to: nil)

    The name of the security group.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'ec2/security_group_props.rb', line 12

def initialize(vpc:, allow_all_ipv6_outbound: nil, allow_all_outbound: nil, description: nil, disable_inline_rules: nil, security_group_name: nil)
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc")
  @allow_all_ipv6_outbound = allow_all_ipv6_outbound
  Jsii::Type.check_type(@allow_all_ipv6_outbound, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowAllIpv6Outbound") unless @allow_all_ipv6_outbound.nil?
  @allow_all_outbound = allow_all_outbound
  Jsii::Type.check_type(@allow_all_outbound, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowAllOutbound") unless @allow_all_outbound.nil?
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @disable_inline_rules = disable_inline_rules
  Jsii::Type.check_type(@disable_inline_rules, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "disableInlineRules") unless @disable_inline_rules.nil?
  @security_group_name = security_group_name
  Jsii::Type.check_type(@security_group_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "securityGroupName") unless @security_group_name.nil?
end

Instance Attribute Details

#allow_all_ipv6_outboundBoolean? (readonly)

Note:

Default: false

Whether to allow all outbound ipv6 traffic by default.

If this is set to true, there will only be a single egress rule which allows all outbound ipv6 traffic. If this is set to false, no outbound traffic will be allowed by default and all egress ipv6 traffic must be explicitly authorized.

To allow all ipv4 traffic use allowAllOutbound

Returns:

  • (Boolean, nil)


41
42
43
# File 'ec2/security_group_props.rb', line 41

def allow_all_ipv6_outbound
  @allow_all_ipv6_outbound
end

#allow_all_outboundBoolean? (readonly)

Note:

Default: true

Whether to allow all outbound traffic by default.

If this is set to true, there will only be a single egress rule which allows all outbound traffic. If this is set to false, no outbound traffic will be allowed by default and all egress traffic must be explicitly authorized.

To allow all ipv6 traffic use allowAllIpv6Outbound

Returns:

  • (Boolean, nil)


52
53
54
# File 'ec2/security_group_props.rb', line 52

def allow_all_outbound
  @allow_all_outbound
end

#descriptionString? (readonly)

Note:

Default: The default name will be the construct's CDK path.

A description of the security group.

Returns:

  • (String, nil)


57
58
59
# File 'ec2/security_group_props.rb', line 57

def description
  @description
end

#disable_inline_rulesBoolean? (readonly)

Note:

Default: false

Whether to disable inline ingress and egress rule optimization.

If this is set to true, ingress and egress rules will not be declared under the SecurityGroup in cloudformation, but will be separate elements.

Inlining rules is an optimization for producing smaller stack templates. Sometimes this is not desirable, for example when security group access is managed via tags.

The default value can be overridden globally by setting the context variable '@aws-cdk/aws-ec2.securityGroupDisableInlineRules'.

Returns:

  • (Boolean, nil)


71
72
73
# File 'ec2/security_group_props.rb', line 71

def disable_inline_rules
  @disable_inline_rules
end

#security_group_nameString? (readonly)

Note:

Default: If you don't specify a GroupName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.

The name of the security group.

For valid values, see the GroupName parameter of the CreateSecurityGroup action in the Amazon EC2 API Reference.

It is not recommended to use an explicit group name.

Returns:

  • (String, nil)


82
83
84
# File 'ec2/security_group_props.rb', line 82

def security_group_name
  @security_group_name
end

#vpcAWSCDK::EC2::IVPC (readonly)

The VPC in which to create the security group.

Returns:



30
31
32
# File 'ec2/security_group_props.rb', line 30

def vpc
  @vpc
end

Class Method Details

.jsii_propertiesObject



84
85
86
87
88
89
90
91
92
93
# File 'ec2/security_group_props.rb', line 84

def self.jsii_properties
  {
    :vpc => "vpc",
    :allow_all_ipv6_outbound => "allowAllIpv6Outbound",
    :allow_all_outbound => "allowAllOutbound",
    :description => "description",
    :disable_inline_rules => "disableInlineRules",
    :security_group_name => "securityGroupName",
  }
end

Instance Method Details

#to_jsiiObject



95
96
97
98
99
100
101
102
103
104
105
106
# File 'ec2/security_group_props.rb', line 95

def to_jsii
  result = {}
  result.merge!({
    "vpc" => @vpc,
    "allowAllIpv6Outbound" => @allow_all_ipv6_outbound,
    "allowAllOutbound" => @allow_all_outbound,
    "description" => @description,
    "disableInlineRules" => @disable_inline_rules,
    "securityGroupName" => @security_group_name,
  })
  result.compact
end