Class: AWSCDK::EC2::CfnSecurityGroup

Inherits:
CfnResource
  • Object
show all
Includes:
IInspectable, ITaggable, Interfaces::AWSEC2::ISecurityGroupRef
Defined in:
ec2/cfn_security_group.rb

Overview

Specifies a security group.

You must specify ingress rules to allow inbound traffic. By default, no inbound traffic is allowed.

When you create a security group, if you do not add egress rules, we add egress rules that allow all outbound IPv4 and IPv6 traffic. Otherwise, we do not add them. After the security group is created, if you remove all egress rules that you added, we do not add egress rules, so no outbound traffic is allowed.

If you modify a rule, CloudFormation removes the existing rule and then adds a new rule. There is a brief period when neither the original rule or the new rule exists, so the corresponding traffic is dropped.

This type supports updates. For more information about updating stacks, see AWS CloudFormation Stacks Updates .

To cross-reference two security groups in the ingress and egress rules of those security groups, use the AWS::EC2::SecurityGroupEgress and AWS::EC2::SecurityGroupIngress resources to define your rules. Do not use the embedded ingress and egress rules in the AWS::EC2::SecurityGroup . Doing so creates a circular dependency, which CloudFormation doesn't allow.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ CfnSecurityGroup

Create a new AWS::EC2::SecurityGroup.

Parameters:

  • scope (Constructs::Construct)

    Scope in which this resource is defined.

  • id (String)

    Construct identifier for this resource (unique in its scope).

  • props (AWSCDK::EC2::CfnSecurityGroupProps)

    Resource properties.



28
29
30
31
32
33
34
# File 'ec2/cfn_security_group.rb', line 28

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::EC2::CfnSecurityGroupProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNlY3VyaXR5R3JvdXBQcm9wcyJ9")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.arn_for_security_group(resource) ⇒ String

Parameters:

Returns:

  • (String)


89
90
91
92
# File 'ec2/cfn_security_group.rb', line 89

def self.arn_for_security_group(resource)
  Jsii::Type.check_type(resource, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19lYzIuSVNlY3VyaXR5R3JvdXBSZWYifQ==")), "resource")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.CfnSecurityGroup", "arnForSecurityGroup", [resource])
end

.CFN_RESOURCE_TYPE_NAMEString

The CloudFormation resource type name for this resource class.

Returns:

  • (String)


209
210
211
# File 'ec2/cfn_security_group.rb', line 209

def self.CFN_RESOURCE_TYPE_NAME()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ec2.CfnSecurityGroup", "CFN_RESOURCE_TYPE_NAME")
end

.from_security_group_id(scope, id, security_group_id) ⇒ AWSCDK::Interfaces::AWSEC2::ISecurityGroupRef

Creates a new ISecurityGroupRef from a securityGroupId.

Parameters:

  • scope (Constructs::Construct)
  • id (String)
  • security_group_id (String)

Returns:



100
101
102
103
104
105
# File 'ec2/cfn_security_group.rb', line 100

def self.from_security_group_id(scope, id, security_group_id)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(security_group_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "securityGroupId")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.CfnSecurityGroup", "fromSecurityGroupId", [scope, id, security_group_id])
end

.is_cfn_security_group(x) ⇒ Boolean

Checks whether the given object is a CfnSecurityGroup.

Parameters:

  • x (Object)

Returns:

  • (Boolean)


111
112
113
114
# File 'ec2/cfn_security_group.rb', line 111

def self.is_cfn_security_group(x)
  Jsii::Type.check_type(x, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "x")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.CfnSecurityGroup", "isCfnSecurityGroup", [x])
end

