Module: AWSCDK::EC2::ISecurityGroup

Includes:
IPeer, IResource, Interfaces::AWSEC2::ISecurityGroupRef
Included in:
SecurityGroup
Defined in:
ec2/i_security_group.rb

Overview

Interface for security group-like objects.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'ec2/i_security_group.rb', line 168

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :connections => { kind: :property, name: "connections", is_optional: false },
    :can_inline_rule => { kind: :property, name: "canInlineRule", is_optional: false },
    :unique_id => { kind: :property, name: "uniqueId", is_optional: false },
    :security_group_ref => { kind: :property, name: "securityGroupRef", is_optional: false },
    :allow_all_outbound => { kind: :property, name: "allowAllOutbound", is_optional: false },
    :security_group_id => { kind: :property, name: "securityGroupId", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :to_egress_rule_config => { kind: :method, name: "toEgressRuleConfig", is_optional: false },
    :to_ingress_rule_config => { kind: :method, name: "toIngressRuleConfig", is_optional: false },
    :add_egress_rule => { kind: :method, name: "addEgressRule", is_optional: false },
    :add_ingress_rule => { kind: :method, name: "addIngressRule", is_optional: false },
  }
end

Instance Method Details

#add_egress_rule(peer, connection, description = nil, remote_rule = nil) ⇒ void

This method returns an undefined value.

Add an egress rule for the current security group.

remote_rule controls where the Rule object is created if the peer is also a securityGroup and they are in different stack. If false (default) the rule object is created under the current SecurityGroup object. If true and the peer is also a SecurityGroup, the rule object is created under the remote SecurityGroup object.

Parameters:



139
140
141
142
143
144
145
# File 'ec2/i_security_group.rb', line 139

def add_egress_rule(peer, connection, description = nil, remote_rule = nil)
  Jsii::Type.check_type(peer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklQZWVyIn0=")), "peer")
  Jsii::Type.check_type(connection, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlBvcnQifQ==")), "connection")
  Jsii::Type.check_type(description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless description.nil?
  Jsii::Type.check_type(remote_rule, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "remoteRule") unless remote_rule.nil?
  jsii_call_method("addEgressRule", [peer, connection, description, remote_rule])
end

#add_ingress_rule(peer, connection, description = nil, remote_rule = nil) ⇒ void

This method returns an undefined value.

Add an ingress rule for the current security group.

remote_rule controls where the Rule object is created if the peer is also a securityGroup and they are in different stack. If false (default) the rule object is created under the current SecurityGroup object. If true and the peer is also a SecurityGroup, the rule object is created under the remote SecurityGroup object.

Parameters:



160
161
162
163
164
165
166
# File 'ec2/i_security_group.rb', line 160

def add_ingress_rule(peer, connection, description = nil, remote_rule = nil)
  Jsii::Type.check_type(peer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklQZWVyIn0=")), "peer")
  Jsii::Type.check_type(connection, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlBvcnQifQ==")), "connection")
  Jsii::Type.check_type(description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless description.nil?
  Jsii::Type.check_type(remote_rule, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "remoteRule") unless remote_rule.nil?
  jsii_call_method("addIngressRule", [peer, connection, description, remote_rule])
end

#allow_all_outboundBoolean

Whether the SecurityGroup has been configured to allow all outbound traffic.

Returns:

  • (Boolean)


70
71
72
# File 'ec2/i_security_group.rb', line 70

def allow_all_outbound()
  jsii_get_property("allowAllOutbound")
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



107
108
109
110
# File 'ec2/i_security_group.rb', line 107

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#can_inline_ruleBoolean

Whether the rule can be inlined into a SecurityGroup or not.

Returns:

  • (Boolean)


49
50
51
# File 'ec2/i_security_group.rb', line 49

def can_inline_rule()
  jsii_get_property("canInlineRule")
end

#connectionsAWSCDK::EC2::Connections

The network connections associated with this resource.



42
43
44
# File 'ec2/i_security_group.rb', line 42

def connections()
  jsii_get_property("connections")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



28
29
30
# File 'ec2/i_security_group.rb', line 28

def env()
  jsii_get_property("env")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


13
14
15
# File 'ec2/i_security_group.rb', line 13

def node()
  jsii_get_property("node")
end

#security_group_idString

ID for the current security group.

Returns:

  • (String)


77
78
79
# File 'ec2/i_security_group.rb', line 77

def security_group_id()
  jsii_get_property("securityGroupId")
end

#security_group_refAWSCDK::Interfaces::AWSEC2::SecurityGroupReference

A reference to a SecurityGroup resource.



63
64
65
# File 'ec2/i_security_group.rb', line 63

def security_group_ref()
  jsii_get_property("securityGroupRef")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



35
36
37
# File 'ec2/i_security_group.rb', line 35

def stack()
  jsii_get_property("stack")
end

#to_egress_rule_configAWSCDK::EC2::EgressRuleConfig

Produce the egress rule JSON for the given connection.



115
116
117
# File 'ec2/i_security_group.rb', line 115

def to_egress_rule_config()
  jsii_call_method("toEgressRuleConfig", [])
end

#to_ingress_rule_configAWSCDK::EC2::IngressRuleConfig

Produce the ingress rule JSON for the given connection.



122
123
124
# File 'ec2/i_security_group.rb', line 122

def to_ingress_rule_config()
  jsii_call_method("toIngressRuleConfig", [])
end

#unique_idString

A unique identifier for this connection peer.

Returns:

  • (String)


56
57
58
# File 'ec2/i_security_group.rb', line 56

def unique_id()
  jsii_get_property("uniqueId")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



88
89
90
91
92
93
# File 'ec2/i_security_group.rb', line 88

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end