Class: Aws::EC2::SecurityGroup
- Inherits:
-
Object
- Object
- Aws::EC2::SecurityGroup
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-ec2/security_group.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#description ⇒ String
A description of the security group.
-
#group_name ⇒ String
The name of the security group.
- #id ⇒ String (also: #group_id)
-
#ip_permissions ⇒ Array<Types::IpPermission>
One or more inbound rules associated with the security group.
-
#ip_permissions_egress ⇒ Array<Types::IpPermission>
[EC2-VPC] One or more outbound rules associated with the security group.
-
#owner_id ⇒ String
The AWS account ID of the owner of the security group.
-
#tags ⇒ Array<Types::Tag>
Any tags assigned to the security group.
-
#vpc_id ⇒ String
[EC2-VPC] The ID of the VPC for the security group.
Actions collapse
- #authorize_egress(options = {}) ⇒ EmptyStructure
- #authorize_ingress(options = {}) ⇒ EmptyStructure
- #create_tags(options = {}) ⇒ Tag::Collection
- #delete(options = {}) ⇒ EmptyStructure
- #identifiers ⇒ Object deprecated private Deprecated.
- #revoke_egress(options = {}) ⇒ EmptyStructure
- #revoke_ingress(options = {}) ⇒ EmptyStructure
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::SecurityGroup
Returns the data for this SecurityGroup.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ SecurityGroup
constructor
A new instance of SecurityGroup.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current SecurityGroup.
Constructor Details
#initialize(id, options = {}) ⇒ SecurityGroup #initialize(options = {}) ⇒ SecurityGroup
Returns a new instance of SecurityGroup.
19 20 21 22 23 24 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 19 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @id = extract_id(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() end |
Instance Method Details
#authorize_egress(options = {}) ⇒ EmptyStructure
189 190 191 192 193 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 189 def ( = {}) = .merge(group_id: @id) resp = @client.() resp.data end |
#authorize_ingress(options = {}) ⇒ EmptyStructure
290 291 292 293 294 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 290 def ( = {}) = .merge(group_id: @id) resp = @client.() resp.data end |
#client ⇒ Client
80 81 82 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 80 def client @client end |
#create_tags(options = {}) ⇒ Tag::Collection
318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 318 def ( = {}) batch = [] = Aws::Util.deep_merge(, resources: [@id]) resp = @client.() [:tags].each do |t| batch << Tag.new( resource_id: @id, key: t[:key], value: t[:value], client: @client ) end Tag::Collection.new([batch], size: batch.size) end |
#data ⇒ Types::SecurityGroup
Returns the data for this Aws::EC2::SecurityGroup. Calls Client#describe_security_groups if #data_loaded? is ‘false`.
100 101 102 103 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 100 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
108 109 110 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 108 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EmptyStructure
349 350 351 352 353 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 349 def delete( = {}) = .merge(group_id: @id) resp = @client.delete_security_group() resp.data end |
#description ⇒ String
A description of the security group.
36 37 38 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 36 def description data.description end |
#group_name ⇒ String
The name of the security group.
42 43 44 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 42 def group_name data.group_name end |
#id ⇒ String Also known as: group_id
29 30 31 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 29 def id @id end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
532 533 534 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 532 def identifiers { id: @id } end |
#ip_permissions ⇒ Array<Types::IpPermission>
One or more inbound rules associated with the security group.
48 49 50 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 48 def data. end |
#ip_permissions_egress ⇒ Array<Types::IpPermission>
[EC2-VPC] One or more outbound rules associated with the security group.
61 62 63 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 61 def data. end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::EC2::SecurityGroup. Returns ‘self` making it possible to chain methods.
security_group.reload.data
90 91 92 93 94 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 90 def load resp = @client.describe_security_groups(group_ids: [@id]) @data = resp.security_groups[0] self end |
#owner_id ⇒ String
The AWS account ID of the owner of the security group.
54 55 56 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 54 def owner_id data.owner_id end |
#revoke_egress(options = {}) ⇒ EmptyStructure
430 431 432 433 434 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 430 def revoke_egress( = {}) = .merge(group_id: @id) resp = @client.revoke_security_group_egress() resp.data end |
#revoke_ingress(options = {}) ⇒ EmptyStructure
524 525 526 527 528 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 524 def revoke_ingress( = {}) = .merge(group_id: @id) resp = @client.revoke_security_group_ingress() resp.data end |
#tags ⇒ Array<Types::Tag>
Any tags assigned to the security group.
67 68 69 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 67 def data. end |
#vpc_id ⇒ String
[EC2-VPC] The ID of the VPC for the security group.
73 74 75 |
# File 'lib/aws-sdk-ec2/security_group.rb', line 73 def vpc_id data.vpc_id end |