Class: Fog::Sql::AzureRM::FirewallRule

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

Overview

Sql Server model for Server Firewall Rule Service

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(firewall) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/fog/azurerm/models/sql/firewall_rule.rb', line 15

def self.parse(firewall)
  firewall_hash = get_hash_from_object(firewall)

  firewall_hash['resource_group'] = get_resource_group_from_id(firewall.id)
  firewall_hash['server_name'] = get_resource_from_resource_id(firewall.id, 8)

  firewall_hash
end

Instance Method Details

#destroyObject



30
31
32
# File 'lib/fog/azurerm/models/sql/firewall_rule.rb', line 30

def destroy
  service.delete_firewall_rule(resource_group, server_name, name)
end

#saveObject



24
25
26
27
28
# File 'lib/fog/azurerm/models/sql/firewall_rule.rb', line 24

def save
  requires :resource_group, :server_name, :name, :start_ip, :end_ip
  firewall_rule = service.create_or_update_firewall_rule(format_firewall_params)
  merge_attributes(Fog::Sql::AzureRM::FirewallRule.parse(firewall_rule))
end