fog-azure-rm-temp 0.0.2 → 0.0.3
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/CHANGELOG.md +12 -3
- data/fog-azure-rm.gemspec +1 -1
- data/lib/fog/azurerm.rb +0 -1
- data/lib/fog/azurerm/docs/compute.md +3 -3
- data/lib/fog/azurerm/docs/storage.md +0 -66
- data/lib/fog/azurerm/models/compute/availability_set.rb +5 -5
- data/lib/fog/azurerm/requests/compute/create_availability_set.rb +6 -6
- data/lib/fog/azurerm/storage.rb +0 -18
- data/lib/fog/azurerm/version.rb +1 -1
- data/test/api_stub.rb +0 -2
- data/test/api_stub/requests/compute/availability_set.rb +4 -4
- data/test/integration/availability_set.rb +2 -2
- data/test/models/compute/test_availability_set.rb +1 -1
- data/test/requests/compute/test_create_availability_set.rb +4 -4
- data/test/test_helper.rb +1 -15
- metadata +11 -36
- 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,53 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class AzureRM
|
4
|
-
# Real class for Recovery Vault request
|
5
|
-
class Real
|
6
|
-
def get_backup_job_for_vm(rv_name, rv_resource_group, vm_name, vm_resource_group, operation)
|
7
|
-
msg = "Getting backup job for VM #{vm_name} in Resource Group #{vm_resource_group}"
|
8
|
-
Fog::Logger.debug msg
|
9
|
-
|
10
|
-
backup_jobs = get_all_backup_jobs(rv_name, rv_resource_group)
|
11
|
-
backup_jobs = backup_jobs.select do |job|
|
12
|
-
(job['properties']['status'].eql? 'InProgress') &&
|
13
|
-
(job['properties']['entityFriendlyName'].eql? vm_name.downcase) &&
|
14
|
-
(job['properties']['operation'].eql? operation)
|
15
|
-
end
|
16
|
-
|
17
|
-
backup_jobs[0]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# Mock class for Recovery Vault request
|
22
|
-
class Mock
|
23
|
-
def get_backup_job_for_vm(*)
|
24
|
-
body = '{
|
25
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault/backupJobs/########-####-####-####-############",
|
26
|
-
"name": "########-####-####-####-############",
|
27
|
-
"type": "Microsoft.RecoveryServices/vaults/backupJobs",
|
28
|
-
"properties": {
|
29
|
-
"jobType": "AzureIaaSVMJob",
|
30
|
-
"duration": "00:00:52.3309441",
|
31
|
-
"virtualMachineVersion": "Compute",
|
32
|
-
"extendedInfo": {
|
33
|
-
"tasksList": [],
|
34
|
-
"propertyBag": {
|
35
|
-
"VM Name": "fog-test-vm",
|
36
|
-
"Policy Name": "DefaultPolicy"
|
37
|
-
}
|
38
|
-
},
|
39
|
-
"entityFriendlyName": "fog-test-vm",
|
40
|
-
"backupManagementType": "AzureIaasVM",
|
41
|
-
"operation": "ConfigureBackup",
|
42
|
-
"status": "Completed",
|
43
|
-
"startTime": "2016-10-13T09:55:49.1168243Z",
|
44
|
-
"endTime": "2016-10-13T09:56:41.4477684Z",
|
45
|
-
"activityId": "383f05d9-a4bf-4b95-bb41-d39849b3a86e-2016-10-13 09:55:53Z-PS"
|
46
|
-
}
|
47
|
-
}'
|
48
|
-
Fog::JSON.decode(body)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class AzureRM
|
4
|
-
# Real class for Recovery Vault request
|
5
|
-
class Real
|
6
|
-
def get_backup_protection_policy(resource_group, name)
|
7
|
-
msg = "Get backup protection policy from Resource Group #{resource_group}"
|
8
|
-
Fog::Logger.debug msg
|
9
|
-
|
10
|
-
resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.RecoveryServices/vaults/#{name}/backupPolicies?api-version=#{REST_CLIENT_API_VERSION[1]}&$filter=backupManagementType eq 'AzureIaasVM'"
|
11
|
-
begin
|
12
|
-
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
13
|
-
response = RestClient.get(
|
14
|
-
resource_url,
|
15
|
-
accept: 'application/json',
|
16
|
-
content_type: 'application/json',
|
17
|
-
authorization: token
|
18
|
-
)
|
19
|
-
rescue RestClient::Exception => e
|
20
|
-
raise_azure_exception(e, msg)
|
21
|
-
end
|
22
|
-
Fog::Logger.debug "Successfully retrieved backup protection policy from Resource Group #{resource_group}"
|
23
|
-
Fog::JSON.decode(response)['value']
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Mock class for Recovery Vault request
|
28
|
-
class Mock
|
29
|
-
body = '{
|
30
|
-
"value": [{
|
31
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault/backupPolicies/DefaultPolicy",
|
32
|
-
"name": "DefaultPolicy",
|
33
|
-
"type": "Microsoft.RecoveryServices/vaults/backupPolicies",
|
34
|
-
"properties": {
|
35
|
-
"backupManagementType": "AzureIaasVM",
|
36
|
-
"schedulePolicy": {
|
37
|
-
"schedulePolicyType": "SimpleSchedulePolicy",
|
38
|
-
"scheduleRunFrequency": "Daily",
|
39
|
-
"scheduleRunTimes": [
|
40
|
-
"2016-10-13T19:30:00Z"
|
41
|
-
],
|
42
|
-
"scheduleWeeklyFrequency": 0
|
43
|
-
},
|
44
|
-
"retentionPolicy": {
|
45
|
-
"retentionPolicyType": "LongTermRetentionPolicy",
|
46
|
-
"dailySchedule": {
|
47
|
-
"retentionTimes": [
|
48
|
-
"2016-10-13T19:30:00Z"
|
49
|
-
],
|
50
|
-
"retentionDuration": {
|
51
|
-
"count": 30,
|
52
|
-
"durationType": "Days"
|
53
|
-
}
|
54
|
-
}
|
55
|
-
},
|
56
|
-
"protectedItemsCount": 0
|
57
|
-
}
|
58
|
-
}]
|
59
|
-
}'
|
60
|
-
Fog::JSON.decode(body)['value']
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class AzureRM
|
4
|
-
# Real class for Recovery Vault request
|
5
|
-
class Real
|
6
|
-
def get_recovery_vault(resource_group, name)
|
7
|
-
msg = "Retrieving Recovery Vault #{name} from Resource Group #{resource_group}"
|
8
|
-
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.RecoveryServices/vaults?api-version=#{REST_CLIENT_API_VERSION[1]}"
|
10
|
-
begin
|
11
|
-
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
12
|
-
recovery_vault_response = RestClient.get(
|
13
|
-
resource_url,
|
14
|
-
accept: 'application/json',
|
15
|
-
content_type: 'application/json',
|
16
|
-
authorization: token
|
17
|
-
)
|
18
|
-
rescue RestClient::Exception => e
|
19
|
-
raise_azure_exception(e, msg)
|
20
|
-
end
|
21
|
-
Fog::Logger.debug "Recovery Vault #{name} from Resource Group #{resource_group} retrieved successfully"
|
22
|
-
recovery_vault = Fog::JSON.decode(recovery_vault_response)['value']
|
23
|
-
recovery_vault.select { |vault| vault['name'].eql? name }[0]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Mock class for Recovery Vault request
|
28
|
-
class Mock
|
29
|
-
def get_recovery_vault(*)
|
30
|
-
body = '{
|
31
|
-
"value": [{
|
32
|
-
"location": "westus",
|
33
|
-
"name": "fog-test-vault",
|
34
|
-
"properties": {
|
35
|
-
"provisioningState": "Succeeded"
|
36
|
-
},
|
37
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault",
|
38
|
-
"type": "Microsoft.RecoveryServices/vaults",
|
39
|
-
"sku": {
|
40
|
-
"name": "standard"
|
41
|
-
}
|
42
|
-
}]
|
43
|
-
}'
|
44
|
-
Fog::JSON.decode(body)['value'][0]
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class AzureRM
|
4
|
-
# Real class for Recovery Vault request
|
5
|
-
class Real
|
6
|
-
def list_recovery_vaults(resource_group)
|
7
|
-
msg = "Listing Recovery Vaults in Resource Group #{resource_group}"
|
8
|
-
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.RecoveryServices/vaults?api-version=#{REST_CLIENT_API_VERSION[1]}"
|
10
|
-
begin
|
11
|
-
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
12
|
-
recovery_vaults_response = RestClient.get(
|
13
|
-
resource_url,
|
14
|
-
accept: 'application/json',
|
15
|
-
content_type: 'application/json',
|
16
|
-
authorization: token
|
17
|
-
)
|
18
|
-
rescue RestClient::Exception => e
|
19
|
-
raise_azure_exception(e, msg)
|
20
|
-
end
|
21
|
-
Fog::Logger.debug "Recovery Vaults in Resource Group #{resource_group} listed successfully"
|
22
|
-
Fog::JSON.decode(recovery_vaults_response)['value']
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Mock class for Recovery Vault Request
|
27
|
-
class Mock
|
28
|
-
def list_recovery_vaults(*)
|
29
|
-
body = '{
|
30
|
-
"value": [{
|
31
|
-
"location": "westus",
|
32
|
-
"name": "fog-test-vault",
|
33
|
-
"properties": {
|
34
|
-
"provisioningState": "Succeeded"
|
35
|
-
},
|
36
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault",
|
37
|
-
"type": "Microsoft.RecoveryServices/vaults",
|
38
|
-
"sku": {
|
39
|
-
"name": "standard"
|
40
|
-
}
|
41
|
-
}]
|
42
|
-
}'
|
43
|
-
Fog::JSON.decode(body)['value']
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class AzureRM
|
4
|
-
# Real class for Recovery Vault request
|
5
|
-
class Real
|
6
|
-
def set_recovery_vault_context(resource_group, name)
|
7
|
-
msg = "Set context for Recovery Vault #{name}"
|
8
|
-
Fog::Logger.debug msg
|
9
|
-
|
10
|
-
resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.RecoveryServices/vaults/#{name}?api-version=#{REST_CLIENT_API_VERSION[1]}"
|
11
|
-
begin
|
12
|
-
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
13
|
-
RestClient.get(
|
14
|
-
resource_url,
|
15
|
-
accept: 'application/json',
|
16
|
-
content_type: 'application/json',
|
17
|
-
authorization: token
|
18
|
-
)
|
19
|
-
rescue RestClient::Exception => e
|
20
|
-
raise_azure_exception(e, msg)
|
21
|
-
end
|
22
|
-
Fog::Logger.debug "Successfully set context for Recovery Vault #{name}"
|
23
|
-
true
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Mock class for Recovery Vault request
|
28
|
-
class Mock
|
29
|
-
def set_recovery_vault_context(*)
|
30
|
-
Fog::Logger.debug 'Successfully set context for Recovery Vault {name}'
|
31
|
-
true
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
IAAS_VM_BACKUP_REQUEST = 'IaasVMBackupRequest'.freeze
|
2
|
-
|
3
|
-
module Fog
|
4
|
-
module Storage
|
5
|
-
class AzureRM
|
6
|
-
# Real class for Recovery Vault request
|
7
|
-
class Real
|
8
|
-
def start_backup(resource_group, name, vm_name, vm_resource_group)
|
9
|
-
msg = "Starting backup for VM #{vm_name}"
|
10
|
-
Fog::Logger.debug msg
|
11
|
-
|
12
|
-
job = get_backup_job_for_vm(name, resource_group, vm_name, vm_resource_group, 'Backup')
|
13
|
-
|
14
|
-
unless job.nil?
|
15
|
-
Fog::Logger.debug "Backup already in progress for VM #{vm_name} in Recovery Vault #{name}"
|
16
|
-
return false
|
17
|
-
end
|
18
|
-
|
19
|
-
backup_items = get_backup_item(resource_group, name)
|
20
|
-
backup_item = backup_items.select { |item| (item['properties']['friendlyName'].eql? vm_name.downcase) && (vm_resource_group.eql? get_resource_group_from_id(item['properties']['virtualMachineId'])) }[0]
|
21
|
-
|
22
|
-
resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.RecoveryServices/vaults/#{name}/backupFabrics/Azure/protectionContainers/iaasvmcontainer;#{backup_item['name']}/protectedItems/vm;#{backup_item['name']}/backup?api-version=#{REST_CLIENT_API_VERSION[1]}"
|
23
|
-
body = {
|
24
|
-
properties: {
|
25
|
-
objectType: IAAS_VM_BACKUP_REQUEST
|
26
|
-
}
|
27
|
-
}
|
28
|
-
begin
|
29
|
-
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
30
|
-
RestClient.post(
|
31
|
-
resource_url,
|
32
|
-
body.to_json,
|
33
|
-
accept: 'application/json',
|
34
|
-
content_type: 'application/json',
|
35
|
-
authorization: token
|
36
|
-
)
|
37
|
-
rescue RestClient::Exception => e
|
38
|
-
raise_azure_exception(e, msg)
|
39
|
-
end
|
40
|
-
Fog::Logger.debug "Successfully started backup for VM #{vm_name} in Recovery Vault #{name}"
|
41
|
-
true
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# Mock class for Recovery Vault request
|
46
|
-
class Mock
|
47
|
-
def start_backup(*)
|
48
|
-
Fog::Logger.debug 'Successfully started backup for VM {vm_name} in Recovery Vault {name}'
|
49
|
-
true
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module ApiStub
|
2
|
-
module Models
|
3
|
-
module Storage
|
4
|
-
# Mock class for Recovery Vault model
|
5
|
-
class RecoveryVault
|
6
|
-
def self.create_method_response
|
7
|
-
{
|
8
|
-
'id' => '/subscriptions/#{67f2116d}#######-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault',
|
9
|
-
'location' => 'westus',
|
10
|
-
'name' => 'fog-test-vault',
|
11
|
-
'properties' => {
|
12
|
-
'provisioningState' => 'Succeeded'
|
13
|
-
},
|
14
|
-
'type' => 'Microsoft.RecoveryServices/vaults',
|
15
|
-
'sku' => {
|
16
|
-
'name' => 'standard'
|
17
|
-
}
|
18
|
-
}
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,189 +0,0 @@
|
|
1
|
-
module ApiStub
|
2
|
-
module Requests
|
3
|
-
module Storage
|
4
|
-
# Mock class for RecoveryVault request
|
5
|
-
class RecoveryVault
|
6
|
-
def self.create_recovery_vault_response
|
7
|
-
'{
|
8
|
-
"location": "westus",
|
9
|
-
"name": "fog-test-vault",
|
10
|
-
"properties": {
|
11
|
-
"provisioningState": "Succeeded"
|
12
|
-
},
|
13
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault",
|
14
|
-
"type": "Microsoft.RecoveryServices\/vaults",
|
15
|
-
"sku": {
|
16
|
-
"name": "standard"
|
17
|
-
}
|
18
|
-
}'
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.get_recovery_vault_response
|
22
|
-
'{
|
23
|
-
"value": [{
|
24
|
-
"location": "westus",
|
25
|
-
"name": "fog-test-vault",
|
26
|
-
"properties": {
|
27
|
-
"provisioningState": "Succeeded"
|
28
|
-
},
|
29
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault",
|
30
|
-
"type": "Microsoft.RecoveryServices/vaults",
|
31
|
-
"sku": {
|
32
|
-
"name": "standard"
|
33
|
-
}
|
34
|
-
}]
|
35
|
-
}'
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.get_all_backup_jobs_response
|
39
|
-
'{
|
40
|
-
"value": [{
|
41
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault/backupJobs/########-####-####-####-############",
|
42
|
-
"name": "########-####-####-####-############",
|
43
|
-
"type": "Microsoft.RecoveryServices/vaults/backupJobs",
|
44
|
-
"properties": {
|
45
|
-
"jobType": "AzureIaaSVMJob",
|
46
|
-
"duration": "XX:XX:XX.XXXXXXX",
|
47
|
-
"actionsInfo": [
|
48
|
-
1
|
49
|
-
],
|
50
|
-
"virtualMachineVersion": "Compute",
|
51
|
-
"entityFriendlyName": "fog-test-vm",
|
52
|
-
"backupManagementType": "AzureIaasVM",
|
53
|
-
"operation": "Backup",
|
54
|
-
"status": "InProgress",
|
55
|
-
"startTime": "2016-10-19T07:49:31.1466534Z",
|
56
|
-
"activityId": "########-####-####-####-############"
|
57
|
-
}
|
58
|
-
}]
|
59
|
-
}'
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.get_backup_container_response
|
63
|
-
'{
|
64
|
-
"value": [{
|
65
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;fog-test-vm-rg;fog-test-vm",
|
66
|
-
"name": "IaasVMContainer;iaasvmcontainerv2;fog-test-vm-rg;fog-test-vm",
|
67
|
-
"type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers",
|
68
|
-
"properties": {
|
69
|
-
"virtualMachineId": "/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Compute/virtualMachines/TestVM",
|
70
|
-
"virtualMachineVersion": "Compute",
|
71
|
-
"resourceGroup": "fog-test-vm-rg",
|
72
|
-
"friendlyName": "fog-test-vm",
|
73
|
-
"backupManagementType": "AzureIaasVM",
|
74
|
-
"registrationStatus": "Registered",
|
75
|
-
"healthStatus": "Healthy",
|
76
|
-
"containerType": "Microsoft.Compute/virtualMachines",
|
77
|
-
"protectableObjectType": "Microsoft.Compute/virtualMachines"
|
78
|
-
}
|
79
|
-
}]
|
80
|
-
}'
|
81
|
-
end
|
82
|
-
|
83
|
-
def self.get_backup_item_response
|
84
|
-
'{
|
85
|
-
"value": [{
|
86
|
-
"id": "/Subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;testrg;testvm/protectedItems/VM;fog-test-container-name",
|
87
|
-
"name": "iaasvmcontainerv2;fog-test-vm-rg;fog-test-vm",
|
88
|
-
"type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems",
|
89
|
-
"properties": {
|
90
|
-
"friendlyName": "fog-test-vm",
|
91
|
-
"virtualMachineId": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-vm-rg/providers/Microsoft.Compute/virtualMachines/fog-test-vm",
|
92
|
-
"protectionStatus": "Healthy",
|
93
|
-
"protectionState": "Protected",
|
94
|
-
"lastBackupStatus": "Completed",
|
95
|
-
"lastBackupTime": "2016-10-17T10:30:47.2289274Z",
|
96
|
-
"protectedItemType": "Microsoft.Compute/virtualMachines",
|
97
|
-
"backupManagementType": "AzureIaasVM",
|
98
|
-
"workloadType": "VM",
|
99
|
-
"containerName": "iaasvmcontainerv2;fog-test-vm-rg;fog-test-vm",
|
100
|
-
"sourceResourceId": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-vm-rg/providers/Microsoft.Compute/virtualMachines/fog-test-vm",
|
101
|
-
"policyId": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault/backupPolicies/DefaultPolicy",
|
102
|
-
"policyName": "DefaultPolicy",
|
103
|
-
"lastRecoveryPoint": "2016-10-17T10:32:38.4666692Z"
|
104
|
-
}
|
105
|
-
}]
|
106
|
-
}'
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.list_recovery_vault_response
|
110
|
-
'{
|
111
|
-
"value": [{
|
112
|
-
"location": "westus",
|
113
|
-
"name": "fog-test-vault",
|
114
|
-
"properties": {
|
115
|
-
"provisioningState": "Succeeded"
|
116
|
-
},
|
117
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-vault/providers/Microsoft.RecoveryServices/vaults/fog-test-vault",
|
118
|
-
"type": "Microsoft.RecoveryServices/vaults",
|
119
|
-
"sku": {
|
120
|
-
"name": "standard"
|
121
|
-
}
|
122
|
-
}]
|
123
|
-
}'
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.get_backup_protection_policy_response
|
127
|
-
'{
|
128
|
-
"value": [{
|
129
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault/backupPolicies/DefaultPolicy",
|
130
|
-
"name": "DefaultPolicy",
|
131
|
-
"type": "Microsoft.RecoveryServices/vaults/backupPolicies",
|
132
|
-
"properties": {
|
133
|
-
"backupManagementType": "AzureIaasVM",
|
134
|
-
"schedulePolicy": {
|
135
|
-
"schedulePolicyType": "SimpleSchedulePolicy",
|
136
|
-
"scheduleRunFrequency": "Daily",
|
137
|
-
"scheduleRunTimes": [
|
138
|
-
"2016-10-13T19:30:00Z"
|
139
|
-
],
|
140
|
-
"scheduleWeeklyFrequency": 0
|
141
|
-
},
|
142
|
-
"retentionPolicy": {
|
143
|
-
"retentionPolicyType": "LongTermRetentionPolicy",
|
144
|
-
"dailySchedule": {
|
145
|
-
"retentionTimes": [
|
146
|
-
"2016-10-13T19:30:00Z"
|
147
|
-
],
|
148
|
-
"retentionDuration": {
|
149
|
-
"count": 30,
|
150
|
-
"durationType": "Days"
|
151
|
-
}
|
152
|
-
}
|
153
|
-
},
|
154
|
-
"protectedItemsCount": 0
|
155
|
-
}
|
156
|
-
}]
|
157
|
-
}'
|
158
|
-
end
|
159
|
-
|
160
|
-
def self.get_backup_job_for_vm_response
|
161
|
-
'{
|
162
|
-
"id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault/backupJobs/########-####-####-####-############",
|
163
|
-
"name": "########-####-####-####-############",
|
164
|
-
"type": "Microsoft.RecoveryServices/vaults/backupJobs",
|
165
|
-
"properties": {
|
166
|
-
"jobType": "AzureIaaSVMJob",
|
167
|
-
"duration": "00:00:52.3309441",
|
168
|
-
"virtualMachineVersion": "Compute",
|
169
|
-
"extendedInfo": {
|
170
|
-
"tasksList": [],
|
171
|
-
"propertyBag": {
|
172
|
-
"VM Name": "fog-test-vm",
|
173
|
-
"Policy Name": "DefaultPolicy"
|
174
|
-
}
|
175
|
-
},
|
176
|
-
"entityFriendlyName": "fog-test-vm",
|
177
|
-
"backupManagementType": "AzureIaasVM",
|
178
|
-
"operation": "ConfigureBackup",
|
179
|
-
"status": "Completed",
|
180
|
-
"startTime": "2016-10-13T09:55:49.1168243Z",
|
181
|
-
"endTime": "2016-10-13T09:56:41.4477684Z",
|
182
|
-
"activityId": "383f05d9-a4bf-4b95-bb41-d39849b3a86e-2016-10-13 09:55:53Z-PS"
|
183
|
-
}
|
184
|
-
}'
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|