Class: Fog::Network::AzureRM::NetworkSecurityRule

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/azurerm/models/network/network_security_rule.rb

Overview

Security Rule model for Network Service

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(nsr) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fog/azurerm/models/network/network_security_rule.rb', line 20

def self.parse(nsr)
  hash = {}
  hash['id'] = nsr.id
  hash['name'] = nsr.name
  hash['resource_group'] = get_resource_group_from_id(nsr.id)
  hash['network_security_group_name'] = get_resource_from_resource_id(nsr.id, RESOURCE_NAME)
  hash['description'] = nsr.description
  hash['protocol'] = nsr.protocol
  hash['source_port_range'] = nsr.source_port_range
  hash['destination_port_range'] = nsr.destination_port_range
  hash['source_address_prefix'] = nsr.source_address_prefix
  hash['destination_address_prefix'] = nsr.destination_address_prefix
  hash['access'] = nsr.access
  hash['priority'] = nsr.priority
  hash['direction'] = nsr.direction
  hash
end

Instance Method Details

#destroyObject



60
61
62
# File 'lib/fog/azurerm/models/network/network_security_rule.rb', line 60

def destroy
  service.delete_network_security_rule(resource_group, network_security_group_name, name)
end

#saveObject



38
39
40
41
42
# File 'lib/fog/azurerm/models/network/network_security_rule.rb', line 38

def save
  requires :name, :network_security_group_name, :resource_group, :protocol, :source_port_range, :destination_port_range, :source_address_prefix, :destination_address_prefix, :access, :priority, :direction
  network_security_rule = service.create_or_update_network_security_rule(security_rule_params)
  merge_attributes(Fog::Network::AzureRM::NetworkSecurityRule.parse(network_security_rule))
end

#security_rule_paramsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fog/azurerm/models/network/network_security_rule.rb', line 44

def security_rule_params
  {
    name: name,
    resource_group: resource_group,
    protocol: protocol,
    network_security_group_name: network_security_group_name,
    source_port_range: source_port_range,
    destination_port_range: destination_port_range,
    source_address_prefix: source_address_prefix,
    destination_address_prefix: destination_address_prefix,
    access: access,
    priority: priority,
    direction: direction
  }
end