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
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Check Availability Set Exists Request
|
4
|
+
class TestCheckAvailabilitySetExists < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::Compute::AzureRM.new(credentials)
|
7
|
+
@client = @service.instance_variable_get(:@compute_mgmt_client)
|
8
|
+
@availability_sets = @client.availability_sets
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_check_availability_set_exists_success
|
12
|
+
mocked_response = ApiStub::Requests::Compute::AvailabilitySet.get_availability_set_response(@client)
|
13
|
+
@availability_sets.stub :get, mocked_response do
|
14
|
+
assert @service.check_availability_set_exists('myrg1', 'myavset1')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_availability_set_exists_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@availability_sets.stub :get, response do
|
21
|
+
assert !@service.check_availability_set_exists('myrg1', 'myavset1')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_availability_set_exists_exception
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
27
|
+
@availability_sets.stub :get, response do
|
28
|
+
assert_raises(RuntimeError) { @service.check_availability_set_exists('myrg1', 'myavset1') }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Check Virtual Machine Exists Request
|
4
|
+
class TestCheckVirtualMachineExists < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::Compute::AzureRM.new(credentials)
|
7
|
+
@compute_client = @service.instance_variable_get(:@compute_mgmt_client)
|
8
|
+
@virtual_machines = @compute_client.virtual_machines
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_check_vm_exists_success
|
12
|
+
response = ApiStub::Requests::Compute::VirtualMachine.create_virtual_machine_response(@compute_client)
|
13
|
+
@virtual_machines.stub :get, response do
|
14
|
+
assert @service.check_vm_exists('fog-test-rg', 'fog-test-server')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_vm_exists_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@virtual_machines.stub :get, response do
|
21
|
+
assert !@service.check_vm_exists('fog-test-rg', 'fog-test-server')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_vm_exists_exception
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
27
|
+
@virtual_machines.stub :get, response do
|
28
|
+
assert_raises(RuntimeError) { @service.check_vm_exists('fog-test-rg', 'fog-test-server') }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Check VM Extension Exists request
|
4
|
+
class TestCheckVMExtensionExists < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::Compute::AzureRM.new(credentials)
|
7
|
+
@compute_client = @service.instance_variable_get(:@compute_mgmt_client)
|
8
|
+
@vm_extension = @compute_client.virtual_machine_extensions
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_check_vm_extension_exists_success
|
12
|
+
response = ApiStub::Requests::Compute::VirtualMachineExtension.create_vm_extension_response(@compute_client)
|
13
|
+
@vm_extension.stub :get, response do
|
14
|
+
assert @service.check_vm_extension_exists('fog-test-rg', 'fog-test-vm', 'fog-test-extension')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_vm_extension_exists_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@vm_extension.stub :get, response do
|
21
|
+
assert !@service.check_vm_extension_exists('fog-test-rg', 'fog-test-vm', 'fog-test-extension')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_vm_extension_exists_exception
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
27
|
+
@vm_extension.stub :get, response do
|
28
|
+
assert_raises(RuntimeError) { @service.check_vm_extension_exists('fog-test-rg', 'fog-test-vm', 'fog-test-extension') }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Check Record Set Exists
|
4
|
+
class TestCheckRecordSetExists < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::DNS::AzureRM.new(credentials)
|
7
|
+
@dns_client = @service.instance_variable_get(:@dns_client)
|
8
|
+
@record_sets = @dns_client.record_sets
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_check_record_set_exists_success
|
12
|
+
mocked_response = ApiStub::Requests::DNS::RecordSet.record_set_response_for_cname_type(@dns_client)
|
13
|
+
@record_sets.stub :get, mocked_response do
|
14
|
+
assert @service.check_record_set_exists('fog-test-rg', 'fog-test-result', 'fog-test-zone', 'CNAME')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_record_set_exists_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'code' => 'NotFound' ) }
|
20
|
+
@record_sets.stub :get, response do
|
21
|
+
assert !@service.check_record_set_exists('fog-test-rg', 'fog-test-result', 'fog-test-zone', 'CNAME')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_record_set_exists_exception
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
27
|
+
@record_sets.stub :get, response do
|
28
|
+
assert_raises(RuntimeError) { @service.check_record_set_exists('fog-test-rg', 'fog-test-result', 'fog-test-zone', 'CNAME') }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Check Zone Exists
|
4
|
+
class TestCheckZoneExists < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::DNS::AzureRM.new(credentials)
|
7
|
+
@dns_client = @service.instance_variable_get(:@dns_client)
|
8
|
+
@zones = @dns_client.zones
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_check_zone_exists_success
|
12
|
+
mocked_response = ApiStub::Requests::DNS::Zone.zone_response(@dns_client)
|
13
|
+
@zones.stub :get, mocked_response do
|
14
|
+
assert_equal @service.check_zone_exists('fog-test-rg', 'zone_name'), true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_zone_exists_failure
|
19
|
+
response = ApiStub::Requests::DNS::RecordSet.list_record_sets_response(@dns_client)
|
20
|
+
@zones.stub :get, response do
|
21
|
+
assert_raises ArgumentError do
|
22
|
+
@service.check_zone_exists('fog-test-rg')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_check_zone_exists_exception
|
28
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
29
|
+
@zones.stub :get, response do
|
30
|
+
assert_raises RuntimeError do
|
31
|
+
@service.check_zone_exists('fog-test-rg', 'zone_name')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for List Record Sets Request
|
4
|
+
class TestListRecordSets < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::DNS::AzureRM.new(credentials)
|
7
|
+
@dns_client = @service.instance_variable_get(:@dns_client)
|
8
|
+
@record_sets = @dns_client.record_sets
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_list_record_sets_success
|
12
|
+
mocked_response = [ApiStub::Requests::DNS::RecordSet.list_record_sets_response(@dns_client)]
|
13
|
+
@record_sets.stub :list_by_dns_zone, mocked_response do
|
14
|
+
assert_equal @service.list_record_sets('fog-test-rg', 'fog-test-zone'), mocked_response
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_list_record_sets_failure
|
19
|
+
response = ApiStub::Requests::DNS::RecordSet.list_record_sets_response(@dns_client)
|
20
|
+
@record_sets.stub :list_by_dns_zone, response do
|
21
|
+
assert_raises ArgumentError do
|
22
|
+
@service.list_record_sets('fog-test-rg')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_list_record_sets_exception
|
28
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
29
|
+
@record_sets.stub :list_by_dns_zone, response do
|
30
|
+
assert_raises RuntimeError do
|
31
|
+
@service.list_record_sets('fog-test-rg', 'fog-test-zone')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,24 +1,26 @@
|
|
1
1
|
require File.expand_path '../../test_helper', __dir__
|
2
2
|
|
3
|
-
# Test class for
|
4
|
-
class
|
3
|
+
# Test class for List Zones Request
|
4
|
+
class TestListZones < Minitest::Test
|
5
5
|
def setup
|
6
6
|
@service = Fog::DNS::AzureRM.new(credentials)
|
7
7
|
@dns_client = @service.instance_variable_get(:@dns_client)
|
8
8
|
@zones = @dns_client.zones
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def test_list_zones_success
|
12
12
|
mocked_response = ApiStub::Requests::DNS::Zone.zone_response(@dns_client)
|
13
|
-
@zones.stub :
|
14
|
-
assert_equal @service.
|
13
|
+
@zones.stub :list, mocked_response do
|
14
|
+
assert_equal @service.list_zones, mocked_response
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def test_list_zones_exception
|
19
19
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
|
-
@zones.stub :
|
21
|
-
assert_raises
|
20
|
+
@zones.stub :list, response do
|
21
|
+
assert_raises RuntimeError do
|
22
|
+
@service.list_zones
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Check Vault Exists Request
|
4
|
+
class TestCheckVaultExists < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::KeyVault::AzureRM.new(credentials)
|
7
|
+
@key_vault_client = @service.instance_variable_get(:@key_vault_client)
|
8
|
+
@vaults = @key_vault_client.vaults
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_check_vault_exists_success
|
12
|
+
response = ApiStub::Requests::KeyVault::Vault.create_vault_response(@key_vault_client)
|
13
|
+
@vaults.stub :get, response do
|
14
|
+
assert @service.check_vault_exists('fog-test-rg', 'fog-test-kv')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_vault_exists_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@vaults.stub :get, response do
|
21
|
+
assert !@service.check_vault_exists('fog-test-rg', 'fog-test-kv')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_vault_exists_exception
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
27
|
+
@vaults.stub :get, response do
|
28
|
+
assert_raises(RuntimeError) { @service.check_vault_exists('fog-test-rg', 'fog-test-kv') }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Create Vault Request
|
4
|
+
class TestCreateOrUpdateVault < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::KeyVault::AzureRM.new(credentials)
|
7
|
+
key_vault_client = @service.instance_variable_get(:@key_vault_client)
|
8
|
+
@vaults = key_vault_client.vaults
|
9
|
+
@response = ApiStub::Requests::KeyVault::Vault.create_vault_response(key_vault_client)
|
10
|
+
@vault_params = ApiStub::Requests::KeyVault::Vault.vault_params
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_create_or_update_vault_success
|
14
|
+
@vaults.stub :create_or_update, @response do
|
15
|
+
assert_equal @service.create_or_update_vault(@vault_params), @response
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_create_vault_failure
|
20
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
21
|
+
@vaults.stub :create_or_update, response do
|
22
|
+
assert_raises(RuntimeError) { @service.create_or_update_vault(name: 'fog-test-kv') }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Delete Vault Request
|
4
|
+
class TestDeleteVault < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::KeyVault::AzureRM.new(credentials)
|
7
|
+
key_vault_client = @service.instance_variable_get(:@key_vault_client)
|
8
|
+
@vaults = key_vault_client.vaults
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_delete_vault_success
|
12
|
+
@vaults.stub :delete, true do
|
13
|
+
assert @service.delete_vault('fog-test-rg', 'fog-test-kv'), true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_delete_vault_failure
|
18
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
|
+
@vaults.stub :delete, response do
|
20
|
+
assert_raises(RuntimeError) { @service.delete_vault('fog-test-rg', 'fog-test-kv') }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Get Vault Request
|
4
|
+
class TestGetVault < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::KeyVault::AzureRM.new(credentials)
|
7
|
+
@key_vault_client = @service.instance_variable_get(:@key_vault_client)
|
8
|
+
@vaults = @key_vault_client.vaults
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_get_vault_success
|
12
|
+
response = ApiStub::Requests::KeyVault::Vault.create_vault_response(@key_vault_client)
|
13
|
+
@vaults.stub :get, response do
|
14
|
+
assert_equal @service.get_vault('fog-test-rg', 'fog-test-kv'), response
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_get_vault_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
|
+
@vaults.stub :get, response do
|
21
|
+
assert_raises(RuntimeError) { @service.get_vault('fog-test-rg', 'fog-test-kv') }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for List Vault Request
|
4
|
+
class TestListVaults < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::KeyVault::AzureRM.new(credentials)
|
7
|
+
@key_vault_client = @service.instance_variable_get(:@key_vault_client)
|
8
|
+
@vaults = @key_vault_client.vaults
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_list_vaults_success
|
12
|
+
mocked_response = ApiStub::Requests::KeyVault::Vault.list_vault_response(@key_vault_client)
|
13
|
+
@vaults.stub :list_by_resource_group_as_lazy, mocked_response do
|
14
|
+
assert_equal @service.list_vaults('fog-test-rg'), mocked_response.value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_list_vaults_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
|
+
@vaults.stub :list_by_resource_group_as_lazy, response do
|
21
|
+
assert_raises(RuntimeError) { @service.list_vaults('fog-test-rg') }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Check Express Route Circuit Authorization Exists Request
|
4
|
+
class TestCheckExpressRouteCirAuthExists < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::Network::AzureRM.new(credentials)
|
7
|
+
@network_client = @service.instance_variable_get(:@network_client)
|
8
|
+
@circuit_authorization = @network_client.express_route_circuit_authorizations
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_check_express_route_cir_auth_exists_success
|
12
|
+
mocked_response = ApiStub::Requests::Network::ExpressRouteCircuitAuthorization.create_express_route_circuit_authorization_response(@network_client)
|
13
|
+
@circuit_authorization.stub :get, mocked_response do
|
14
|
+
assert @service.check_express_route_cir_auth_exists('Fog-rg', 'testCircuit', 'auth-name')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_express_route_cir_auth_exists_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@circuit_authorization.stub :get, response do
|
21
|
+
assert !@service.check_express_route_cir_auth_exists('Fog-rg', 'testCircuit', 'auth-name')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_express_route_cir_auth_exists_exception
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
27
|
+
@circuit_authorization.stub :get, response do
|
28
|
+
assert_raises(RuntimeError) { @service.check_express_route_cir_auth_exists('Fog-rg', 'testCircuit', 'auth-name') }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Check Express Route Circuit Exists Request
|
4
|
+
class TestCheckExpressRouteCircuitExists < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::Network::AzureRM.new(credentials)
|
7
|
+
@network_client = @service.instance_variable_get(:@network_client)
|
8
|
+
@circuit = @network_client.express_route_circuits
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_check_express_route_circuit_exists_success
|
12
|
+
mocked_response = ApiStub::Requests::Network::ExpressRouteCircuit.create_express_route_circuit_response(@network_client)
|
13
|
+
@circuit.stub :get, mocked_response do
|
14
|
+
assert @service.check_express_route_circuit_exists('fog-test-rg', 'testCircuit')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_express_route_circuit_exists_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@circuit.stub :get, response do
|
21
|
+
assert !@service.check_express_route_circuit_exists('fog-test-rg', 'testCircuit')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_express_route_circuit_exists_exception
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
27
|
+
@circuit.stub :get, response do
|
28
|
+
assert_raises(RuntimeError) { @service.check_express_route_circuit_exists('fog-test-rg', 'testCircuit') }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Check Load Balancer Exists Request
|
4
|
+
class TestCheckLoadBalancerExists < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::Network::AzureRM.new(credentials)
|
7
|
+
@network_client = @service.instance_variable_get(:@network_client)
|
8
|
+
@load_balancers = @network_client.load_balancers
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_check_load_balancer_exists_success
|
12
|
+
mocked_response = ApiStub::Requests::Network::LoadBalancer.create_load_balancer_response(@network_client)
|
13
|
+
@load_balancers.stub :get, mocked_response do
|
14
|
+
assert @service.check_load_balancer_exists('fog-test-rg', 'mylb1')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_load_balancer_exists_failure
|
19
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
|
20
|
+
@load_balancers.stub :get, response do
|
21
|
+
assert !@service.check_load_balancer_exists('fog-test-rg', 'mylb1')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_check_load_balancer_exists_exception
|
26
|
+
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
|
27
|
+
@load_balancers.stub :get, response do
|
28
|
+
assert_raises(RuntimeError) { @service.check_load_balancer_exists('fog-test-rg', 'mylb1') }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|