.jsii_overridable_methodsObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'ec2/cfn_security_group.rb', line 36

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :creation_stack => { kind: :property, name: "creationStack", is_optional: false },
    :logical_id => { kind: :property, name: "logicalId", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :ref => { kind: :property, name: "ref", is_optional: false },
    :cfn_options => { kind: :property, name: "cfnOptions", is_optional: false },
    :cfn_properties => { kind: :property, name: "cfnProperties", is_optional: false },
    :cfn_property_names => { kind: :property, name: "cfnPropertyNames", is_optional: false },
    :cfn_resource_type => { kind: :property, name: "cfnResourceType", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :updated_properites => { kind: :property, name: "updatedProperites", is_optional: false },
    :updated_properties => { kind: :property, name: "updatedProperties", is_optional: false },
    :attr_group_id => { kind: :property, name: "attrGroupId", is_optional: false },
    :attr_id => { kind: :property, name: "attrId", is_optional: false },
    :attr_vpc_id => { kind: :property, name: "attrVpcId", is_optional: false },
    :security_group_ref => { kind: :property, name: "securityGroupRef", is_optional: false },
    :tags => { kind: :property, name: "tags", is_optional: false },
    :group_description => { kind: :property, name: "groupDescription", is_optional: false },
    :group_name => { kind: :property, name: "groupName", is_optional: true },
    :security_group_egress => { kind: :property, name: "securityGroupEgress", is_optional: true },
    :security_group_ingress => { kind: :property, name: "securityGroupIngress", is_optional: true },
    :tags_raw => { kind: :property, name: "tagsRaw", is_optional: true },
    :vpc_id => { kind: :property, name: "vpcId", is_optional: true },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :override_logical_id => { kind: :method, name: "overrideLogicalId", is_optional: false },
    :add_deletion_override => { kind: :method, name: "addDeletionOverride", is_optional: false },
    :add_dependency => { kind: :method, name: "addDependency", is_optional: false },
    :add_depends_on => { kind: :method, name: "addDependsOn", is_optional: false },
    :add_metadata => { kind: :method, name: "addMetadata", is_optional: false },
    :add_override => { kind: :method, name: "addOverride", is_optional: false },
    :add_property_deletion_override => { kind: :method, name: "addPropertyDeletionOverride", is_optional: false },
    :add_property_override => { kind: :method, name: "addPropertyOverride", is_optional: false },
    :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :cfn_property_name => { kind: :method, name: "cfnPropertyName", is_optional: false },
    :get_att => { kind: :method, name: "getAtt", is_optional: false },
    :get_metadata => { kind: :method, name: "getMetadata", is_optional: false },
    :obtain_dependencies => { kind: :method, name: "obtainDependencies", is_optional: false },
    :obtain_resource_dependencies => { kind: :method, name: "obtainResourceDependencies", is_optional: false },
    :remove_dependency => { kind: :method, name: "removeDependency", is_optional: false },
    :render_properties => { kind: :method, name: "renderProperties", is_optional: false },
    :replace_dependency => { kind: :method, name: "replaceDependency", is_optional: false },
    :should_synthesize => { kind: :method, name: "shouldSynthesize", is_optional: false },
    :validate_properties => { kind: :method, name: "validateProperties", is_optional: false },
    :inspect => { kind: :method, name: "inspect", is_optional: false },
  }
end

Instance Method Details

#add_deletion_override(path) ⇒ void

This method returns an undefined value.

Syntactic sugar for addOverride(path, undefined).

Parameters:

  • path (String)

    The path of the value to delete.



359
360
361
362
# File 'ec2/cfn_security_group.rb', line 359

def add_deletion_override(path)
  Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path")
  jsii_call_method("addDeletionOverride", [path])
end

#add_dependency(target) ⇒ void

This method returns an undefined value.

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters:



371
372
373
374
# File 'ec2/cfn_security_group.rb', line 371

def add_dependency(target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "target")
  jsii_call_method("addDependency", [target])
end

#add_depends_on(target) ⇒ void

Deprecated.

use addDependency

This method returns an undefined value.

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

Parameters:



381
382
383
384
# File 'ec2/cfn_security_group.rb', line 381

def add_depends_on(target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "target")
  jsii_call_method("addDependsOn", [target])
end

#add_metadata(key, value) ⇒ void

This method returns an undefined value.

Add a value to the CloudFormation Resource Metadata.



392
393
394
395
396
# File 'ec2/cfn_security_group.rb', line 392

def (key, value)
  Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  jsii_call_method("addMetadata", [key, value])
end

#add_override(path, value) ⇒ void

This method returns an undefined value.

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use add_property_override or prefix path with "Properties." (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example,

# Example automatically generated from non-compiling source. May contain errors.
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides

"Properties": {
  "GlobalSecondaryIndexes": [
    {
      "Projection": {
        "NonKeyAttributes": [ "myattribute" ]
        ...
      }
      ...
    },
    {
      "ProjectionType": "INCLUDE"
      ...
    },
  ]
  ...
}

The value argument to add_override will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters:

  • path (String)
    • The path of the property, you can use dot notation to override values in complex types.
  • value (Object)
    • The value.


449
450
451
452
453
# File 'ec2/cfn_security_group.rb', line 449

def add_override(path, value)
  Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  jsii_call_method("addOverride", [path, value])
end

#add_property_deletion_override(property_path) ⇒ void

This method returns an undefined value.

Adds an override that deletes the value of a property from the resource definition.

Parameters:

  • property_path (String)

    The path to the property.



459
460
461
462
# File 'ec2/cfn_security_group.rb', line 459

def add_property_deletion_override(property_path)
  Jsii::Type.check_type(property_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "propertyPath")
  jsii_call_method("addPropertyDeletionOverride", [property_path])
end

#add_property_override(property_path, value) ⇒ void

This method returns an undefined value.

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters:

  • property_path (String)

    The path of the property.

  • value (Object)

    The value.



471
472
473
474
475
# File 'ec2/cfn_security_group.rb', line 471

def add_property_override(property_path, value)
  Jsii::Type.check_type(property_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "propertyPath")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  jsii_call_method("addPropertyOverride", [property_path, value])
end

#apply_cross_stack_reference_strength(strength) ⇒ void

This method returns an undefined value.

Sets the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified strength instead of the global default from the consuming stack's context.

Parameters:



484
485
486
487
# File 'ec2/cfn_security_group.rb', line 484

def apply_cross_stack_reference_strength(strength)
  Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength")
  jsii_call_method("applyCrossStackReferenceStrength", [strength])
end

#apply_removal_policy(policy = nil, options = nil) ⇒ void

This method returns an undefined value.

Sets the deletion policy of the resource based on the removal policy specified.

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). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:



506
507
508
509
510
511
# File 'ec2/cfn_security_group.rb', line 506

def apply_removal_policy(policy = nil, options = nil)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") unless policy.nil?
  options = options.is_a?(Hash) ? ::AWSCDK::RemovalPolicyOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5T3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("applyRemovalPolicy", [policy, options])
end

#attr_group_idString

The ID of the security group, such as sg-94b3a1f6 .

Returns:

  • (String)


216
217
218
# File 'ec2/cfn_security_group.rb', line 216

def attr_group_id()
  jsii_get_property("attrGroupId")
end

#attr_idString

The group name or group ID depending on whether the SG is created in default or specific VPC.

Returns:

  • (String)


223
224
225
# File 'ec2/cfn_security_group.rb', line 223

def attr_id()
  jsii_get_property("attrId")
end

#attr_vpc_idString

The ID of the VPC, such as vpc-0669f8f9 .

Returns:

  • (String)


230
231
232
# File 'ec2/cfn_security_group.rb', line 230

def attr_vpc_id()
  jsii_get_property("attrVpcId")
end

#cfn_optionsAWSCDK::ICfnResourceOptions

Options for this resource, such as condition, update policy etc.



162
163
164
# File 'ec2/cfn_security_group.rb', line 162

def cfn_options()
  jsii_get_property("cfnOptions")
end

#cfn_propertiesHash{String => Object}

Returns:

  • (Hash{String => Object})


167
168
169
# File 'ec2/cfn_security_group.rb', line 167

def cfn_properties()
  jsii_get_property("cfnProperties")
end

#cfn_property_name(cdk_property_name) ⇒ String?

Parameters:

  • cdk_property_name (String)

Returns:

  • (String, nil)


515
516
517
518
# File 'ec2/cfn_security_group.rb', line 515

def cfn_property_name(cdk_property_name)
  Jsii::Type.check_type(cdk_property_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cdkPropertyName")
  jsii_call_method("cfnPropertyName", [cdk_property_name])
end

#cfn_property_namesHash{String => String}

Returns:

  • (Hash{String => String})


172
173
174
# File 'ec2/cfn_security_group.rb', line 172

def cfn_property_names()
  jsii_get_property("cfnPropertyNames")
end

#cfn_resource_typeString

AWS resource type.

Returns:

  • (String)


179
180
181
# File 'ec2/cfn_security_group.rb', line 179

def cfn_resource_type()
  jsii_get_property("cfnResourceType")
end

#creation_stackArray<String>

Returns:

  • (Array<String>)


124
125
126
# File 'ec2/cfn_security_group.rb', line 124

def creation_stack()
  jsii_get_property("creationStack")
end

#envAWSCDK::Interfaces::ResourceEnvironment



184
185
186
# File 'ec2/cfn_security_group.rb', line 184

def env()
  jsii_get_property("env")
end

#get_att(attribute_name, type_hint = nil) ⇒ AWSCDK::Reference

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters:

Returns:



528
529
530
531
532
# File 'ec2/cfn_security_group.rb', line 528

def get_att(attribute_name, type_hint = nil)
  Jsii::Type.check_type(attribute_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "attributeName")
  Jsii::Type.check_type(type_hint, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZXNvbHV0aW9uVHlwZUhpbnQifQ==")), "typeHint") unless type_hint.nil?
  jsii_call_method("getAtt", [attribute_name, type_hint])
end

#get_metadata(key) ⇒ Object

Retrieve a value value from the CloudFormation Resource Metadata.



539
540
541
542
# File 'ec2/cfn_security_group.rb', line 539

def (key)
  Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key")
  jsii_call_method("getMetadata", [key])
end

#group_descriptionString

A description for the security group.

Returns:

  • (String)


251
252
253
# File 'ec2/cfn_security_group.rb', line 251

def group_description()
  jsii_get_property("groupDescription")
end

#group_description=(value) ⇒ Object



255
256
257
258
# File 'ec2/cfn_security_group.rb', line 255

def group_description=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "groupDescription")
  jsii_set_property("groupDescription", value)
end

#group_nameString?

The name of the security group.

Names are case-insensitive and must be unique within the VPC.

Returns:

  • (String, nil)


265
266
267
# File 'ec2/cfn_security_group.rb', line 265

def group_name()
  jsii_get_property("groupName")
end

#group_name=(value) ⇒ Object



269
270
271
272
# File 'ec2/cfn_security_group.rb', line 269

def group_name=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "groupName") unless value.nil?
  jsii_set_property("groupName", value)
end

#inspect(inspector) ⇒ void

This method returns an undefined value.

Examines the CloudFormation resource and discloses attributes.

Parameters:



609
610
611
612
# File 'ec2/cfn_security_group.rb', line 609

def inspect(inspector)
  Jsii::Type.check_type(inspector, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5UcmVlSW5zcGVjdG9yIn0=")), "inspector")
  jsii_call_method("inspect", [inspector])
end

#logical_idString

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use override_logical_id(new_logical_id).

Returns:

  • (String)


136
137
138
# File 'ec2/cfn_security_group.rb', line 136

def logical_id()
  jsii_get_property("logicalId")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


119
120
121
# File 'ec2/cfn_security_group.rb', line 119

def node()
  jsii_get_property("node")
end

#obtain_dependenciesArray<AWSCDK::CfnResource, AWSCDK::Stack>

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.

Returns:



550
551
552
# File 'ec2/cfn_security_group.rb', line 550

def obtain_dependencies()
  jsii_call_method("obtainDependencies", [])
end

#obtain_resource_dependenciesArray<AWSCDK::CfnResource>

Get a shallow copy of dependencies between this resource and other resources in the same stack.

Returns:



557
558
559
# File 'ec2/cfn_security_group.rb', line 557

def obtain_resource_dependencies()
  jsii_call_method("obtainResourceDependencies", [])
end

#override_logical_id(new_logical_id) ⇒ void

This method returns an undefined value.

Overrides the auto-generated logical ID with a specific ID.

Parameters:

  • new_logical_id (String)

    The new logical ID to use for this stack element.



350
351
352
353
# File 'ec2/cfn_security_group.rb', line 350

def override_logical_id(new_logical_id)
  Jsii::Type.check_type(new_logical_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "newLogicalId")
  jsii_call_method("overrideLogicalId", [new_logical_id])
end

#refString

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

Returns:

  • (String)


155
156
157
# File 'ec2/cfn_security_group.rb', line 155

def ref()
  jsii_get_property("ref")
end

#remove_dependency(target) ⇒ void

This method returns an undefined value.

Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

Parameters:



568
569
570
571
# File 'ec2/cfn_security_group.rb', line 568

def remove_dependency(target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "target")
  jsii_call_method("removeDependency", [target])
end

#render_properties(props) ⇒ Hash{String => Object}

Parameters:

  • props (Hash{String => Object})

Returns:

  • (Hash{String => Object})


575
576
577
578
# File 'ec2/cfn_security_group.rb', line 575

def render_properties(props)
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "props")
  jsii_call_method("renderProperties", [props])
end

#replace_dependency(target, new_target) ⇒ void

This method returns an undefined value.

Replaces one dependency with another.

Parameters:



585
586
587
588
589
# File 'ec2/cfn_security_group.rb', line 585

def replace_dependency(target, new_target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "target")
  Jsii::Type.check_type(new_target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "newTarget")
  jsii_call_method("replaceDependency", [target, new_target])
end

#security_group_egressAWSCDK::IResolvable, ...

The outbound rules associated with the security group.



277
278
279
# File 'ec2/cfn_security_group.rb', line 277

def security_group_egress()
  jsii_get_property("securityGroupEgress")
end

#security_group_egress=(value) ⇒ Object



281
282
283
284
# File 'ec2/cfn_security_group.rb', line 281

def security_group_egress=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNlY3VyaXR5R3JvdXAuRWdyZXNzUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "securityGroupEgress") unless value.nil?
  jsii_set_property("securityGroupEgress", value)
