fog-azure-rm 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +9 -0
- data/lib/fog/azurerm/docs/compute.md +1 -1
- data/lib/fog/azurerm/docs/sql.md +39 -0
- data/lib/fog/azurerm/docs/storage.md +89 -2
- data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -7
- data/lib/fog/azurerm/models/compute/availability_sets.rb +4 -6
- data/lib/fog/azurerm/models/compute/servers.rb +5 -8
- data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +0 -3
- data/lib/fog/azurerm/models/dns/record_sets.rb +5 -9
- data/lib/fog/azurerm/models/dns/zones.rb +4 -7
- data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +0 -3
- data/lib/fog/azurerm/models/network/express_route_circuit_peerings.rb +5 -9
- data/lib/fog/azurerm/models/network/express_route_circuits.rb +4 -7
- data/lib/fog/azurerm/models/network/express_route_service_providers.rb +2 -5
- data/lib/fog/azurerm/models/network/load_balancers.rb +4 -7
- data/lib/fog/azurerm/models/network/local_network_gateways.rb +0 -3
- data/lib/fog/azurerm/models/network/network_interfaces.rb +4 -7
- data/lib/fog/azurerm/models/network/network_security_groups.rb +4 -7
- data/lib/fog/azurerm/models/network/network_security_rules.rb +2 -6
- data/lib/fog/azurerm/models/network/public_ips.rb +4 -7
- data/lib/fog/azurerm/models/network/subnets.rb +5 -9
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +0 -3
- data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +4 -7
- data/lib/fog/azurerm/models/network/virtual_networks.rb +4 -7
- data/lib/fog/azurerm/models/resources/azure_resources.rb +2 -5
- data/lib/fog/azurerm/models/resources/deployments.rb +4 -7
- data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -7
- data/lib/fog/azurerm/models/sql/firewall_rule.rb +52 -0
- data/lib/fog/azurerm/models/sql/firewall_rules.rb +28 -0
- data/lib/fog/azurerm/models/storage/data_disk.rb +1 -0
- data/lib/fog/azurerm/models/storage/directories.rb +1 -4
- data/lib/fog/azurerm/models/storage/files.rb +1 -4
- data/lib/fog/azurerm/models/storage/recovery_vault.rb +50 -0
- data/lib/fog/azurerm/models/storage/recovery_vaults.rb +27 -0
- data/lib/fog/azurerm/models/storage/storage_account.rb +23 -4
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +5 -7
- data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +4 -4
- data/lib/fog/azurerm/requests/sql/create_or_update_firewall_rule.rb +56 -0
- data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +4 -5
- data/lib/fog/azurerm/requests/sql/delete_database.rb +4 -4
- data/lib/fog/azurerm/requests/sql/delete_firewall_rule.rb +36 -0
- data/lib/fog/azurerm/requests/sql/delete_sql_server.rb +2 -2
- data/lib/fog/azurerm/requests/sql/get_database.rb +2 -2
- data/lib/fog/azurerm/requests/sql/get_firewall_rule.rb +43 -0
- data/lib/fog/azurerm/requests/sql/get_sql_server.rb +2 -2
- data/lib/fog/azurerm/requests/sql/list_databases.rb +2 -2
- data/lib/fog/azurerm/requests/sql/list_firewall_rules.rb +55 -0
- data/lib/fog/azurerm/requests/sql/list_sql_servers.rb +2 -2
- data/lib/fog/azurerm/requests/storage/create_disk.rb +36 -0
- data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +54 -0
- data/lib/fog/azurerm/requests/storage/create_storage_account.rb +13 -2
- data/lib/fog/azurerm/requests/storage/delete_disk.rb +5 -9
- data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +35 -0
- data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +60 -0
- data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +61 -0
- data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +56 -0
- data/lib/fog/azurerm/requests/storage/get_backup_container.rb +53 -0
- data/lib/fog/azurerm/requests/storage/get_backup_item.rb +58 -0
- data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +53 -0
- data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +64 -0
- data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +49 -0
- data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +48 -0
- data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +36 -0
- data/lib/fog/azurerm/requests/storage/start_backup.rb +54 -0
- data/lib/fog/azurerm/requests/storage/update_storage_account.rb +59 -0
- data/lib/fog/azurerm/sql.rb +9 -0
- data/lib/fog/azurerm/storage.rb +24 -0
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +8 -0
- data/rakefile +11 -3
- data/test/api_stub.rb +4 -0
- data/test/api_stub/models/sql/sql_firewall_rule.rb +22 -0
- data/test/api_stub/models/storage/recovery_vault.rb +23 -0
- data/test/api_stub/requests/sql/firewall_rule.rb +46 -0
- data/test/api_stub/requests/storage/recovery_vault.rb +189 -0
- data/test/api_stub/requests/storage/storageaccount.rb +2 -1
- data/test/integration/container.rb +4 -3
- data/test/integration/data_disk.rb +77 -0
- data/test/integration/express_route_circuit.rb +9 -9
- data/test/integration/server.rb +9 -2
- data/test/integration/sql_server.rb +35 -0
- data/test/integration/storage_account.rb +9 -1
- data/test/models/sql/test_firewall_rule.rb +54 -0
- data/test/models/sql/test_firewall_rules.rb +41 -0
- data/test/models/storage/test_recovery_vault.rb +61 -0
- data/test/models/storage/test_recovery_vaults.rb +47 -0
- data/test/models/storage/test_storage_account.rb +8 -1
- data/test/requests/sql/test_create_or_update_firewall_rule.rb +27 -0
- data/test/requests/sql/test_delete_firewall_rule.rb +34 -0
- data/test/requests/sql/test_get_firewall_rule.rb +35 -0
- data/test/requests/sql/test_list_firewall_rules.rb +35 -0
- data/test/requests/storage/test_create_disk.rb +17 -0
- data/test/requests/storage/test_create_recovery_vault.rb +35 -0
- data/test/requests/storage/test_delete_disk.rb +23 -0
- data/test/requests/storage/test_delete_recovery_vault.rb +34 -0
- data/test/requests/storage/test_disable_backup_protection.rb +52 -0
- data/test/requests/storage/test_enable_backup_protection.rb +66 -0
- data/test/requests/storage/test_get_all_backup_jobs.rb +35 -0
- data/test/requests/storage/test_get_backup_container.rb +35 -0
- data/test/requests/storage/test_get_backup_item.rb +35 -0
- data/test/requests/storage/test_get_backup_job_for_vm.rb +26 -0
- data/test/requests/storage/test_get_backup_protection_policy.rb +35 -0
- data/test/requests/storage/test_get_recovery_vault.rb +35 -0
- data/test/requests/storage/test_list_recovery_vault.rb +35 -0
- data/test/requests/storage/test_set_recovery_vault_context.rb +34 -0
- data/test/requests/storage/test_start_backup.rb +55 -0
- data/test/requests/storage/test_update_storage_account.rb +34 -0
- data/test/smoke_tests/compute/test_resource_group_smoke.rb +34 -24
- data/test/test_helper.rb +26 -0
- metadata +55 -2
@@ -1,17 +1,14 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/network/express_route_service_provider'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Network
|
6
3
|
class AzureRM
|
7
4
|
# ExpressRouteServiceProvider collection class for Network Service
|
8
5
|
class ExpressRouteServiceProviders < Fog::Collection
|
9
|
-
model
|
6
|
+
model ExpressRouteServiceProvider
|
10
7
|
|
11
8
|
def all
|
12
9
|
express_route_service_providers = []
|
13
10
|
service.list_express_route_service_providers.each do |service_provider|
|
14
|
-
express_route_service_providers <<
|
11
|
+
express_route_service_providers << ExpressRouteServiceProvider.parse(service_provider)
|
15
12
|
end
|
16
13
|
load(express_route_service_providers)
|
17
14
|
end
|
@@ -1,27 +1,24 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/network/load_balancer'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Network
|
6
3
|
class AzureRM
|
7
4
|
# LoadBalancers collection class for Network Service
|
8
5
|
class LoadBalancers < Fog::Collection
|
9
|
-
model
|
6
|
+
model LoadBalancer
|
10
7
|
attribute :resource_group
|
11
8
|
|
12
9
|
def all
|
13
10
|
requires :resource_group
|
14
11
|
load_balancers = []
|
15
12
|
service.list_load_balancers(resource_group).each do |load_balancer|
|
16
|
-
load_balancers <<
|
13
|
+
load_balancers << LoadBalancer.parse(load_balancer)
|
17
14
|
end
|
18
15
|
load(load_balancers)
|
19
16
|
end
|
20
17
|
|
21
18
|
def get(resource_group_name, load_balancer_name)
|
22
19
|
lb = service.get_load_balancer(resource_group_name, load_balancer_name)
|
23
|
-
load_balancer =
|
24
|
-
load_balancer.merge_attributes(
|
20
|
+
load_balancer = LoadBalancer.new(service: service)
|
21
|
+
load_balancer.merge_attributes(LoadBalancer.parse(lb))
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
@@ -1,27 +1,24 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/network/network_interface'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Network
|
6
3
|
class AzureRM
|
7
4
|
# NetworkInterfaces collection class for Network Service
|
8
5
|
class NetworkInterfaces < Fog::Collection
|
9
|
-
model
|
6
|
+
model NetworkInterface
|
10
7
|
attribute :resource_group
|
11
8
|
|
12
9
|
def all
|
13
10
|
requires :resource_group
|
14
11
|
network_interfaces = []
|
15
12
|
service.list_network_interfaces(resource_group).each do |nic|
|
16
|
-
network_interfaces <<
|
13
|
+
network_interfaces << NetworkInterface.parse(nic)
|
17
14
|
end
|
18
15
|
load(network_interfaces)
|
19
16
|
end
|
20
17
|
|
21
18
|
def get(resource_group_name, name)
|
22
19
|
nic = service.get_network_interface(resource_group_name, name)
|
23
|
-
network_interface_card =
|
24
|
-
network_interface_card.merge_attributes(
|
20
|
+
network_interface_card = NetworkInterface.new(service: service)
|
21
|
+
network_interface_card.merge_attributes(NetworkInterface.parse(nic))
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
@@ -1,27 +1,24 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/network/network_security_group'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Network
|
6
3
|
class AzureRM
|
7
4
|
# collection class for Network Security Group
|
8
5
|
class NetworkSecurityGroups < Fog::Collection
|
9
|
-
model
|
6
|
+
model NetworkSecurityGroup
|
10
7
|
attribute :resource_group
|
11
8
|
|
12
9
|
def all
|
13
10
|
requires :resource_group
|
14
11
|
network_security_groups = []
|
15
12
|
service.list_network_security_groups(resource_group).each do |nsg|
|
16
|
-
network_security_groups <<
|
13
|
+
network_security_groups << NetworkSecurityGroup.parse(nsg)
|
17
14
|
end
|
18
15
|
load(network_security_groups)
|
19
16
|
end
|
20
17
|
|
21
18
|
def get(resource_group, name)
|
22
19
|
nsg = service.get_network_security_group(resource_group, name)
|
23
|
-
network_security_group =
|
24
|
-
network_security_group.merge_attributes(
|
20
|
+
network_security_group = NetworkSecurityGroup.new(service: service)
|
21
|
+
network_security_group.merge_attributes(NetworkSecurityGroup.parse(nsg))
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
@@ -1,18 +1,14 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/network/network_security_rule'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Network
|
6
3
|
class AzureRM
|
7
4
|
# collection class for Network Security Rule
|
8
5
|
class NetworkSecurityRules < Fog::Collection
|
9
|
-
model
|
6
|
+
model NetworkSecurityRule
|
10
7
|
attribute :resource_group
|
11
8
|
attribute :network_security_group_name
|
12
9
|
|
13
10
|
def all
|
14
|
-
requires :resource_group
|
15
|
-
requires :network_security_group_name
|
11
|
+
requires :resource_group, :network_security_group_name
|
16
12
|
network_security_rules = []
|
17
13
|
service.list_network_security_rules(resource_group, network_security_group_name).each do |nsr|
|
18
14
|
network_security_rules << NetworkSecurityRule.parse(nsr)
|
@@ -1,27 +1,24 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/network/public_ip'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Network
|
6
3
|
class AzureRM
|
7
4
|
# PublicIPs collection class for Network Service
|
8
5
|
class PublicIps < Fog::Collection
|
9
|
-
model
|
6
|
+
model PublicIp
|
10
7
|
attribute :resource_group
|
11
8
|
|
12
9
|
def all
|
13
10
|
requires :resource_group
|
14
11
|
public_ips = []
|
15
12
|
service.list_public_ips(resource_group).each do |pip|
|
16
|
-
public_ips <<
|
13
|
+
public_ips << PublicIp.parse(pip)
|
17
14
|
end
|
18
15
|
load(public_ips)
|
19
16
|
end
|
20
17
|
|
21
18
|
def get(resource_group_name, public_ip_name)
|
22
19
|
public_ip = service.get_public_ip(resource_group_name, public_ip_name)
|
23
|
-
public_ip_object =
|
24
|
-
public_ip_object.merge_attributes(
|
20
|
+
public_ip_object = PublicIp.new(service: service)
|
21
|
+
public_ip_object.merge_attributes(PublicIp.parse(public_ip))
|
25
22
|
end
|
26
23
|
|
27
24
|
def check_if_exists(resource_group, name)
|
@@ -1,29 +1,25 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/network/subnet'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Network
|
6
3
|
class AzureRM
|
7
4
|
# Subnet collection for network service
|
8
5
|
class Subnets < Fog::Collection
|
9
|
-
model
|
6
|
+
model Subnet
|
10
7
|
attribute :resource_group
|
11
8
|
attribute :virtual_network_name
|
12
9
|
|
13
10
|
def all
|
14
|
-
requires :resource_group
|
15
|
-
requires :virtual_network_name
|
11
|
+
requires :resource_group, :virtual_network_name
|
16
12
|
subnets = []
|
17
13
|
service.list_subnets(resource_group, virtual_network_name).each do |subnet|
|
18
|
-
subnets <<
|
14
|
+
subnets << Subnet.parse(subnet)
|
19
15
|
end
|
20
16
|
load(subnets)
|
21
17
|
end
|
22
18
|
|
23
19
|
def get(resource_group, virtual_network_name, subnet_name)
|
24
20
|
subnet = service.get_subnet(resource_group, virtual_network_name, subnet_name)
|
25
|
-
subnet_object =
|
26
|
-
subnet_object.merge_attributes(
|
21
|
+
subnet_object = Subnet.new(service: service)
|
22
|
+
subnet_object.merge_attributes(Subnet.parse(subnet))
|
27
23
|
end
|
28
24
|
end
|
29
25
|
end
|
@@ -1,27 +1,24 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/network/virtual_network_gateway'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Network
|
6
3
|
class AzureRM
|
7
4
|
# VirtualNetworkGateways collection class for Network Service
|
8
5
|
class VirtualNetworkGateways < Fog::Collection
|
9
|
-
model
|
6
|
+
model VirtualNetworkGateway
|
10
7
|
attribute :resource_group
|
11
8
|
|
12
9
|
def all
|
13
10
|
requires :resource_group
|
14
11
|
network_gateways = []
|
15
12
|
service.list_virtual_network_gateways(resource_group).each do |gateway|
|
16
|
-
network_gateways <<
|
13
|
+
network_gateways << VirtualNetworkGateway.parse(gateway)
|
17
14
|
end
|
18
15
|
load(network_gateways)
|
19
16
|
end
|
20
17
|
|
21
18
|
def get(resource_group_name, name)
|
22
19
|
network_gateway = service.get_virtual_network_gateway(resource_group_name, name)
|
23
|
-
virtual_network_gateway =
|
24
|
-
virtual_network_gateway.merge_attributes(
|
20
|
+
virtual_network_gateway = VirtualNetworkGateway.new(service: service)
|
21
|
+
virtual_network_gateway.merge_attributes(VirtualNetworkGateway.parse(network_gateway))
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
@@ -1,28 +1,25 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/network/virtual_network'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Network
|
6
3
|
class AzureRM
|
7
4
|
# This class is giving implementation of all/list, get and
|
8
5
|
# check name availability for virtual network.
|
9
6
|
class VirtualNetworks < Fog::Collection
|
10
|
-
model
|
7
|
+
model VirtualNetwork
|
11
8
|
attribute :resource_group
|
12
9
|
|
13
10
|
def all
|
14
11
|
requires :resource_group
|
15
12
|
virtual_networks = []
|
16
13
|
service.list_virtual_networks(resource_group).each do |vnet|
|
17
|
-
virtual_networks <<
|
14
|
+
virtual_networks << VirtualNetwork.parse(vnet)
|
18
15
|
end
|
19
16
|
load(virtual_networks)
|
20
17
|
end
|
21
18
|
|
22
19
|
def get(resource_group_name, virtual_network_name)
|
23
20
|
virtual_network = service.get_virtual_network(resource_group_name, virtual_network_name)
|
24
|
-
virtual_network_object =
|
25
|
-
virtual_network_object.merge_attributes(
|
21
|
+
virtual_network_object = VirtualNetwork.new(service: service)
|
22
|
+
virtual_network_object.merge_attributes(VirtualNetwork.parse(virtual_network))
|
26
23
|
end
|
27
24
|
|
28
25
|
def check_if_exists(resource_group, name)
|
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/resources/azure_resource'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Resources
|
6
3
|
class AzureRM
|
@@ -8,13 +5,13 @@ module Fog
|
|
8
5
|
class AzureResources < Fog::Collection
|
9
6
|
attribute :tag_name
|
10
7
|
attribute :tag_value
|
11
|
-
model
|
8
|
+
model AzureResource
|
12
9
|
|
13
10
|
def all
|
14
11
|
unless tag_name.nil? && tag_value.nil?
|
15
12
|
resources = []
|
16
13
|
service.list_tagged_resources(tag_name, tag_value).each do |resource|
|
17
|
-
resources <<
|
14
|
+
resources << AzureResource.parse(resource)
|
18
15
|
end
|
19
16
|
resources.inspect
|
20
17
|
return load(resources)
|
@@ -1,27 +1,24 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/resources/deployment'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Resources
|
6
3
|
class AzureRM
|
7
4
|
# Deployments collection class
|
8
5
|
class Deployments < Fog::Collection
|
9
6
|
attribute :resource_group
|
10
|
-
model
|
7
|
+
model Deployment
|
11
8
|
|
12
9
|
def all
|
13
10
|
requires :resource_group
|
14
11
|
deployments = []
|
15
12
|
service.list_deployments(resource_group).each do |deployment|
|
16
|
-
deployments <<
|
13
|
+
deployments << Deployment.parse(deployment)
|
17
14
|
end
|
18
15
|
load(deployments)
|
19
16
|
end
|
20
17
|
|
21
18
|
def get(resource_group_name, deployment_name)
|
22
19
|
deployment = service.get_deployment(resource_group_name, deployment_name)
|
23
|
-
deployment_object =
|
24
|
-
deployment_object.merge_attributes(
|
20
|
+
deployment_object = Deployment.new(service: service)
|
21
|
+
deployment_object.merge_attributes(Deployment.parse(deployment))
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
@@ -1,26 +1,23 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/azurerm/models/resources/resource_group'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module Resources
|
6
3
|
class AzureRM
|
7
4
|
# This class is giving implementation of all/list, get and
|
8
5
|
# check name availability for resource groups.
|
9
6
|
class ResourceGroups < Fog::Collection
|
10
|
-
model
|
7
|
+
model ResourceGroup
|
11
8
|
|
12
9
|
def all
|
13
10
|
resource_groups = []
|
14
11
|
service.list_resource_groups.each do |resource_group|
|
15
|
-
resource_groups.push(
|
12
|
+
resource_groups.push(ResourceGroup.parse(resource_group))
|
16
13
|
end
|
17
14
|
load(resource_groups)
|
18
15
|
end
|
19
16
|
|
20
17
|
def get(resource_group_name)
|
21
18
|
resource_group = service.get_resource_group(resource_group_name)
|
22
|
-
resource_group_object =
|
23
|
-
resource_group_object.merge_attributes(
|
19
|
+
resource_group_object = ResourceGroup.new(service: service)
|
20
|
+
resource_group_object.merge_attributes(ResourceGroup.parse(resource_group))
|
24
21
|
end
|
25
22
|
end
|
26
23
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Fog
|
2
|
+
module Sql
|
3
|
+
class AzureRM
|
4
|
+
# Sql Server model for Server Firewall Rule Service
|
5
|
+
class FirewallRule < Fog::Model
|
6
|
+
identity :name
|
7
|
+
attribute :id
|
8
|
+
attribute :type
|
9
|
+
attribute :resource_group
|
10
|
+
attribute :location
|
11
|
+
attribute :start_ip
|
12
|
+
attribute :end_ip
|
13
|
+
attribute :server_name
|
14
|
+
|
15
|
+
def self.parse(firewall)
|
16
|
+
{
|
17
|
+
id: firewall['id'],
|
18
|
+
type: firewall['type'],
|
19
|
+
name: firewall['name'],
|
20
|
+
location: firewall['location'],
|
21
|
+
resource_group: get_resource_group_from_id(firewall['id']),
|
22
|
+
server_name: get_server_name_from_id(firewall['id']),
|
23
|
+
start_ip: firewall['properties']['startIpAddress'],
|
24
|
+
end_ip: firewall['properties']['endIpAddress']
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def save
|
29
|
+
requires :resource_group, :server_name, :name, :start_ip, :end_ip
|
30
|
+
firewall_rule = service.create_or_update_firewall_rule(firewall_params)
|
31
|
+
merge_attributes(FirewallRule.parse(firewall_rule))
|
32
|
+
end
|
33
|
+
|
34
|
+
def destroy
|
35
|
+
service.delete_firewall_rule(resource_group, server_name, name)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def firewall_params
|
41
|
+
{
|
42
|
+
resource_group: resource_group,
|
43
|
+
server_name: server_name,
|
44
|
+
name: name,
|
45
|
+
start_ip: start_ip,
|
46
|
+
end_ip: end_ip
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Sql
|
3
|
+
class AzureRM
|
4
|
+
# Sql Server Collection for Firewall Rules Service
|
5
|
+
class FirewallRules < Fog::Collection
|
6
|
+
attribute :resource_group
|
7
|
+
attribute :server_name
|
8
|
+
model FirewallRule
|
9
|
+
|
10
|
+
def all
|
11
|
+
requires :resource_group, :server_name
|
12
|
+
|
13
|
+
firewall_rules = []
|
14
|
+
service.list_firewall_rules(resource_group, server_name).each do |firewall_rule|
|
15
|
+
firewall_rules << FirewallRule.parse(firewall_rule)
|
16
|
+
end
|
17
|
+
load(firewall_rules)
|
18
|
+
end
|
19
|
+
|
20
|
+
def get(resource_group, server_name, rule_name)
|
21
|
+
firewall_rule = service.get_firewall_rule(resource_group, server_name, rule_name)
|
22
|
+
firewall_rule_obj = FirewallRule.new(service: service)
|
23
|
+
firewall_rule_obj.merge_attributes(FirewallRule.parse(firewall_rule))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|