class Fog::Network::AzureRM::NetworkSecurityRule

Security Rule model for Network Service

Public Class Methods

parse(nsr) click to toggle source
# 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

Public Instance Methods

destroy() click to toggle source
# 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
save() click to toggle source
# 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_params() click to toggle source
# 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