end

#security_group_ingressAWSCDK::IResolvable, ...

The inbound rules associated with the security group.



289
290
291
# File 'ec2/cfn_security_group.rb', line 289

def security_group_ingress()
  jsii_get_property("securityGroupIngress")
end

#security_group_ingress=(value) ⇒ Object



293
294
295
296
# File 'ec2/cfn_security_group.rb', line 293

def security_group_ingress=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNlY3VyaXR5R3JvdXAuSW5ncmVzc1Byb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "securityGroupIngress") unless value.nil?
  jsii_set_property("securityGroupIngress", value)
end

#security_group_refAWSCDK::Interfaces::AWSEC2::SecurityGroupReference

A reference to a SecurityGroup resource.



237
238
239
# File 'ec2/cfn_security_group.rb', line 237

def security_group_ref()
  jsii_get_property("securityGroupRef")
end

#should_synthesizeBoolean

Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template.

Returns:

  • (Boolean)

    true if the resource should be included or false is the resource should be omitted.



594
595
596
# File 'ec2/cfn_security_group.rb', line 594

def should_synthesize()
  jsii_call_method("shouldSynthesize", [])
end

#stackAWSCDK::Stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Returns:



145
146
147
# File 'ec2/cfn_security_group.rb', line 145

def stack()
  jsii_get_property("stack")
