fog-azure-rm-temp 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.arclint +8 -0
- data/.travis.yml +28 -14
- data/CHANGELOG.md +77 -0
- data/CONTRIBUTORS.md +4 -0
- data/fog-azure-rm.gemspec +3 -2
- data/lib/fog/azurerm.rb +1 -0
- data/lib/fog/azurerm/async_response.rb +9 -1
- data/lib/fog/azurerm/compute.rb +3 -1
- data/lib/fog/azurerm/constants.rb +11 -3
- data/lib/fog/azurerm/dns.rb +3 -1
- data/lib/fog/azurerm/docs/application_gateway.md +119 -117
- data/lib/fog/azurerm/docs/compute.md +299 -202
- data/lib/fog/azurerm/docs/dns.md +44 -43
- data/lib/fog/azurerm/docs/key_vault.md +31 -28
- data/lib/fog/azurerm/docs/network.md +407 -404
- data/lib/fog/azurerm/docs/resources.md +52 -49
- data/lib/fog/azurerm/docs/sql.md +56 -54
- data/lib/fog/azurerm/docs/storage.md +92 -157
- data/lib/fog/azurerm/docs/traffic_manager.md +55 -53
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +5 -1
- data/lib/fog/azurerm/models/compute/availability_set.rb +4 -1
- data/lib/fog/azurerm/models/compute/managed_disk.rb +0 -1
- data/lib/fog/azurerm/models/compute/server.rb +61 -11
- data/lib/fog/azurerm/models/compute/servers.rb +2 -2
- data/lib/fog/azurerm/models/dns/a_record.rb +15 -0
- data/lib/fog/azurerm/models/dns/cname_record.rb +15 -0
- data/lib/fog/azurerm/models/dns/record_set.rb +20 -8
- data/lib/fog/azurerm/models/key_vault/vault.rb +3 -1
- data/lib/fog/azurerm/models/network/load_balancer.rb +3 -1
- data/lib/fog/azurerm/models/network/local_network_gateway.rb +3 -1
- data/lib/fog/azurerm/models/network/network_interface.rb +3 -1
- data/lib/fog/azurerm/models/network/network_security_group.rb +4 -2
- data/lib/fog/azurerm/models/network/public_ip.rb +4 -2
- data/lib/fog/azurerm/models/network/virtual_network.rb +4 -2
- data/lib/fog/azurerm/models/resources/resource_group.rb +3 -1
- data/lib/fog/azurerm/models/sql/sql_database.rb +3 -3
- data/lib/fog/azurerm/models/sql/sql_server.rb +3 -2
- data/lib/fog/azurerm/models/storage/directories.rb +6 -1
- data/lib/fog/azurerm/models/storage/file.rb +2 -0
- data/lib/fog/azurerm/models/storage/storage_account.rb +4 -1
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +7 -0
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +3 -1
- data/lib/fog/azurerm/requests/application_gateway/check_ag_exists.rb +1 -1
- data/lib/fog/azurerm/requests/application_gateway/create_or_update_application_gateway.rb +1 -0
- data/lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb +2 -2
- data/lib/fog/azurerm/requests/compute/check_availability_set_exists.rb +1 -1
- data/lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb +1 -1
- data/lib/fog/azurerm/requests/compute/check_vm_exists.rb +1 -1
- data/lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb +2 -2
- data/lib/fog/azurerm/requests/compute/create_availability_set.rb +4 -2
- data/lib/fog/azurerm/requests/compute/create_image.rb +68 -0
- data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +302 -135
- data/lib/fog/azurerm/requests/compute/delete_image.rb +29 -0
- data/lib/fog/azurerm/requests/compute/get_image.rb +45 -0
- data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/dns/check_record_set_exists.rb +1 -1
- data/lib/fog/azurerm/requests/dns/check_zone_exists.rb +3 -2
- data/lib/fog/azurerm/requests/dns/create_or_update_record_set.rb +3 -2
- data/lib/fog/azurerm/requests/dns/create_or_update_zone.rb +1 -2
- data/lib/fog/azurerm/requests/key_vault/check_vault_exists.rb +1 -1
- data/lib/fog/azurerm/requests/key_vault/create_or_update_vault.rb +1 -0
- data/lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_load_balancer_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_network_interface_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_public_ip_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_subnet_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_virtual_network_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_load_balancer.rb +4 -4
- data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +1 -2
- data/lib/fog/azurerm/requests/network/create_or_update_network_interface.rb +4 -3
- data/lib/fog/azurerm/requests/network/create_or_update_network_security_group.rb +4 -3
- data/lib/fog/azurerm/requests/network/create_or_update_public_ip.rb +5 -3
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb +4 -3
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +1 -1
- data/lib/fog/azurerm/requests/resources/check_azure_resource_exists.rb +4 -4
- data/lib/fog/azurerm/requests/resources/create_resource_group.rb +2 -1
- data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +4 -4
- data/lib/fog/azurerm/requests/resources/tag_resource.rb +4 -4
- data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +13 -10
- data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +8 -5
- data/lib/fog/azurerm/requests/storage/check_storage_account_exists.rb +1 -1
- data/lib/fog/azurerm/requests/storage/create_storage_account.rb +4 -2
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb +1 -1
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb +1 -1
- data/lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_profile.rb +13 -3
- data/lib/fog/azurerm/storage.rb +0 -18
- data/lib/fog/azurerm/utilities/general.rb +21 -10
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +7 -1
- data/rakefile +1 -1
- data/test/api_stub.rb +19 -2
- data/test/api_stub/models/compute/server.rb +21 -5
- data/test/api_stub/requests/compute/image.rb +41 -0
- data/test/api_stub/requests/compute/virtual_machine.rb +60 -62
- data/test/api_stub/requests/resources/resource_group.rb +1 -1
- data/test/integration/application_gateway.rb +8 -1
- data/test/integration/availability_set.rb +9 -2
- data/test/integration/external_load_balancer.rb +2 -1
- data/test/integration/internal_load_balancer.rb +2 -1
- data/test/integration/key_vault.rb +2 -1
- data/test/integration/managed_disk.rb +10 -5
- data/test/integration/network_interface.rb +2 -1
- data/test/integration/network_security_group.rb +2 -1
- data/test/integration/public_ip.rb +2 -1
- data/test/integration/record_set.rb +5 -5
- data/test/integration/resource_group.rb +5 -2
- data/test/integration/resource_tag.rb +4 -2
- data/test/integration/server.rb +113 -23
- data/test/integration/server_custom_image.rb +120 -20
- data/test/integration/sql_server.rb +10 -2
- data/test/integration/storage_account.rb +32 -20
- data/test/integration/traffic_manager.rb +6 -1
- data/test/integration/virtual_network.rb +2 -1
- data/test/integration/virtual_network_gateway_connection.rb +3 -3
- data/test/models/application_gateway/test_gateway.rb +2 -1
- data/test/models/compute/test_availability_set.rb +2 -1
- data/test/models/compute/test_managed_disk.rb +2 -1
- data/test/models/compute/test_server.rb +13 -4
- data/test/models/dns/test_zone.rb +2 -1
- data/test/models/key_vault/test_vault.rb +2 -1
- data/test/models/network/test_load_balancer.rb +2 -1
- data/test/models/network/test_network_interface.rb +2 -1
- data/test/models/network/test_network_security_group.rb +2 -1
- data/test/models/network/test_public_ip.rb +2 -1
- data/test/models/network/test_virtual_network.rb +2 -1
- data/test/models/resources/test_resource_group.rb +2 -1
- data/test/models/sql/test_database.rb +2 -1
- data/test/models/sql/test_sql_server.rb +2 -1
- data/test/models/storage/test_storage_account.rb +2 -1
- data/test/models/traffic_manager/test_traffic_manager_profile.rb +2 -1
- data/test/requests/application_gateway/test_check_ag_exists.rb +11 -4
- data/test/requests/compute/test_attach_data_disk_to_vm.rb +2 -2
- data/test/requests/compute/test_check_availability_set_exists.rb +9 -2
- data/test/requests/compute/test_check_managed_disk_exists.rb +9 -2
- data/test/requests/compute/test_check_vm_exists.rb +9 -2
- data/test/requests/compute/test_check_vm_extension_exists.rb +9 -2
- data/test/requests/compute/test_create_image.rb +27 -0
- data/test/requests/compute/test_create_virtual_machine.rb +41 -17
- data/test/requests/compute/test_delete_image.rb +23 -0
- data/test/requests/compute/test_get_image.rb +23 -0
- data/test/requests/dns/test_check_record_set_exists.rb +9 -2
- data/test/requests/dns/test_check_zone_exists.rb +16 -2
- data/test/requests/key_vault/test_check_vault_exists.rb +9 -2
- data/test/requests/network/test_check_express_route_cir_auth_exists.rb +9 -2
- data/test/requests/network/test_check_express_route_circuit_exists.rb +9 -2
- data/test/requests/network/test_check_load_balancer_exists.rb +9 -2
- data/test/requests/network/test_check_local_net_gateway_exists.rb +11 -4
- data/test/requests/network/test_check_net_sec_group_exists.rb +9 -2
- data/test/requests/network/test_check_net_sec_rule_exists.rb +9 -2
- data/test/requests/network/test_check_network_interface_exists.rb +9 -2
- data/test/requests/network/test_check_public_ip_exists.rb +9 -2
- data/test/requests/network/test_check_subnet_exists.rb +9 -2
- data/test/requests/network/test_check_virtual_network_exists.rb +10 -4
- data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +9 -2
- data/test/requests/network/test_check_vnet_gateway_exists.rb +9 -2
- data/test/requests/network/test_create_load_balancer.rb +3 -2
- data/test/requests/network/test_create_network_interface.rb +4 -3
- data/test/requests/network/test_create_or_update_network_security_group.rb +3 -2
- data/test/requests/network/test_create_or_update_virtual_network.rb +5 -3
- data/test/requests/network/test_create_public_ip.rb +3 -2
- data/test/requests/network/test_update_public_ip.rb +3 -2
- data/test/requests/resources/test_create_resource_group.rb +3 -2
- data/test/requests/resources/test_delete_resource_tag.rb +3 -3
- data/test/requests/resources/test_tag_resource.rb +3 -3
- data/test/requests/storage/test_check_storage_account_exists.rb +8 -1
- data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +9 -2
- data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +9 -2
- data/test/test_helper.rb +5 -14
- metadata +67 -75
- data/lib/fog/azurerm/models/storage/recovery_vault.rb +0 -50
- data/lib/fog/azurerm/models/storage/recovery_vaults.rb +0 -27
- data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +0 -54
- data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +0 -35
- data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +0 -60
- data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +0 -61
- data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +0 -56
- data/lib/fog/azurerm/requests/storage/get_backup_container.rb +0 -53
- data/lib/fog/azurerm/requests/storage/get_backup_item.rb +0 -58
- data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +0 -53
- data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +0 -64
- data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +0 -49
- data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +0 -48
- data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +0 -36
- data/lib/fog/azurerm/requests/storage/start_backup.rb +0 -54
- data/test/api_stub/models/storage/recovery_vault.rb +0 -23
- data/test/api_stub/requests/storage/recovery_vault.rb +0 -189
- data/test/models/storage/test_recovery_vault.rb +0 -61
- data/test/models/storage/test_recovery_vaults.rb +0 -47
- data/test/requests/storage/test_create_recovery_vault.rb +0 -35
- data/test/requests/storage/test_delete_recovery_vault.rb +0 -34
- data/test/requests/storage/test_disable_backup_protection.rb +0 -52
- data/test/requests/storage/test_enable_backup_protection.rb +0 -66
- data/test/requests/storage/test_get_all_backup_jobs.rb +0 -35
- data/test/requests/storage/test_get_backup_container.rb +0 -35
- data/test/requests/storage/test_get_backup_item.rb +0 -35
- data/test/requests/storage/test_get_backup_job_for_vm.rb +0 -26
- data/test/requests/storage/test_get_backup_protection_policy.rb +0 -35
- data/test/requests/storage/test_get_recovery_vault.rb +0 -35
- data/test/requests/storage/test_list_recovery_vault.rb +0 -35
- data/test/requests/storage/test_set_recovery_vault_context.rb +0 -34
- data/test/requests/storage/test_start_backup.rb +0 -55
@@ -1,61 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Recovery Vault model
|
4
|
-
class TestRecoveryVault < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@recovery_vault = recovery_vault(@service)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_model_methods
|
11
|
-
methods = [
|
12
|
-
:save,
|
13
|
-
:enable_backup_protection,
|
14
|
-
:disable_backup_protection,
|
15
|
-
:start_backup,
|
16
|
-
:destroy
|
17
|
-
]
|
18
|
-
methods.each do |method|
|
19
|
-
assert_respond_to @recovery_vault, method
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_model_attributes
|
24
|
-
attributes = [
|
25
|
-
:id,
|
26
|
-
:name,
|
27
|
-
:resource_group,
|
28
|
-
:location,
|
29
|
-
:type,
|
30
|
-
:sku_name
|
31
|
-
]
|
32
|
-
attributes.each do |attribute|
|
33
|
-
assert_respond_to @recovery_vault, attribute
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_save_method_response
|
38
|
-
create_response = ApiStub::Models::Storage::RecoveryVault.create_method_response
|
39
|
-
@service.stub :create_or_update_recovery_vault, create_response do
|
40
|
-
assert_instance_of Fog::Storage::AzureRM::RecoveryVault, @recovery_vault.save
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_enable_backup_protection_method_response
|
45
|
-
@service.stub :enable_backup_protection, true do
|
46
|
-
assert @recovery_vault.enable_backup_protection('test-vm', 'test-vm-rg')
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_disable_backup_protection_method_response
|
51
|
-
@service.stub :disable_backup_protection, true do
|
52
|
-
assert @recovery_vault.disable_backup_protection('test-vm', 'test-vm-rg')
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_destroy_method_response
|
57
|
-
@service.stub :delete_recovery_vault, true do
|
58
|
-
assert @recovery_vault.destroy
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test Class for RecoveryVault Collections
|
4
|
-
class TestRecoveryVaults < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@recovery_vaults = Fog::Storage::AzureRM::RecoveryVaults.new(resource_group: 'fog-test-rg', service: @service)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_collection_methods
|
11
|
-
methods = [
|
12
|
-
:all,
|
13
|
-
:get
|
14
|
-
]
|
15
|
-
methods.each do |method|
|
16
|
-
assert_respond_to @recovery_vaults, method
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_collection_attributes
|
21
|
-
attributes = [
|
22
|
-
:resource_group,
|
23
|
-
:name
|
24
|
-
]
|
25
|
-
attributes.each do |attribute|
|
26
|
-
assert_respond_to @recovery_vaults, attribute
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_all_method_response
|
31
|
-
response = [ApiStub::Models::Storage::RecoveryVault.create_method_response]
|
32
|
-
@service.stub :list_recovery_vaults, response do
|
33
|
-
assert_instance_of Fog::Storage::AzureRM::RecoveryVaults, @recovery_vaults.all
|
34
|
-
assert @recovery_vaults.all.size >= 1
|
35
|
-
@recovery_vaults.all.each do |recovery_vault|
|
36
|
-
assert_instance_of Fog::Storage::AzureRM::RecoveryVault, recovery_vault
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_get_method_response
|
42
|
-
response = ApiStub::Models::Storage::RecoveryVault.create_method_response
|
43
|
-
@service.stub :get_recovery_vault, response do
|
44
|
-
assert_instance_of Fog::Storage::AzureRM::RecoveryVault, @recovery_vaults.get('fog-test-rg', 'fog-test-vault')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Create Recovery Vault request
|
4
|
-
class TestCreateRecoveryVault < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_create_recovery_vault_success
|
11
|
-
response = ApiStub::Requests::Storage::RecoveryVault.create_recovery_vault_response
|
12
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
13
|
-
RestClient.stub :put, response do
|
14
|
-
assert_equal @service.create_or_update_recovery_vault('fog-test-rg', 'westus', 'fog-test-vault'), JSON.parse(response)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_create_recovery_vault_argument_error
|
20
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
21
|
-
assert_raises ArgumentError do
|
22
|
-
@service.create_or_update_recovery_vault('fog-test-rg', 'fog-test-vault')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_create_recovery_vault_exception
|
28
|
-
response = -> { fail Exception.new('mocked exception') }
|
29
|
-
@token_provider.stub :get_authentication_header, response do
|
30
|
-
assert_raises Exception do
|
31
|
-
@service.create_or_update_recovery_vault('fog-test-rg', 'westus', 'fog-test-vault')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Delete Recovery Vault request
|
4
|
-
class TestDeleteRecoveryVault < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_delete_recovery_vault_success
|
11
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
12
|
-
RestClient.stub :delete, true do
|
13
|
-
assert @service.delete_recovery_vault('fog-test-rg', 'fog-test-vault'), true
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_delete_recovery_vault_argument_error
|
19
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
20
|
-
assert_raises ArgumentError do
|
21
|
-
@service.delete_recovery_vault('fog-test-rg')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_delete_recovery_vault_exception
|
27
|
-
response = -> { fail Exception.new('mocked exception') }
|
28
|
-
@token_provider.stub :get_authentication_header, response do
|
29
|
-
assert_raises Exception do
|
30
|
-
assert @service.delete_recovery_vault('fog-test-rg')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Disable Backup Protection request
|
4
|
-
class TestDisableBackupProtection < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
8
|
-
|
9
|
-
@compute_service = Fog::Compute::AzureRM.new(credentials)
|
10
|
-
@compute_client = @compute_service.instance_variable_get(:@compute_mgmt_client)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_disable_backup_protection_success
|
14
|
-
response = ApiStub::Requests::Compute::VirtualMachine.virtual_machine_response(@compute_client)
|
15
|
-
@service.stub :set_recovery_vault_context, true do
|
16
|
-
@service.stub :get_virtual_machine_id, response.id do
|
17
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
18
|
-
RestClient.stub :put, true do
|
19
|
-
assert_equal @service.disable_backup_protection('fog-test-vault', 'fog-test-rg', 'fog-test-vm', 'fog-test-vm-rg'), true
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_disable_backup_protection_argument_error
|
27
|
-
response = ApiStub::Requests::Compute::VirtualMachine.virtual_machine_response(@compute_client)
|
28
|
-
@service.stub :set_recovery_vault_context, true do
|
29
|
-
@service.stub :get_virtual_machine_id, response.id do
|
30
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
31
|
-
assert_raises ArgumentError do
|
32
|
-
@service.disable_backup_protection('fog-test-vault', 'fog-test-rg')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_disable_backup_protection_exception
|
40
|
-
response = ApiStub::Requests::Compute::VirtualMachine.virtual_machine_response(@compute_client)
|
41
|
-
rest_client_response = -> { fail RestClient::Exception.new("'body': {'error': {'code': 'ResourceNotFound', 'message': 'mocked exception message'}}") }
|
42
|
-
@service.stub :set_recovery_vault_context, true do
|
43
|
-
@service.stub :get_virtual_machine_id, response.id do
|
44
|
-
@token_provider.stub :get_authentication_header, rest_client_response do
|
45
|
-
assert_raises Exception do
|
46
|
-
@service.disable_backup_protection('fog-test-vault', 'fog-test-rg', 'fog-test-vm', 'fog-test-vm-rg')
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Enable Backup Protection request
|
4
|
-
class TestEnableBackupProtection < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
8
|
-
|
9
|
-
@compute_service = Fog::Compute::AzureRM.new(credentials)
|
10
|
-
@compute_client = @compute_service.instance_variable_get(:@compute_mgmt_client)
|
11
|
-
|
12
|
-
@response = ApiStub::Requests::Compute::VirtualMachine.virtual_machine_response(@compute_client)
|
13
|
-
@policy_response = ApiStub::Requests::Storage::RecoveryVault.get_backup_protection_policy_response
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_enable_backup_protection_success
|
17
|
-
@service.stub :set_recovery_vault_context, true do
|
18
|
-
@service.stub :get_backup_protection_policy, JSON.parse(@policy_response)['value'] do
|
19
|
-
@service.stub :get_virtual_machine_id, @response.id do
|
20
|
-
@service.stub :get_backup_job_for_vm, nil do
|
21
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
22
|
-
RestClient.stub :put, true do
|
23
|
-
assert_equal @service.enable_backup_protection('fog-test-vault', 'fog-test-rg', 'fog-test-vm', 'fog-test-vm-rg'), true
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_enable_backup_protection_argument_error
|
33
|
-
@service.stub :set_recovery_vault_context, true do
|
34
|
-
@service.stub :get_backup_protection_policy, JSON.parse(@policy_response)['value'] do
|
35
|
-
@service.stub :get_virtual_machine_id, @response.id do
|
36
|
-
@service.stub :get_backup_job_for_vm, nil do
|
37
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
38
|
-
assert_raises ArgumentError do
|
39
|
-
@service.enable_backup_protection('fog-test-vault', 'fog-test-rg')
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_enable_backup_protection_exception
|
49
|
-
response = ApiStub::Requests::Compute::VirtualMachine.virtual_machine_response(@compute_client)
|
50
|
-
policy_response = ApiStub::Requests::Storage::RecoveryVault.get_backup_protection_policy_response
|
51
|
-
rest_client_response = -> { fail RestClient::Exception.new("'body': {'error': {'code': 'ResourceNotFound', 'message': 'mocked exception message'}}") }
|
52
|
-
@service.stub :set_recovery_vault_context, true do
|
53
|
-
@service.stub :get_backup_protection_policy, JSON.parse(policy_response)['value'] do
|
54
|
-
@service.stub :get_virtual_machine_id, response.id do
|
55
|
-
@service.stub :get_backup_job_for_vm, nil do
|
56
|
-
@token_provider.stub :get_authentication_header, rest_client_response do
|
57
|
-
assert_raises Exception do
|
58
|
-
@service.enable_backup_protection('fog-test-vault', 'fog-test-rg', 'fog-test-vm', 'fog-test-vm-rg')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Get All Backup Jobs request
|
4
|
-
class TestGetAllBackupJobs < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_get_all_backup_jobs_success
|
11
|
-
response = ApiStub::Requests::Storage::RecoveryVault.get_all_backup_jobs_response
|
12
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
13
|
-
RestClient.stub :get, response do
|
14
|
-
assert_equal @service.get_all_backup_jobs('fog-test-vault', 'fog-test-rg'), JSON.parse(response)['value']
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_get_all_backup_jobs_argument_error
|
20
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
21
|
-
assert_raises ArgumentError do
|
22
|
-
@service.get_all_backup_jobs('fog-test-vault')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_get_all_backup_jobs_exception
|
28
|
-
response = -> { fail Exception.new('mocked exception') }
|
29
|
-
@token_provider.stub :get_authentication_header, response do
|
30
|
-
assert_raises Exception do
|
31
|
-
@service.get_all_backup_jobs('fog-test-vault', 'fog-test-rg')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Get Backup Container request
|
4
|
-
class TestGetBackupContainer < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_get_backup_container_success
|
11
|
-
response = ApiStub::Requests::Storage::RecoveryVault.get_backup_container_response
|
12
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
13
|
-
RestClient.stub :get, response do
|
14
|
-
assert_equal @service.get_backup_container('fog-test-rg', 'fog-test-vault', 'fog-test-vm'), JSON.parse(response)['value']
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_get_backup_container_argument_error
|
20
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
21
|
-
assert_raises ArgumentError do
|
22
|
-
@service.get_backup_container('fog-test-rg', 'fog-test-vault')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_get_backup_container_exception
|
28
|
-
response = -> { fail Exception.new('mocked exception') }
|
29
|
-
@token_provider.stub :get_authentication_header, response do
|
30
|
-
assert_raises Exception do
|
31
|
-
@service.get_backup_container('fog-test-rg', 'fog-test-vault', 'fog-test-vm')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Get Backup Item request
|
4
|
-
class TestGetBackupItem < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_get_backup_item_success
|
11
|
-
response = ApiStub::Requests::Storage::RecoveryVault.get_backup_item_response
|
12
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
13
|
-
RestClient.stub :get, response do
|
14
|
-
assert_equal @service.get_backup_item('fog-test-rg', 'fog-test-vault'), JSON.parse(response)['value']
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_get_backup_item_argument_error
|
20
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
21
|
-
assert_raises ArgumentError do
|
22
|
-
@service.get_backup_item('fog-test-rg')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_get_backup_item_exception
|
28
|
-
response = -> { fail Exception.new('mocked exception') }
|
29
|
-
@token_provider.stub :get_authentication_header, response do
|
30
|
-
assert_raises Exception do
|
31
|
-
@service.get_backup_item('fog-test-rg', 'fog-test-vault')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Get Backup Job for VM request
|
4
|
-
class TestGetBackupJobForVM < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_get_backup_job_for_vm_success
|
11
|
-
backup_jobs_response = ApiStub::Requests::Storage::RecoveryVault.get_all_backup_jobs_response
|
12
|
-
single_backup_job_response = JSON.parse(backup_jobs_response)['value'][0]
|
13
|
-
@service.stub :get_all_backup_jobs, JSON.parse(backup_jobs_response)['value'] do
|
14
|
-
assert_equal @service.get_backup_job_for_vm('fog-test-vault', 'fog-test-vault', 'fog-test-vm', 'fog-test-vm-rg', 'Backup'), single_backup_job_response
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_get_backup_job_for_vm_argument_error
|
19
|
-
backup_jobs_response = ApiStub::Requests::Storage::RecoveryVault.get_all_backup_jobs_response
|
20
|
-
@service.stub :get_all_backup_jobs, JSON.parse(backup_jobs_response)['value'] do
|
21
|
-
assert_raises ArgumentError do
|
22
|
-
@service.get_backup_job_for_vm('fog-test-vault', 'fog-test-vault', 'fog-test-vm')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path '../../test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Get Backup Protection Policy request
|
4
|
-
class TestGetBackupProtectionPolicy < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@service = Fog::Storage::AzureRM.new(credentials)
|
7
|
-
@token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_get_backup_protection_policy_success
|
11
|
-
response = ApiStub::Requests::Storage::RecoveryVault.get_backup_protection_policy_response
|
12
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
13
|
-
RestClient.stub :get, response do
|
14
|
-
assert_equal @service.get_backup_protection_policy('fog-test-rg', 'fog-test-vault'), JSON.parse(response)['value']
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_get_backup_protection_policy_argument_error
|
20
|
-
@token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
21
|
-
assert_raises ArgumentError do
|
22
|
-
@service.get_backup_protection_policy('fog-test-rg')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_get_backup_protection_policy_exception
|
28
|
-
response = -> { fail Exception.new('mocked exception') }
|
29
|
-
@token_provider.stub :get_authentication_header, response do
|
30
|
-
assert_raises Exception do
|
31
|
-
@service.get_backup_protection_policy('fog-test-rg', 'fog-test-vault')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|