fog-azure-rm 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -1
- data/README.md +0 -1
- data/fog-azure-rm.gemspec +4 -1
- data/lib/fog/azurerm.rb +7 -0
- data/lib/fog/azurerm/application_gateway.rb +10 -2
- data/lib/fog/azurerm/compute.rb +14 -4
- data/lib/fog/azurerm/config.rb +0 -51
- data/lib/fog/azurerm/constants.rb +51 -0
- data/lib/fog/azurerm/dns.rb +12 -4
- data/lib/fog/azurerm/docs/application_gateway.md +38 -4
- data/lib/fog/azurerm/docs/compute.md +23 -4
- data/lib/fog/azurerm/docs/dns.md +18 -4
- data/lib/fog/azurerm/docs/key_vault.md +88 -0
- data/lib/fog/azurerm/docs/network.md +98 -9
- data/lib/fog/azurerm/docs/resources.md +24 -4
- data/lib/fog/azurerm/docs/sql.md +5 -6
- data/lib/fog/azurerm/docs/storage.md +12 -0
- data/lib/fog/azurerm/docs/traffic_manager.md +22 -4
- data/lib/fog/azurerm/key_vault.rb +51 -0
- data/lib/fog/azurerm/models/application_gateway/backend_address_pool.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/backend_http_setting.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/frontend_ip_configuration.rb +4 -0
- data/lib/fog/azurerm/models/application_gateway/frontend_port.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +2 -6
- data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -0
- data/lib/fog/azurerm/models/application_gateway/http_listener.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/ip_configuration.rb +3 -0
- data/lib/fog/azurerm/models/application_gateway/probe.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/request_routing_rule.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/ssl_certificate.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/url_path_map.rb +2 -0
- data/lib/fog/azurerm/models/compute/availability_sets.rb +4 -0
- data/lib/fog/azurerm/models/compute/servers.rb +4 -0
- data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +4 -0
- data/lib/fog/azurerm/models/dns/record_sets.rb +4 -0
- data/lib/fog/azurerm/models/dns/zones.rb +2 -2
- data/lib/fog/azurerm/models/key_vault/access_policy_entry.rb +31 -0
- data/lib/fog/azurerm/models/key_vault/vault.rb +76 -0
- data/lib/fog/azurerm/models/key_vault/vaults.rb +27 -0
- data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +4 -0
- data/lib/fog/azurerm/models/network/express_route_circuits.rb +4 -0
- data/lib/fog/azurerm/models/network/load_balancers.rb +12 -2
- data/lib/fog/azurerm/models/network/local_network_gateways.rb +4 -0
- data/lib/fog/azurerm/models/network/network_interfaces.rb +4 -0
- data/lib/fog/azurerm/models/network/network_security_groups.rb +4 -0
- data/lib/fog/azurerm/models/network/network_security_rules.rb +4 -0
- data/lib/fog/azurerm/models/network/public_ips.rb +2 -9
- data/lib/fog/azurerm/models/network/subnets.rb +4 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +4 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +4 -0
- data/lib/fog/azurerm/models/network/virtual_networks.rb +9 -11
- data/lib/fog/azurerm/models/resources/azure_resources.rb +4 -0
- data/lib/fog/azurerm/models/resources/deployments.rb +4 -0
- data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -0
- data/lib/fog/azurerm/models/sql/firewall_rule.rb +5 -17
- data/lib/fog/azurerm/models/sql/firewall_rules.rb +4 -0
- data/lib/fog/azurerm/models/sql/sql_database.rb +4 -21
- data/lib/fog/azurerm/models/sql/sql_databases.rb +4 -0
- data/lib/fog/azurerm/models/sql/sql_server.rb +5 -18
- data/lib/fog/azurerm/models/sql/sql_servers.rb +4 -0
- data/lib/fog/azurerm/models/storage/directories.rb +4 -0
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -0
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_points.rb +4 -0
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profiles.rb +4 -0
- data/lib/fog/azurerm/network.rb +22 -4
- data/lib/fog/azurerm/requests/application_gateway/check_ag_exists.rb +31 -0
- data/lib/fog/azurerm/requests/application_gateway/create_or_update_application_gateway.rb +6 -0
- data/lib/fog/azurerm/requests/compute/check_availability_set_exists.rb +31 -0
- data/lib/fog/azurerm/requests/compute/check_vm_exists.rb +31 -0
- data/lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb +31 -0
- data/lib/fog/azurerm/requests/dns/check_record_set_exists.rb +31 -0
- data/lib/fog/azurerm/requests/dns/{check_for_zone.rb → check_zone_exists.rb} +4 -2
- data/lib/fog/azurerm/requests/dns/list_record_sets.rb +1 -1
- data/lib/fog/azurerm/requests/dns/list_zones.rb +2 -2
- data/lib/fog/azurerm/requests/key_vault/check_vault_exists.rb +31 -0
- data/lib/fog/azurerm/requests/key_vault/create_or_update_vault.rb +105 -0
- data/lib/fog/azurerm/requests/key_vault/delete_vault.rb +28 -0
- data/lib/fog/azurerm/requests/key_vault/get_vault.rb +54 -0
- data/lib/fog/azurerm/requests/key_vault/list_vaults.rb +56 -0
- data/lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_load_balancer_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_network_interface_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/{check_for_public_ip.rb → check_public_ip_exists.rb} +12 -5
- data/lib/fog/azurerm/requests/network/check_subnet_exists.rb +32 -0
- data/lib/fog/azurerm/requests/network/{check_for_virtual_network.rb → check_virtual_network_exists.rb} +11 -6
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb +32 -0
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb +32 -0
- data/lib/fog/azurerm/requests/network/list_load_balancers_in_subscription.rb +31 -0
- data/lib/fog/azurerm/requests/network/list_virtual_networks_in_subscription.rb +74 -0
- data/lib/fog/azurerm/requests/resources/check_azure_resource_exists.rb +40 -0
- data/lib/fog/azurerm/requests/resources/check_deployment_exists.rb +30 -0
- data/lib/fog/azurerm/requests/resources/check_resource_group_exists.rb +30 -0
- data/lib/fog/azurerm/requests/sql/check_database_exists.rb +21 -0
- data/lib/fog/azurerm/requests/sql/check_firewall_rule_exists.rb +21 -0
- data/lib/fog/azurerm/requests/sql/check_sql_server_exists.rb +21 -0
- data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +26 -32
- data/lib/fog/azurerm/requests/sql/create_or_update_firewall_rule.rb +8 -22
- data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +14 -24
- data/lib/fog/azurerm/requests/sql/delete_database.rb +2 -9
- data/lib/fog/azurerm/requests/sql/delete_firewall_rule.rb +2 -9
- data/lib/fog/azurerm/requests/sql/delete_sql_server.rb +3 -9
- data/lib/fog/azurerm/requests/sql/get_database.rb +4 -10
- data/lib/fog/azurerm/requests/sql/get_firewall_rule.rb +4 -10
- data/lib/fog/azurerm/requests/sql/get_sql_server.rb +3 -10
- data/lib/fog/azurerm/requests/sql/list_databases.rb +3 -10
- data/lib/fog/azurerm/requests/sql/list_firewall_rules.rb +4 -10
- data/lib/fog/azurerm/requests/sql/list_sql_servers.rb +3 -10
- data/lib/fog/azurerm/requests/storage/check_container_exists.rb +30 -0
- data/lib/fog/azurerm/requests/storage/check_storage_account_exists.rb +31 -0
- data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +1 -1
- data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +1 -1
- data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +1 -1
- data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_container.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_item.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +1 -1
- data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +1 -1
- data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +1 -1
- data/lib/fog/azurerm/requests/storage/start_backup.rb +1 -1
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb +31 -0
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb +31 -0
- data/lib/fog/azurerm/resources.rb +10 -2
- data/lib/fog/azurerm/sql.rb +18 -10
- data/lib/fog/azurerm/storage.rb +4 -0
- data/lib/fog/azurerm/traffic_manager.rb +9 -2
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +3 -10
- data/test/api_stub.rb +8 -0
- data/test/api_stub/models/key_vault/vault.rb +39 -0
- data/test/api_stub/models/sql/sql_database.rb +18 -16
- data/test/api_stub/models/sql/sql_firewall_rule.rb +12 -10
- data/test/api_stub/models/sql/sql_server.rb +12 -10
- data/test/api_stub/requests/key_vault/vault.rb +95 -0
- data/test/api_stub/requests/sql/database.rb +8 -6
- data/test/api_stub/requests/sql/firewall_rule.rb +8 -4
- data/test/api_stub/requests/sql/sql_server.rb +8 -4
- data/test/integration/Virtual_network_gateway_connection.rb +7 -0
- data/test/integration/application_gateway.rb +8 -0
- data/test/integration/availability_set.rb +13 -2
- data/test/integration/blob.rb +0 -6
- data/test/integration/container.rb +7 -0
- data/test/integration/deployment.rb +7 -0
- data/test/integration/express_route_circuit.rb +16 -0
- data/test/integration/external_load_balancer.rb +18 -0
- data/test/integration/key_vault.rb +98 -0
- data/test/integration/local_network_gateway.rb +8 -0
- data/test/integration/network_interface.rb +8 -0
- data/test/integration/network_security_group.rb +8 -0
- data/test/integration/network_security_rule.rb +8 -0
- data/test/integration/public_ip.rb +3 -2
- data/test/integration/record_set.rb +8 -0
- data/test/integration/resource_group.rb +12 -4
- data/test/integration/resource_tag.rb +7 -0
- data/test/integration/server.rb +8 -0
- data/test/integration/sql_server.rb +23 -3
- data/test/integration/storage_account.rb +8 -1
- data/test/integration/subnet.rb +7 -0
- data/test/integration/traffic_manager.rb +14 -0
- data/test/integration/virtual_machine_extension.rb +8 -0
- data/test/integration/virtual_network.rb +13 -4
- data/test/integration/virtual_network_gateway.rb +7 -0
- data/test/integration/zone.rb +8 -0
- data/test/models/application_gateway/test_gateway.rb +1 -0
- data/test/models/application_gateway/test_gateways.rb +14 -1
- data/test/models/compute/test_availability_sets.rb +14 -1
- data/test/models/compute/test_servers.rb +14 -1
- data/test/models/compute/test_virtual_machine_extensions.rb +14 -1
- data/test/models/dns/test_record_sets.rb +14 -1
- data/test/models/dns/test_zones.rb +7 -7
- data/test/models/key_vault/test_vault.rb +39 -0
- data/test/models/key_vault/test_vaults.rb +55 -0
- data/test/models/network/test_express_route_circuit_authorizations.rb +14 -1
- data/test/models/network/test_express_route_circuits.rb +14 -1
- data/test/models/network/test_load_balancers.rb +14 -1
- data/test/models/network/test_local_network_gateways.rb +14 -1
- data/test/models/network/test_network_interfaces.rb +14 -1
- data/test/models/network/test_network_security_groups.rb +14 -1
- data/test/models/network/test_network_security_rules.rb +14 -1
- data/test/models/network/test_public_ips.rb +6 -6
- data/test/models/network/test_subnets.rb +14 -1
- data/test/models/network/test_virtual_network_gateway_connections.rb +14 -1
- data/test/models/network/test_virtual_network_gateways.rb +14 -1
- data/test/models/network/test_virtual_networks.rb +20 -8
- data/test/models/resources/test_deployments.rb +14 -1
- data/test/models/resources/test_resource_groups.rb +14 -1
- data/test/models/resources/test_resources.rb +16 -3
- data/test/models/sql/test_database.rb +3 -4
- data/test/models/sql/test_databases.rb +5 -5
- data/test/models/sql/test_firewall_rule.rb +2 -1
- data/test/models/sql/test_firewall_rules.rb +3 -2
- data/test/models/sql/test_sql_server.rb +2 -1
- data/test/models/sql/test_sql_servers.rb +5 -5
- data/test/models/storage/test_directories.rb +14 -1
- data/test/models/storage/test_storage_accounts.rb +14 -1
- data/test/models/traffic_manager/test_traffic_manager_end_points.rb +14 -1
- data/test/models/traffic_manager/test_traffic_manager_profiles.rb +14 -1
- data/test/requests/application_gateway/test_check_ag_exists.rb +31 -0
- data/test/requests/compute/test_check_availability_set_exists.rb +31 -0
- data/test/requests/compute/test_check_vm_exists.rb +31 -0
- data/test/requests/compute/test_check_vm_extension_exists.rb +31 -0
- data/test/requests/dns/test_check_record_set_exists.rb +31 -0
- data/test/requests/dns/test_check_zone_exists.rb +35 -0
- data/test/requests/dns/test_list_record_sets.rb +35 -0
- data/test/requests/dns/{test_check_for_zone.rb → test_list_zones.rb} +10 -8
- data/test/requests/key_vault/test_check_vault_exists.rb +31 -0
- data/test/requests/key_vault/test_create_or_update_vault.rb +25 -0
- data/test/requests/key_vault/test_delete_vault.rb +23 -0
- data/test/requests/key_vault/test_get_vault.rb +24 -0
- data/test/requests/key_vault/test_list_vaults.rb +24 -0
- data/test/requests/network/test_check_express_route_cir_auth_exists.rb +31 -0
- data/test/requests/network/test_check_express_route_circuit_exists.rb +31 -0
- data/test/requests/network/test_check_load_balancer_exists.rb +31 -0
- data/test/requests/network/test_check_local_net_gateway_exists.rb +31 -0
- data/test/requests/network/test_check_net_sec_group_exists.rb +31 -0
- data/test/requests/network/test_check_net_sec_rule_exists.rb +31 -0
- data/test/requests/network/test_check_network_interface_exists.rb +31 -0
- data/test/requests/network/{test_check_for_public_ip.rb → test_check_public_ip_exists.rb} +8 -8
- data/test/requests/network/test_check_subnet_exists.rb +31 -0
- data/test/requests/network/{test_check_for_virtual_network.rb → test_check_virtual_network_exists.rb} +8 -8
- data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +31 -0
- data/test/requests/network/test_check_vnet_gateway_exists.rb +31 -0
- data/test/requests/network/test_list_virtual_networks_in_subscription.rb +24 -0
- data/test/requests/resources/test_check_azure_resource_exists.rb +22 -0
- data/test/requests/resources/test_check_deployment_exists.rb +29 -0
- data/test/requests/resources/test_check_resource_group_exists.rb +29 -0
- data/test/requests/sql/test_create_or_update_database.rb +9 -12
- data/test/requests/sql/test_create_or_update_firewall_rule.rb +9 -11
- data/test/requests/sql/test_create_or_update_sql_server.rb +9 -12
- data/test/requests/sql/test_delete_database.rb +6 -17
- data/test/requests/sql/test_delete_firewall_rule.rb +6 -17
- data/test/requests/sql/test_delete_sql_server.rb +6 -17
- data/test/requests/sql/test_get_database.rb +7 -18
- data/test/requests/sql/test_get_firewall_rule.rb +7 -18
- data/test/requests/sql/test_get_sql_server.rb +7 -18
- data/test/requests/sql/test_list_databases.rb +7 -18
- data/test/requests/sql/test_list_firewall_rules.rb +7 -18
- data/test/requests/sql/test_list_sql_servers.rb +7 -18
- data/test/requests/storage/test_check_container_exists.rb +18 -0
- data/test/requests/storage/test_check_storage_account_exists.rb +32 -0
- data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +31 -0
- data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +31 -0
- data/test/test_helper.rb +39 -4
- metadata +125 -10
@@ -17,6 +17,10 @@ module Fog
|
|
17
17
|
local_network_gateway_fog = Fog::Network::AzureRM::LocalNetworkGateway.new(service: service)
|
18
18
|
local_network_gateway_fog.merge_attributes(Fog::Network::AzureRM::LocalNetworkGateway.parse(local_network_gateway))
|
19
19
|
end
|
20
|
+
|
21
|
+
def check_local_net_gateway_exists(resource_group_name, name)
|
22
|
+
service.check_local_net_gateway_exists(resource_group_name, name)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -20,6 +20,10 @@ module Fog
|
|
20
20
|
network_interface_card_fog = Fog::Network::AzureRM::NetworkInterface.new(service: service)
|
21
21
|
network_interface_card_fog.merge_attributes(Fog::Network::AzureRM::NetworkInterface.parse(network_interface_card))
|
22
22
|
end
|
23
|
+
|
24
|
+
def check_network_interface_exists(resource_group_name, name)
|
25
|
+
service.check_network_interface_exists(resource_group_name, name)
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -20,6 +20,10 @@ module Fog
|
|
20
20
|
network_security_group_fog = Fog::Network::AzureRM::NetworkSecurityGroup.new(service: service)
|
21
21
|
network_security_group_fog.merge_attributes(Fog::Network::AzureRM::NetworkSecurityGroup.parse(network_security_group))
|
22
22
|
end
|
23
|
+
|
24
|
+
def check_net_sec_group_exists(resource_group, name)
|
25
|
+
service.check_net_sec_group_exists(resource_group, name)
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -21,6 +21,10 @@ module Fog
|
|
21
21
|
network_security_rule_fog = Fog::Network::AzureRM::NetworkSecurityRule.new(service: service)
|
22
22
|
network_security_rule_fog.merge_attributes(Fog::Network::AzureRM::NetworkSecurityRule.parse(network_security_rule))
|
23
23
|
end
|
24
|
+
|
25
|
+
def check_net_sec_rule_exists(resource_group, network_security_group_name, name)
|
26
|
+
service.check_net_sec_rule_exists(resource_group, network_security_group_name, name)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
@@ -21,15 +21,8 @@ module Fog
|
|
21
21
|
public_ip_fog.merge_attributes(Fog::Network::AzureRM::PublicIp.parse(public_ip))
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
|
26
|
-
if service.check_for_public_ip(resource_group, name)
|
27
|
-
Fog::Logger.debug "PublicIP #{name} exists."
|
28
|
-
true
|
29
|
-
else
|
30
|
-
Fog::Logger.debug "PublicIP #{name} doesn't exists."
|
31
|
-
false
|
32
|
-
end
|
24
|
+
def check_public_ip_exists(resource_group, name)
|
25
|
+
service.check_public_ip_exists(resource_group, name)
|
33
26
|
end
|
34
27
|
end
|
35
28
|
end
|
@@ -21,6 +21,10 @@ module Fog
|
|
21
21
|
subnet_fog = Fog::Network::AzureRM::Subnet.new(service: service)
|
22
22
|
subnet_fog.merge_attributes(Fog::Network::AzureRM::Subnet.parse(subnet))
|
23
23
|
end
|
24
|
+
|
25
|
+
def check_subnet_exists(resource_group, virtual_network_name, subnet_name)
|
26
|
+
service.check_subnet_exists(resource_group, virtual_network_name, subnet_name)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
@@ -17,6 +17,10 @@ module Fog
|
|
17
17
|
gateway_connection = Fog::Network::AzureRM::VirtualNetworkGatewayConnection.new(service: service)
|
18
18
|
gateway_connection.merge_attributes(Fog::Network::AzureRM::VirtualNetworkGatewayConnection.parse(connection))
|
19
19
|
end
|
20
|
+
|
21
|
+
def check_vnet_gateway_connection_exists(resource_group_name, name)
|
22
|
+
service.check_vnet_gateway_connection_exists(resource_group_name, name)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -20,6 +20,10 @@ module Fog
|
|
20
20
|
virtual_network_gateway = Fog::Network::AzureRM::VirtualNetworkGateway.new(service: service)
|
21
21
|
virtual_network_gateway.merge_attributes(Fog::Network::AzureRM::VirtualNetworkGateway.parse(network_gateway))
|
22
22
|
end
|
23
|
+
|
24
|
+
def check_vnet_gateway_exists(resource_group_name, name)
|
25
|
+
service.check_vnet_gateway_exists(resource_group_name, name)
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -8,9 +8,14 @@ module Fog
|
|
8
8
|
attribute :resource_group
|
9
9
|
|
10
10
|
def all
|
11
|
-
requires :resource_group
|
12
11
|
virtual_networks = []
|
13
|
-
|
12
|
+
if !resource_group.nil?
|
13
|
+
requires :resource_group
|
14
|
+
vnets = service.list_virtual_networks(resource_group)
|
15
|
+
else
|
16
|
+
vnets = service.list_virtual_networks_in_subscription
|
17
|
+
end
|
18
|
+
vnets.each do |vnet|
|
14
19
|
virtual_networks << Fog::Network::AzureRM::VirtualNetwork.parse(vnet)
|
15
20
|
end
|
16
21
|
load(virtual_networks)
|
@@ -22,15 +27,8 @@ module Fog
|
|
22
27
|
virtual_network_fog.merge_attributes(Fog::Network::AzureRM::VirtualNetwork.parse(virtual_network))
|
23
28
|
end
|
24
29
|
|
25
|
-
def
|
26
|
-
|
27
|
-
if service.check_for_virtual_network(name, resource_group)
|
28
|
-
Fog::Logger.debug "Virtual Network #{name} exists."
|
29
|
-
true
|
30
|
-
else
|
31
|
-
Fog::Logger.debug "Virtual Network #{name} doesn't exists."
|
32
|
-
false
|
33
|
-
end
|
30
|
+
def check_virtual_network_exists(resource_group, name)
|
31
|
+
service.check_virtual_network_exists(resource_group, name)
|
34
32
|
end
|
35
33
|
end
|
36
34
|
end
|
@@ -20,6 +20,10 @@ module Fog
|
|
20
20
|
deployment_fog = Fog::Resources::AzureRM::Deployment.new(service: service)
|
21
21
|
deployment_fog.merge_attributes(Fog::Resources::AzureRM::Deployment.parse(deployment))
|
22
22
|
end
|
23
|
+
|
24
|
+
def check_deployment_exists(resource_group_name, deployment_name)
|
25
|
+
service.check_deployment_exists(resource_group_name, deployment_name)
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -19,6 +19,10 @@ module Fog
|
|
19
19
|
resource_group_fog = Fog::Resources::AzureRM::ResourceGroup.new(service: service)
|
20
20
|
resource_group_fog.merge_attributes(Fog::Resources::AzureRM::ResourceGroup.parse(resource_group))
|
21
21
|
end
|
22
|
+
|
23
|
+
def check_resource_group_exists(resource_group_name)
|
24
|
+
service.check_resource_group_exists(resource_group_name)
|
25
|
+
end
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
@@ -13,24 +13,12 @@ module Fog
|
|
13
13
|
attribute :server_name
|
14
14
|
|
15
15
|
def self.parse(firewall)
|
16
|
-
|
17
|
-
if firewall.is_a? Hash
|
18
|
-
firewall.each do |k, v|
|
19
|
-
if k == 'properties'
|
20
|
-
v.each do |j, l|
|
21
|
-
data[j] = l
|
22
|
-
end
|
23
|
-
else
|
24
|
-
data[k] = v
|
25
|
-
end
|
26
|
-
end
|
27
|
-
data['resource_group'] = get_resource_group_from_id(firewall['id'])
|
28
|
-
data['server_name'] = get_resource_from_resource_id(firewall['id'], 8)
|
29
|
-
else
|
30
|
-
raise 'Object is not a hash. Parsing SQL Server firewall object failed.'
|
31
|
-
end
|
16
|
+
firewall_hash = get_hash_from_object(firewall)
|
32
17
|
|
33
|
-
|
18
|
+
firewall_hash['resource_group'] = get_resource_group_from_id(firewall.id)
|
19
|
+
firewall_hash['server_name'] = get_resource_from_resource_id(firewall.id, 8)
|
20
|
+
|
21
|
+
firewall_hash
|
34
22
|
end
|
35
23
|
|
36
24
|
def save
|
@@ -22,6 +22,10 @@ module Fog
|
|
22
22
|
firewall_rule_fog = Fog::Sql::AzureRM::FirewallRule.new(service: service)
|
23
23
|
firewall_rule_fog.merge_attributes(Fog::Sql::AzureRM::FirewallRule.parse(firewall_rule))
|
24
24
|
end
|
25
|
+
|
26
|
+
def check_firewall_rule_exists(resource_group, server_name, rule_name)
|
27
|
+
service.check_firewall_rule_exists(resource_group, server_name, rule_name)
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
@@ -21,31 +21,16 @@ module Fog
|
|
21
21
|
attribute :max_size_bytes, aliases: %w(maxSizeBytes)
|
22
22
|
attribute :requested_service_objective_id, aliases: %w(requestedServiceObjectiveId)
|
23
23
|
attribute :requested_service_objective_name, aliases: %w(requestedServiceObjectiveName)
|
24
|
-
attribute :restore_point_in_time, aliases: %w(restorePointInTime)
|
25
24
|
attribute :service_level_objective, aliases: %w(serviceLevelObjective)
|
26
25
|
attribute :source_database_id, aliases: %w(sourceDatabaseId)
|
27
|
-
attribute :source_database_deletion_date, aliases: %w(sourceDatabaseDeletionDate)
|
28
26
|
|
29
27
|
def self.parse(database)
|
30
|
-
|
31
|
-
data['resource_group'] = get_resource_group_from_id(database['id'])
|
32
|
-
data['server_name'] = get_resource_from_resource_id(database['id'], 8)
|
28
|
+
database_hash = get_hash_from_object(database)
|
33
29
|
|
34
|
-
|
35
|
-
|
36
|
-
if k == 'properties'
|
37
|
-
v.each do |j, l|
|
38
|
-
data[j] = l
|
39
|
-
end
|
40
|
-
else
|
41
|
-
data[k] = v
|
42
|
-
end
|
43
|
-
end
|
44
|
-
else
|
45
|
-
raise 'Object is not a hash. Parsing SQL Database object failed.'
|
46
|
-
end
|
30
|
+
database_hash['resource_group'] = get_resource_group_from_id(database.id)
|
31
|
+
database_hash['server_name'] = get_resource_from_resource_id(database.id, 8)
|
47
32
|
|
48
|
-
|
33
|
+
database_hash
|
49
34
|
end
|
50
35
|
|
51
36
|
def save
|
@@ -72,8 +57,6 @@ module Fog
|
|
72
57
|
collation: collation,
|
73
58
|
max_size_bytes: max_size_bytes,
|
74
59
|
requested_service_objective_name: requested_service_objective_name,
|
75
|
-
restore_point_in_time: restore_point_in_time,
|
76
|
-
source_database_deletion_date: source_database_deletion_date,
|
77
60
|
elastic_pool_name: elastic_pool_name,
|
78
61
|
requested_service_objective_id: requested_service_objective_id
|
79
62
|
}
|
@@ -22,6 +22,10 @@ module Fog
|
|
22
22
|
database_fog = Fog::Sql::AzureRM::SqlDatabase.new(service: service)
|
23
23
|
database_fog.merge_attributes(Fog::Sql::AzureRM::SqlDatabase.parse(database))
|
24
24
|
end
|
25
|
+
|
26
|
+
def check_database_exists(resource_group, server_name, name)
|
27
|
+
service.check_database_exists(resource_group, server_name, name)
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
@@ -10,28 +10,15 @@ module Fog
|
|
10
10
|
attribute :location
|
11
11
|
attribute :version
|
12
12
|
attribute :state
|
13
|
-
attribute :administrator_login
|
14
|
-
attribute :administrator_login_password
|
13
|
+
attribute :administrator_login
|
14
|
+
attribute :administrator_login_password
|
15
15
|
attribute :fully_qualified_domain_name, aliases: %w(fullyQualifiedDomainName)
|
16
16
|
|
17
17
|
def self.parse(server)
|
18
|
-
|
19
|
-
|
20
|
-
if server.is_a? Hash
|
21
|
-
server.each do |k, v|
|
22
|
-
if k == 'properties'
|
23
|
-
v.each do |j, l|
|
24
|
-
data[j] = l
|
25
|
-
end
|
26
|
-
else
|
27
|
-
data[k] = v
|
28
|
-
end
|
29
|
-
end
|
30
|
-
else
|
31
|
-
raise 'Object is not a hash. Parsing SQL Server object failed.'
|
32
|
-
end
|
18
|
+
sql_server_hash = get_hash_from_object(server)
|
19
|
+
sql_server_hash['resource_group'] = get_resource_group_from_id(server.id)
|
33
20
|
|
34
|
-
|
21
|
+
sql_server_hash
|
35
22
|
end
|
36
23
|
|
37
24
|
def save
|
@@ -21,6 +21,10 @@ module Fog
|
|
21
21
|
server_fog = Fog::Sql::AzureRM::SqlServer.new(service: service)
|
22
22
|
server_fog.merge_attributes(Fog::Sql::AzureRM::SqlServer.parse(server))
|
23
23
|
end
|
24
|
+
|
25
|
+
def check_sql_server_exists(resource_group, server_name)
|
26
|
+
service.check_sql_server_exists(resource_group, server_name)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
@@ -33,6 +33,10 @@ module Fog
|
|
33
33
|
params.type = 'Microsoft.Storage/storageAccounts'
|
34
34
|
service.check_storage_account_name_availability(params)
|
35
35
|
end
|
36
|
+
|
37
|
+
def check_storage_account_exists(resource_group_name, storage_account_name)
|
38
|
+
service.check_storage_account_exists(resource_group_name, storage_account_name)
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
@@ -20,6 +20,10 @@ module Fog
|
|
20
20
|
endpoint_fog = Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.new(service: service)
|
21
21
|
endpoint_fog.merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.parse(endpoint))
|
22
22
|
end
|
23
|
+
|
24
|
+
def check_traffic_manager_endpoint_exists(resource_group, traffic_manager_profile_name, end_point_name, type)
|
25
|
+
service.check_traffic_manager_endpoint_exists(resource_group, traffic_manager_profile_name, end_point_name, type)
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -17,6 +17,10 @@ module Fog
|
|
17
17
|
profile_fog = Fog::TrafficManager::AzureRM::TrafficManagerProfile.new(service: service)
|
18
18
|
profile_fog.merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerProfile.parse(profile))
|
19
19
|
end
|
20
|
+
|
21
|
+
def check_traffic_manager_profile_exists(resource_group, traffic_manager_profile_name)
|
22
|
+
service.check_traffic_manager_profile_exists(resource_group, traffic_manager_profile_name)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
data/lib/fog/azurerm/network.rb
CHANGED
@@ -6,6 +6,7 @@ module Fog
|
|
6
6
|
requires :client_id
|
7
7
|
requires :client_secret
|
8
8
|
requires :subscription_id
|
9
|
+
recognizes :environment
|
9
10
|
|
10
11
|
request_path 'fog/azurerm/requests/network'
|
11
12
|
request :create_or_update_virtual_network
|
@@ -18,12 +19,13 @@ module Fog
|
|
18
19
|
request :add_subnets_in_virtual_network
|
19
20
|
request :delete_virtual_network
|
20
21
|
request :list_virtual_networks
|
21
|
-
request :
|
22
|
+
request :list_virtual_networks_in_subscription
|
23
|
+
request :check_virtual_network_exists
|
22
24
|
request :create_or_update_public_ip
|
23
25
|
request :delete_public_ip
|
24
26
|
request :get_public_ip
|
25
27
|
request :list_public_ips
|
26
|
-
request :
|
28
|
+
request :check_public_ip_exists
|
27
29
|
request :create_subnet
|
28
30
|
request :attach_network_security_group_to_subnet
|
29
31
|
request :detach_network_security_group_from_subnet
|
@@ -33,30 +35,37 @@ module Fog
|
|
33
35
|
request :get_subnet
|
34
36
|
request :get_available_ipaddresses_count
|
35
37
|
request :delete_subnet
|
38
|
+
request :check_subnet_exists
|
36
39
|
request :create_or_update_network_interface
|
37
40
|
request :delete_network_interface
|
38
41
|
request :list_network_interfaces
|
39
42
|
request :get_network_interface
|
43
|
+
request :check_network_interface_exists
|
40
44
|
request :attach_resource_to_nic
|
41
45
|
request :detach_resource_from_nic
|
42
46
|
request :create_load_balancer
|
43
47
|
request :delete_load_balancer
|
44
48
|
request :list_load_balancers
|
45
49
|
request :get_load_balancer
|
50
|
+
request :check_load_balancer_exists
|
51
|
+
request :list_load_balancers_in_subscription
|
46
52
|
request :create_or_update_network_security_group
|
47
53
|
request :delete_network_security_group
|
48
54
|
request :list_network_security_groups
|
49
55
|
request :get_network_security_group
|
56
|
+
request :check_net_sec_group_exists
|
50
57
|
request :add_security_rules
|
51
58
|
request :remove_security_rule
|
52
59
|
request :delete_virtual_network_gateway
|
53
60
|
request :create_or_update_virtual_network_gateway
|
54
61
|
request :list_virtual_network_gateways
|
55
62
|
request :get_virtual_network_gateway
|
63
|
+
request :check_vnet_gateway_exists
|
56
64
|
request :create_or_update_express_route_circuit
|
57
65
|
request :delete_express_route_circuit
|
58
66
|
request :get_express_route_circuit
|
59
67
|
request :list_express_route_circuits
|
68
|
+
request :check_express_route_circuit_exists
|
60
69
|
request :create_or_update_express_route_circuit_peering
|
61
70
|
request :delete_express_route_circuit_peering
|
62
71
|
request :get_express_route_circuit_peering
|
@@ -65,15 +74,18 @@ module Fog
|
|
65
74
|
request :delete_express_route_circuit_authorization
|
66
75
|
request :get_express_route_circuit_authorization
|
67
76
|
request :list_express_route_circuit_authorizations
|
77
|
+
request :check_express_route_cir_auth_exists
|
68
78
|
request :list_express_route_service_providers
|
69
79
|
request :create_or_update_local_network_gateway
|
70
80
|
request :delete_local_network_gateway
|
71
81
|
request :get_local_network_gateway
|
72
82
|
request :list_local_network_gateways
|
83
|
+
request :check_local_net_gateway_exists
|
73
84
|
request :create_or_update_virtual_network_gateway_connection
|
74
85
|
request :delete_virtual_network_gateway_connection
|
75
86
|
request :get_virtual_network_gateway_connection
|
76
87
|
request :list_virtual_network_gateway_connections
|
88
|
+
request :check_vnet_gateway_connection_exists
|
77
89
|
request :get_connection_shared_key
|
78
90
|
request :reset_connection_shared_key
|
79
91
|
request :set_connection_shared_key
|
@@ -81,6 +93,7 @@ module Fog
|
|
81
93
|
request :delete_network_security_rule
|
82
94
|
request :get_network_security_rule
|
83
95
|
request :list_network_security_rules
|
96
|
+
request :check_net_sec_rule_exists
|
84
97
|
|
85
98
|
model_path 'fog/azurerm/models/network'
|
86
99
|
model :virtual_network
|
@@ -144,13 +157,18 @@ module Fog
|
|
144
157
|
raise e.message
|
145
158
|
end
|
146
159
|
|
147
|
-
|
148
|
-
|
160
|
+
options[:environment] = 'AzureCloud' if options[:environment].nil?
|
161
|
+
|
162
|
+
credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret], options[:environment])
|
163
|
+
telemetry = "fog-azure-rm/#{Fog::AzureRM::VERSION}"
|
164
|
+
@network_client = ::Azure::ARM::Network::NetworkManagementClient.new(credentials, resource_manager_endpoint_url(options[:environment]))
|
149
165
|
@network_client.subscription_id = options[:subscription_id]
|
166
|
+
@network_client.add_user_agent_information(telemetry)
|
150
167
|
@tenant_id = options[:tenant_id]
|
151
168
|
@client_id = options[:client_id]
|
152
169
|
@client_secret = options[:client_secret]
|
153
170
|
@subscription_id = options[:subscription_id]
|
171
|
+
@environment = options[:environment]
|
154
172
|
current_directory = File.dirname(__FILE__)
|
155
173
|
@logger_messages = YAML.load_file("#{current_directory}/utilities/logger_messages.yml")
|
156
174
|
end
|