end

#tagsAWSCDK::TagManager

Tag Manager which manages the tags for this resource.

Returns:



244
245
246
# File 'ec2/cfn_security_group.rb', line 244

def tags()
  jsii_get_property("tags")
end

#tags_rawArray<AWSCDK::CfnTag>?

Any tags assigned to the security group.

Returns:



301
302
303
# File 'ec2/cfn_security_group.rb', line 301

def tags_raw()
  jsii_get_property("tagsRaw")
end

#tags_raw=(value) ⇒ Object



305
306
307
308
309
# File 'ec2/cfn_security_group.rb', line 305

def tags_raw=(value)
  value = value.is_a?(Array) ? value.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : value
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tagsRaw") unless value.nil?
  jsii_set_property("tagsRaw", value)
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)

    a string representation of this resource



326
327
328
# File 'ec2/cfn_security_group.rb', line 326

def to_string()
  jsii_call_method("toString", [])
end

#updated_properitesHash{String => Object}

Deprecated.

use updatedProperties Return properties modified after initiation Resources that expose mutable properties should override this function to collect and return the properties object for this resource.

Deprecated.

Returns:

  • (Hash{String => Object})


192
193
194
# File 'ec2/cfn_security_group.rb', line 192

def updated_properites()
  jsii_get_property("updatedProperites")
end

#updated_propertiesHash{String => Object}

Return properties modified after initiation.

Resources that expose mutable properties should override this function to collect and return the properties object for this resource.

Returns:

  • (Hash{String => Object})


202
203
204
# File 'ec2/cfn_security_group.rb', line 202

def updated_properties()
  jsii_get_property("updatedProperties")
end

#validate_properties(_properties) ⇒ void

This method returns an undefined value.

Parameters:

  • _properties (Object)


600
601
602
603
# File 'ec2/cfn_security_group.rb', line 600

def validate_properties(_properties)
  Jsii::Type.check_type(_properties, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "_properties")
  jsii_call_method("validateProperties", [_properties])
end

#vpc_idString?

The ID of the VPC for the security group.

Returns:

  • (String, nil)


314
315
316
# File 'ec2/cfn_security_group.rb', line 314

def vpc_id()
  jsii_get_property("vpcId")
end

#vpc_id=(value) ⇒ Object



318
319
320
321
# File 'ec2/cfn_security_group.rb', line 318

def vpc_id=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "vpcId") unless value.nil?
  jsii_set_property("vpcId", value)
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. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

Returns:

  • (Constructs::IConstruct)


339
340
341
342
343
344
# File 'ec2/cfn_security_group.rb', line 339

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