azure_mgmt_recovery_services_backup 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_recovery_services_backup.rb +5 -0
  4. data/lib/generated/azure_mgmt_recovery_services_backup.rb +175 -0
  5. data/lib/generated/azure_mgmt_recovery_services_backup/backup_engines.rb +253 -0
  6. data/lib/generated/azure_mgmt_recovery_services_backup/backup_operation_results.rb +128 -0
  7. data/lib/generated/azure_mgmt_recovery_services_backup/backup_operation_statuses.rb +136 -0
  8. data/lib/generated/azure_mgmt_recovery_services_backup/backups.rb +149 -0
  9. data/lib/generated/azure_mgmt_recovery_services_backup/export_jobs_operation_results.rb +124 -0
  10. data/lib/generated/azure_mgmt_recovery_services_backup/item_level_recovery_connections.rb +276 -0
  11. data/lib/generated/azure_mgmt_recovery_services_backup/job_cancellations.rb +116 -0
  12. data/lib/generated/azure_mgmt_recovery_services_backup/job_details.rb +124 -0
  13. data/lib/generated/azure_mgmt_recovery_services_backup/job_operation_results.rb +117 -0
  14. data/lib/generated/azure_mgmt_recovery_services_backup/jobs.rb +369 -0
  15. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_backup_server_engine.rb +92 -0
  16. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_sclassic_compute_vmcontainer.rb +107 -0
  17. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_sclassic_compute_vmprotectable_item.rb +77 -0
  18. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_sclassic_compute_vmprotected_item.rb +136 -0
  19. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_scompute_vmcontainer.rb +107 -0
  20. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_scompute_vmprotectable_item.rb +77 -0
  21. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_scompute_vmprotected_item.rb +137 -0
  22. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_svmerror_info.rb +82 -0
  23. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_svmjob.rb +169 -0
  24. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_svmjob_extended_info.rb +91 -0
  25. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_svmjob_task_details.rb +104 -0
  26. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_svmprotected_item.rb +165 -0
  27. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_svmprotected_item_extended_info.rb +68 -0
  28. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_iaa_svmprotection_policy.rb +83 -0
  29. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_sql_container.rb +85 -0
  30. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_sql_protected_item.rb +121 -0
  31. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_sql_protected_item_extended_info.rb +67 -0
  32. data/lib/generated/azure_mgmt_recovery_services_backup/models/azure_sql_protection_policy.rb +68 -0
  33. data/lib/generated/azure_mgmt_recovery_services_backup/models/backup_engine_base.rb +112 -0
  34. data/lib/generated/azure_mgmt_recovery_services_backup/models/backup_engine_base_resource.rb +97 -0
  35. data/lib/generated/azure_mgmt_recovery_services_backup/models/backup_engine_base_resource_list.rb +90 -0
  36. data/lib/generated/azure_mgmt_recovery_services_backup/models/backup_item_type.rb +22 -0
  37. data/lib/generated/azure_mgmt_recovery_services_backup/models/backup_management_type.rb +20 -0
  38. data/lib/generated/azure_mgmt_recovery_services_backup/models/backup_request.rb +46 -0
  39. data/lib/generated/azure_mgmt_recovery_services_backup/models/backup_request_resource.rb +97 -0
  40. data/lib/generated/azure_mgmt_recovery_services_backup/models/bekdetails.rb +65 -0
  41. data/lib/generated/azure_mgmt_recovery_services_backup/models/bmsbackup_engine_query_object.rb +47 -0
  42. data/lib/generated/azure_mgmt_recovery_services_backup/models/bmscontainer_query_object.rb +68 -0
  43. data/lib/generated/azure_mgmt_recovery_services_backup/models/bmspoquery_object.rb +67 -0
  44. data/lib/generated/azure_mgmt_recovery_services_backup/models/bmsrpquery_object.rb +54 -0
  45. data/lib/generated/azure_mgmt_recovery_services_backup/models/client_script_for_connect.rb +67 -0
  46. data/lib/generated/azure_mgmt_recovery_services_backup/models/daily_retention_format.rb +52 -0
  47. data/lib/generated/azure_mgmt_recovery_services_backup/models/daily_retention_schedule.rb +62 -0
  48. data/lib/generated/azure_mgmt_recovery_services_backup/models/data_source_type.rb +22 -0
  49. data/lib/generated/azure_mgmt_recovery_services_backup/models/day.rb +54 -0
  50. data/lib/generated/azure_mgmt_recovery_services_backup/models/day_of_week.rb +21 -0
  51. data/lib/generated/azure_mgmt_recovery_services_backup/models/dpm_backup_engine.rb +92 -0
  52. data/lib/generated/azure_mgmt_recovery_services_backup/models/dpm_error_info.rb +62 -0
  53. data/lib/generated/azure_mgmt_recovery_services_backup/models/dpm_job.rb +198 -0
  54. data/lib/generated/azure_mgmt_recovery_services_backup/models/dpm_job_extended_info.rb +80 -0
  55. data/lib/generated/azure_mgmt_recovery_services_backup/models/dpm_job_task_details.rb +84 -0
  56. data/lib/generated/azure_mgmt_recovery_services_backup/models/encryption_details.rb +87 -0
  57. data/lib/generated/azure_mgmt_recovery_services_backup/models/export_jobs_operation_result_info.rb +70 -0
  58. data/lib/generated/azure_mgmt_recovery_services_backup/models/generic_recovery_point.rb +89 -0
  59. data/lib/generated/azure_mgmt_recovery_services_backup/models/get_protected_item_query_object.rb +45 -0
  60. data/lib/generated/azure_mgmt_recovery_services_backup/models/http_status_code.rb +61 -0
  61. data/lib/generated/azure_mgmt_recovery_services_backup/models/iaa_svmcontainer.rb +118 -0
  62. data/lib/generated/azure_mgmt_recovery_services_backup/models/iaa_svmprotectable_item.rb +82 -0
  63. data/lib/generated/azure_mgmt_recovery_services_backup/models/iaas_vmbackup_request.rb +60 -0
  64. data/lib/generated/azure_mgmt_recovery_services_backup/models/iaas_vmilrregistration_request.rb +92 -0
  65. data/lib/generated/azure_mgmt_recovery_services_backup/models/iaas_vmrecovery_point.rb +124 -0
  66. data/lib/generated/azure_mgmt_recovery_services_backup/models/iaas_vmrestore_request.rb +202 -0
  67. data/lib/generated/azure_mgmt_recovery_services_backup/models/ilrrequest.rb +45 -0
  68. data/lib/generated/azure_mgmt_recovery_services_backup/models/ilrrequest_resource.rb +96 -0
  69. data/lib/generated/azure_mgmt_recovery_services_backup/models/instant_item_recovery_target.rb +52 -0
  70. data/lib/generated/azure_mgmt_recovery_services_backup/models/job.rb +121 -0
  71. data/lib/generated/azure_mgmt_recovery_services_backup/models/job_operation_type.rb +20 -0
  72. data/lib/generated/azure_mgmt_recovery_services_backup/models/job_query_object.rb +103 -0
  73. data/lib/generated/azure_mgmt_recovery_services_backup/models/job_resource.rb +96 -0
  74. data/lib/generated/azure_mgmt_recovery_services_backup/models/job_resource_list.rb +90 -0
  75. data/lib/generated/azure_mgmt_recovery_services_backup/models/job_status.rb +21 -0
  76. data/lib/generated/azure_mgmt_recovery_services_backup/models/job_supported_action.rb +17 -0
  77. data/lib/generated/azure_mgmt_recovery_services_backup/models/kekdetails.rb +67 -0
  78. data/lib/generated/azure_mgmt_recovery_services_backup/models/key_and_secret_details.rb +63 -0
  79. data/lib/generated/azure_mgmt_recovery_services_backup/models/long_term_retention_policy.rb +96 -0
  80. data/lib/generated/azure_mgmt_recovery_services_backup/models/long_term_schedule_policy.rb +48 -0
  81. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_container.rb +137 -0
  82. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_container_extended_info.rb +95 -0
  83. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_error_info.rb +61 -0
  84. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_file_folder_protected_item.rb +149 -0
  85. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_file_folder_protected_item_extended_info.rb +66 -0
  86. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_job.rb +194 -0
  87. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_job_extended_info.rb +79 -0
  88. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_job_task_details.rb +84 -0
  89. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_protection_policy.rb +82 -0
  90. data/lib/generated/azure_mgmt_recovery_services_backup/models/mab_server_type.rb +25 -0
  91. data/lib/generated/azure_mgmt_recovery_services_backup/models/month_of_year.rb +27 -0
  92. data/lib/generated/azure_mgmt_recovery_services_backup/models/monthly_retention_schedule.rb +99 -0
  93. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_result_info.rb +65 -0
  94. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_result_info_base.rb +46 -0
  95. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_result_info_base_resource.rb +76 -0
  96. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_status.rb +114 -0
  97. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_status_error.rb +54 -0
  98. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_status_extended_info.rb +47 -0
  99. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_status_job_extended_info.rb +58 -0
  100. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_status_jobs_extended_info.rb +83 -0
  101. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_status_provision_ilrextended_info.rb +61 -0
  102. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_status_values.rb +19 -0
  103. data/lib/generated/azure_mgmt_recovery_services_backup/models/operation_worker_response.rb +83 -0
  104. data/lib/generated/azure_mgmt_recovery_services_backup/models/protected_item.rb +107 -0
  105. data/lib/generated/azure_mgmt_recovery_services_backup/models/protected_item_query_object.rb +81 -0
  106. data/lib/generated/azure_mgmt_recovery_services_backup/models/protected_item_resource.rb +96 -0
  107. data/lib/generated/azure_mgmt_recovery_services_backup/models/protected_item_resource_list.rb +90 -0
  108. data/lib/generated/azure_mgmt_recovery_services_backup/models/protected_item_state.rb +20 -0
  109. data/lib/generated/azure_mgmt_recovery_services_backup/models/protection_container.rb +110 -0
  110. data/lib/generated/azure_mgmt_recovery_services_backup/models/protection_container_resource.rb +97 -0
  111. data/lib/generated/azure_mgmt_recovery_services_backup/models/protection_container_resource_list.rb +90 -0
  112. data/lib/generated/azure_mgmt_recovery_services_backup/models/protection_policy.rb +58 -0
  113. data/lib/generated/azure_mgmt_recovery_services_backup/models/protection_policy_query_object.rb +47 -0
  114. data/lib/generated/azure_mgmt_recovery_services_backup/models/protection_policy_resource.rb +97 -0
  115. data/lib/generated/azure_mgmt_recovery_services_backup/models/protection_policy_resource_list.rb +90 -0
  116. data/lib/generated/azure_mgmt_recovery_services_backup/models/protection_state.rb +20 -0
  117. data/lib/generated/azure_mgmt_recovery_services_backup/models/protection_status.rb +18 -0
  118. data/lib/generated/azure_mgmt_recovery_services_backup/models/recovery_point.rb +47 -0
  119. data/lib/generated/azure_mgmt_recovery_services_backup/models/recovery_point_resource.rb +97 -0
  120. data/lib/generated/azure_mgmt_recovery_services_backup/models/recovery_point_resource_list.rb +90 -0
  121. data/lib/generated/azure_mgmt_recovery_services_backup/models/recovery_type.rb +18 -0
  122. data/lib/generated/azure_mgmt_recovery_services_backup/models/resource_list.rb +45 -0
  123. data/lib/generated/azure_mgmt_recovery_services_backup/models/restore_request.rb +46 -0
  124. data/lib/generated/azure_mgmt_recovery_services_backup/models/restore_request_resource.rb +97 -0
  125. data/lib/generated/azure_mgmt_recovery_services_backup/models/retention_duration.rb +60 -0
  126. data/lib/generated/azure_mgmt_recovery_services_backup/models/retention_duration_type.rb +19 -0
  127. data/lib/generated/azure_mgmt_recovery_services_backup/models/retention_policy.rb +46 -0
  128. data/lib/generated/azure_mgmt_recovery_services_backup/models/retention_schedule_format.rb +17 -0
  129. data/lib/generated/azure_mgmt_recovery_services_backup/models/schedule_policy.rb +46 -0
  130. data/lib/generated/azure_mgmt_recovery_services_backup/models/schedule_run_type.rb +17 -0
  131. data/lib/generated/azure_mgmt_recovery_services_backup/models/simple_retention_policy.rb +60 -0
  132. data/lib/generated/azure_mgmt_recovery_services_backup/models/simple_schedule_policy.rb +108 -0
  133. data/lib/generated/azure_mgmt_recovery_services_backup/models/week_of_month.rb +19 -0
  134. data/lib/generated/azure_mgmt_recovery_services_backup/models/weekly_retention_format.rb +70 -0
  135. data/lib/generated/azure_mgmt_recovery_services_backup/models/weekly_retention_schedule.rb +81 -0
  136. data/lib/generated/azure_mgmt_recovery_services_backup/models/workload_protectable_item.rb +80 -0
  137. data/lib/generated/azure_mgmt_recovery_services_backup/models/workload_protectable_item_resource.rb +97 -0
  138. data/lib/generated/azure_mgmt_recovery_services_backup/models/workload_protectable_item_resource_list.rb +90 -0
  139. data/lib/generated/azure_mgmt_recovery_services_backup/models/workload_type.rb +22 -0
  140. data/lib/generated/azure_mgmt_recovery_services_backup/models/yearly_retention_schedule.rb +119 -0
  141. data/lib/generated/azure_mgmt_recovery_services_backup/module_definition.rb +8 -0
  142. data/lib/generated/azure_mgmt_recovery_services_backup/protectable_items.rb +276 -0
  143. data/lib/generated/azure_mgmt_recovery_services_backup/protected_item_operation_results.rb +142 -0
  144. data/lib/generated/azure_mgmt_recovery_services_backup/protected_item_operation_statuses.rb +154 -0
  145. data/lib/generated/azure_mgmt_recovery_services_backup/protected_items.rb +609 -0
  146. data/lib/generated/azure_mgmt_recovery_services_backup/protection_container_operation_results.rb +135 -0
  147. data/lib/generated/azure_mgmt_recovery_services_backup/protection_container_refresh_operation_results.rb +120 -0
  148. data/lib/generated/azure_mgmt_recovery_services_backup/protection_containers.rb +538 -0
  149. data/lib/generated/azure_mgmt_recovery_services_backup/protection_policies.rb +566 -0
  150. data/lib/generated/azure_mgmt_recovery_services_backup/protection_policy_operation_results.rb +131 -0
  151. data/lib/generated/azure_mgmt_recovery_services_backup/protection_policy_operation_statuses.rb +143 -0
  152. data/lib/generated/azure_mgmt_recovery_services_backup/recovery_points.rb +386 -0
  153. data/lib/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb +215 -0
  154. data/lib/generated/azure_mgmt_recovery_services_backup/restores.rb +150 -0
  155. data/lib/generated/azure_mgmt_recovery_services_backup/version.rb +8 -0
  156. metadata +268 -0
@@ -0,0 +1,135 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServicesBackup
7
+ #
8
+ # Composite Swagger for Recovery Services Backup Client
9
+ #
10
+ class ProtectionContainerOperationResults
11
+ include Azure::ARM::RecoveryServicesBackup::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ProtectionContainerOperationResults class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [RecoveryServicesBackupClient] reference to the RecoveryServicesBackupClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets the result of any operation on the container.
27
+ #
28
+ # @param vault_name [String] The name of the Recovery Services vault.
29
+ # @param resource_group_name [String] The name of the resource group associated
30
+ # with the Recovery Services vault.
31
+ # @param fabric_name [String] The fabric name associated with the container.
32
+ # @param container_name [String] The container name used for this GET
33
+ # operation.
34
+ # @param operation_id [String] The operation ID used for this GET operation.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [ProtectionContainerResource] operation results.
39
+ #
40
+ def get(vault_name, resource_group_name, fabric_name, container_name, operation_id, custom_headers = nil)
41
+ response = get_async(vault_name, resource_group_name, fabric_name, container_name, operation_id, custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # Gets the result of any operation on the container.
47
+ #
48
+ # @param vault_name [String] The name of the Recovery Services vault.
49
+ # @param resource_group_name [String] The name of the resource group associated
50
+ # with the Recovery Services vault.
51
+ # @param fabric_name [String] The fabric name associated with the container.
52
+ # @param container_name [String] The container name used for this GET
53
+ # operation.
54
+ # @param operation_id [String] The operation ID used for this GET operation.
55
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
56
+ # will be added to the HTTP request.
57
+ #
58
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
59
+ #
60
+ def get_with_http_info(vault_name, resource_group_name, fabric_name, container_name, operation_id, custom_headers = nil)
61
+ get_async(vault_name, resource_group_name, fabric_name, container_name, operation_id, custom_headers).value!
62
+ end
63
+
64
+ #
65
+ # Gets the result of any operation on the container.
66
+ #
67
+ # @param vault_name [String] The name of the Recovery Services vault.
68
+ # @param resource_group_name [String] The name of the resource group associated
69
+ # with the Recovery Services vault.
70
+ # @param fabric_name [String] The fabric name associated with the container.
71
+ # @param container_name [String] The container name used for this GET
72
+ # operation.
73
+ # @param operation_id [String] The operation ID used for this GET operation.
74
+ # @param [Hash{String => String}] A hash of custom headers that will be added
75
+ # to the HTTP request.
76
+ #
77
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
78
+ #
79
+ def get_async(vault_name, resource_group_name, fabric_name, container_name, operation_id, custom_headers = nil)
80
+ api_version = '2016-06-01'
81
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
82
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
83
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
84
+ fail ArgumentError, 'fabric_name is nil' if fabric_name.nil?
85
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
86
+ fail ArgumentError, 'operation_id is nil' if operation_id.nil?
87
+
88
+
89
+ request_headers = {}
90
+
91
+ # Set Headers
92
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
93
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
94
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}'
95
+
96
+ request_url = @base_url || @client.base_url
97
+
98
+ options = {
99
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
100
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'containerName' => container_name,'operationId' => operation_id},
101
+ query_params: {'api-version' => api_version},
102
+ headers: request_headers.merge(custom_headers || {}),
103
+ base_url: request_url
104
+ }
105
+ promise = @client.make_request_async(:get, path_template, options)
106
+
107
+ promise = promise.then do |result|
108
+ http_response = result.response
109
+ status_code = http_response.status
110
+ response_content = http_response.body
111
+ unless status_code == 200 || status_code == 202 || status_code == 204
112
+ error_model = JSON.load(response_content)
113
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
114
+ end
115
+
116
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
117
+ # Deserialize Response
118
+ if status_code == 200
119
+ begin
120
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
121
+ result_mapper = ProtectionContainerResource.mapper()
122
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
123
+ rescue Exception => e
124
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
125
+ end
126
+ end
127
+
128
+ result
129
+ end
130
+
131
+ promise.execute
132
+ end
133
+
134
+ end
135
+ end
@@ -0,0 +1,120 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServicesBackup
7
+ #
8
+ # Composite Swagger for Recovery Services Backup Client
9
+ #
10
+ class ProtectionContainerRefreshOperationResults
11
+ include Azure::ARM::RecoveryServicesBackup::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ProtectionContainerRefreshOperationResults class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [RecoveryServicesBackupClient] reference to the RecoveryServicesBackupClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Provides the result of the refresh operation triggered by the BeginRefresh
27
+ # operation.
28
+ #
29
+ # @param vault_name [String] The name of the Recovery Services vault.
30
+ # @param resource_group_name [String] The name of the resource group associated
31
+ # with the Recovery Services vault.
32
+ # @param fabric_name [String] The fabric name associated with the container.
33
+ # @param operation_id [String] The operation ID used for this GET operation.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ #
38
+ def get(vault_name, resource_group_name, fabric_name, operation_id, custom_headers = nil)
39
+ response = get_async(vault_name, resource_group_name, fabric_name, operation_id, custom_headers).value!
40
+ nil
41
+ end
42
+
43
+ #
44
+ # Provides the result of the refresh operation triggered by the BeginRefresh
45
+ # operation.
46
+ #
47
+ # @param vault_name [String] The name of the Recovery Services vault.
48
+ # @param resource_group_name [String] The name of the resource group associated
49
+ # with the Recovery Services vault.
50
+ # @param fabric_name [String] The fabric name associated with the container.
51
+ # @param operation_id [String] The operation ID used for this GET operation.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def get_with_http_info(vault_name, resource_group_name, fabric_name, operation_id, custom_headers = nil)
58
+ get_async(vault_name, resource_group_name, fabric_name, operation_id, custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Provides the result of the refresh operation triggered by the BeginRefresh
63
+ # operation.
64
+ #
65
+ # @param vault_name [String] The name of the Recovery Services vault.
66
+ # @param resource_group_name [String] The name of the resource group associated
67
+ # with the Recovery Services vault.
68
+ # @param fabric_name [String] The fabric name associated with the container.
69
+ # @param operation_id [String] The operation ID used for this GET operation.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def get_async(vault_name, resource_group_name, fabric_name, operation_id, custom_headers = nil)
76
+ api_version = '2016-06-01'
77
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
78
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
79
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
80
+ fail ArgumentError, 'fabric_name is nil' if fabric_name.nil?
81
+ fail ArgumentError, 'operation_id is nil' if operation_id.nil?
82
+
83
+
84
+ request_headers = {}
85
+
86
+ # Set Headers
87
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
88
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
89
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'operationId' => operation_id},
96
+ query_params: {'api-version' => api_version},
97
+ headers: request_headers.merge(custom_headers || {}),
98
+ base_url: request_url
99
+ }
100
+ promise = @client.make_request_async(:get, path_template, options)
101
+
102
+ promise = promise.then do |result|
103
+ http_response = result.response
104
+ status_code = http_response.status
105
+ response_content = http_response.body
106
+ unless status_code == 202 || status_code == 204
107
+ error_model = JSON.load(response_content)
108
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
109
+ end
110
+
111
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
112
+
113
+ result
114
+ end
115
+
116
+ promise.execute
117
+ end
118
+
119
+ end
120
+ end
@@ -0,0 +1,538 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServicesBackup
7
+ #
8
+ # Composite Swagger for Recovery Services Backup Client
9
+ #
10
+ class ProtectionContainers
11
+ include Azure::ARM::RecoveryServicesBackup::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ProtectionContainers class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [RecoveryServicesBackupClient] reference to the RecoveryServicesBackupClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets details of the specific container registered to your Recovery Services
27
+ # vault.
28
+ #
29
+ # @param vault_name [String] The name of the Recovery Services vault.
30
+ # @param resource_group_name [String] The name of the resource group associated
31
+ # with the Recovery Services vault.
32
+ # @param fabric_name [String] The fabric name associated with the container.
33
+ # @param container_name [String] The container name used for this GET
34
+ # operation.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [ProtectionContainerResource] operation results.
39
+ #
40
+ def get(vault_name, resource_group_name, fabric_name, container_name, custom_headers = nil)
41
+ response = get_async(vault_name, resource_group_name, fabric_name, container_name, custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # Gets details of the specific container registered to your Recovery Services
47
+ # vault.
48
+ #
49
+ # @param vault_name [String] The name of the Recovery Services vault.
50
+ # @param resource_group_name [String] The name of the resource group associated
51
+ # with the Recovery Services vault.
52
+ # @param fabric_name [String] The fabric name associated with the container.
53
+ # @param container_name [String] The container name used for this GET
54
+ # operation.
55
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
56
+ # will be added to the HTTP request.
57
+ #
58
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
59
+ #
60
+ def get_with_http_info(vault_name, resource_group_name, fabric_name, container_name, custom_headers = nil)
61
+ get_async(vault_name, resource_group_name, fabric_name, container_name, custom_headers).value!
62
+ end
63
+
64
+ #
65
+ # Gets details of the specific container registered to your Recovery Services
66
+ # vault.
67
+ #
68
+ # @param vault_name [String] The name of the Recovery Services vault.
69
+ # @param resource_group_name [String] The name of the resource group associated
70
+ # with the Recovery Services vault.
71
+ # @param fabric_name [String] The fabric name associated with the container.
72
+ # @param container_name [String] The container name used for this GET
73
+ # operation.
74
+ # @param [Hash{String => String}] A hash of custom headers that will be added
75
+ # to the HTTP request.
76
+ #
77
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
78
+ #
79
+ def get_async(vault_name, resource_group_name, fabric_name, container_name, custom_headers = nil)
80
+ api_version = '2016-06-01'
81
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
82
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
83
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
84
+ fail ArgumentError, 'fabric_name is nil' if fabric_name.nil?
85
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
86
+
87
+
88
+ request_headers = {}
89
+
90
+ # Set Headers
91
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
92
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
93
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}'
94
+
95
+ request_url = @base_url || @client.base_url
96
+
97
+ options = {
98
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
99
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'containerName' => container_name},
100
+ query_params: {'api-version' => api_version},
101
+ headers: request_headers.merge(custom_headers || {}),
102
+ base_url: request_url
103
+ }
104
+ promise = @client.make_request_async(:get, path_template, options)
105
+
106
+ promise = promise.then do |result|
107
+ http_response = result.response
108
+ status_code = http_response.status
109
+ response_content = http_response.body
110
+ unless status_code == 200
111
+ error_model = JSON.load(response_content)
112
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
113
+ end
114
+
115
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
116
+ # Deserialize Response
117
+ if status_code == 200
118
+ begin
119
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
120
+ result_mapper = ProtectionContainerResource.mapper()
121
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
122
+ rescue Exception => e
123
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
124
+ end
125
+ end
126
+
127
+ result
128
+ end
129
+
130
+ promise.execute
131
+ end
132
+
133
+ #
134
+ # Lists the containers registered to the Recovery Services vault.
135
+ #
136
+ # @param vault_name [String] The name of the Recovery Services vault.
137
+ # @param resource_group_name [String] The name of the resource group associated
138
+ # with the Recovery Services vault.
139
+ # @param filter [String] The following equation is used to sort or filter the
140
+ # containers registered to the vault. providerType eq {AzureIaasVM, MAB, DPM,
141
+ # AzureBackupServer, AzureSql} and status eq {Unknown, NotRegistered,
142
+ # Registered, Registering} and friendlyName eq {containername} and
143
+ # backupManagementType eq {AzureIaasVM, MAB, DPM, AzureBackupServer, AzureSql}.
144
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
145
+ # will be added to the HTTP request.
146
+ #
147
+ # @return [Array<ProtectionContainerResource>] operation results.
148
+ #
149
+ def list(vault_name, resource_group_name, filter = nil, custom_headers = nil)
150
+ first_page = list_as_lazy(vault_name, resource_group_name, filter, custom_headers)
151
+ first_page.get_all_items
152
+ end
153
+
154
+ #
155
+ # Lists the containers registered to the Recovery Services vault.
156
+ #
157
+ # @param vault_name [String] The name of the Recovery Services vault.
158
+ # @param resource_group_name [String] The name of the resource group associated
159
+ # with the Recovery Services vault.
160
+ # @param filter [String] The following equation is used to sort or filter the
161
+ # containers registered to the vault. providerType eq {AzureIaasVM, MAB, DPM,
162
+ # AzureBackupServer, AzureSql} and status eq {Unknown, NotRegistered,
163
+ # Registered, Registering} and friendlyName eq {containername} and
164
+ # backupManagementType eq {AzureIaasVM, MAB, DPM, AzureBackupServer, AzureSql}.
165
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
166
+ # will be added to the HTTP request.
167
+ #
168
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
169
+ #
170
+ def list_with_http_info(vault_name, resource_group_name, filter = nil, custom_headers = nil)
171
+ list_async(vault_name, resource_group_name, filter, custom_headers).value!
172
+ end
173
+
174
+ #
175
+ # Lists the containers registered to the Recovery Services vault.
176
+ #
177
+ # @param vault_name [String] The name of the Recovery Services vault.
178
+ # @param resource_group_name [String] The name of the resource group associated
179
+ # with the Recovery Services vault.
180
+ # @param filter [String] The following equation is used to sort or filter the
181
+ # containers registered to the vault. providerType eq {AzureIaasVM, MAB, DPM,
182
+ # AzureBackupServer, AzureSql} and status eq {Unknown, NotRegistered,
183
+ # Registered, Registering} and friendlyName eq {containername} and
184
+ # backupManagementType eq {AzureIaasVM, MAB, DPM, AzureBackupServer, AzureSql}.
185
+ # @param [Hash{String => String}] A hash of custom headers that will be added
186
+ # to the HTTP request.
187
+ #
188
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
189
+ #
190
+ def list_async(vault_name, resource_group_name, filter = nil, custom_headers = nil)
191
+ api_version = '2016-06-01'
192
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
193
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
194
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
195
+
196
+
197
+ request_headers = {}
198
+
199
+ # Set Headers
200
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
201
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
202
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers'
203
+
204
+ request_url = @base_url || @client.base_url
205
+
206
+ options = {
207
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
208
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
209
+ query_params: {'api-version' => api_version,'$filter' => filter},
210
+ headers: request_headers.merge(custom_headers || {}),
211
+ base_url: request_url
212
+ }
213
+ promise = @client.make_request_async(:get, path_template, options)
214
+
215
+ promise = promise.then do |result|
216
+ http_response = result.response
217
+ status_code = http_response.status
218
+ response_content = http_response.body
219
+ unless status_code == 200
220
+ error_model = JSON.load(response_content)
221
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
222
+ end
223
+
224
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
225
+ # Deserialize Response
226
+ if status_code == 200
227
+ begin
228
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
229
+ result_mapper = ProtectionContainerResourceList.mapper()
230
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
231
+ rescue Exception => e
232
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
233
+ end
234
+ end
235
+
236
+ result
237
+ end
238
+
239
+ promise.execute
240
+ end
241
+
242
+ #
243
+ # Discovers the containers in the subscription that can be protected in a
244
+ # Recovery Services vault. This is an asynchronous operation. To learn the
245
+ # status of the operation, use the GetRefreshOperationResult API.
246
+ #
247
+ # @param vault_name [String] The name of the Recovery Services vault.
248
+ # @param resource_group_name [String] The name of the resource group associated
249
+ # with the Recovery Services vault.
250
+ # @param fabric_name [String] The fabric name associated with the container.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ #
255
+ def refresh(vault_name, resource_group_name, fabric_name, custom_headers = nil)
256
+ response = refresh_async(vault_name, resource_group_name, fabric_name, custom_headers).value!
257
+ nil
258
+ end
259
+
260
+ #
261
+ # Discovers the containers in the subscription that can be protected in a
262
+ # Recovery Services vault. This is an asynchronous operation. To learn the
263
+ # status of the operation, use the GetRefreshOperationResult API.
264
+ #
265
+ # @param vault_name [String] The name of the Recovery Services vault.
266
+ # @param resource_group_name [String] The name of the resource group associated
267
+ # with the Recovery Services vault.
268
+ # @param fabric_name [String] The fabric name associated with the container.
269
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
270
+ # will be added to the HTTP request.
271
+ #
272
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
273
+ #
274
+ def refresh_with_http_info(vault_name, resource_group_name, fabric_name, custom_headers = nil)
275
+ refresh_async(vault_name, resource_group_name, fabric_name, custom_headers).value!
276
+ end
277
+
278
+ #
279
+ # Discovers the containers in the subscription that can be protected in a
280
+ # Recovery Services vault. This is an asynchronous operation. To learn the
281
+ # status of the operation, use the GetRefreshOperationResult API.
282
+ #
283
+ # @param vault_name [String] The name of the Recovery Services vault.
284
+ # @param resource_group_name [String] The name of the resource group associated
285
+ # with the Recovery Services vault.
286
+ # @param fabric_name [String] The fabric name associated with the container.
287
+ # @param [Hash{String => String}] A hash of custom headers that will be added
288
+ # to the HTTP request.
289
+ #
290
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
291
+ #
292
+ def refresh_async(vault_name, resource_group_name, fabric_name, custom_headers = nil)
293
+ api_version = '2016-06-01'
294
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
295
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
296
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
297
+ fail ArgumentError, 'fabric_name is nil' if fabric_name.nil?
298
+
299
+
300
+ request_headers = {}
301
+
302
+ # Set Headers
303
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
304
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
305
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers'
306
+
307
+ request_url = @base_url || @client.base_url
308
+
309
+ options = {
310
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
311
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name},
312
+ query_params: {'api-version' => api_version},
313
+ headers: request_headers.merge(custom_headers || {}),
314
+ base_url: request_url
315
+ }
316
+ promise = @client.make_request_async(:post, path_template, options)
317
+
318
+ promise = promise.then do |result|
319
+ http_response = result.response
320
+ status_code = http_response.status
321
+ response_content = http_response.body
322
+ unless status_code == 202
323
+ error_model = JSON.load(response_content)
324
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
325
+ end
326
+
327
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
328
+
329
+ result
330
+ end
331
+
332
+ promise.execute
333
+ end
334
+
335
+ #
336
+ # Unregisters the given container from your Recovery Services vault.
337
+ #
338
+ # @param resource_group_name [String] The name of the resource group associated
339
+ # with the Recovery Services vault.
340
+ # @param vault_name [String] The name of the Recovery Services vault.
341
+ # @param identity_name [String] Name of the protection container to unregister.
342
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
343
+ # will be added to the HTTP request.
344
+ #
345
+ #
346
+ def unregister(resource_group_name, vault_name, identity_name, custom_headers = nil)
347
+ response = unregister_async(resource_group_name, vault_name, identity_name, custom_headers).value!
348
+ nil
349
+ end
350
+
351
+ #
352
+ # Unregisters the given container from your Recovery Services vault.
353
+ #
354
+ # @param resource_group_name [String] The name of the resource group associated
355
+ # with the Recovery Services vault.
356
+ # @param vault_name [String] The name of the Recovery Services vault.
357
+ # @param identity_name [String] Name of the protection container to unregister.
358
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
359
+ # will be added to the HTTP request.
360
+ #
361
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
362
+ #
363
+ def unregister_with_http_info(resource_group_name, vault_name, identity_name, custom_headers = nil)
364
+ unregister_async(resource_group_name, vault_name, identity_name, custom_headers).value!
365
+ end
366
+
367
+ #
368
+ # Unregisters the given container from your Recovery Services vault.
369
+ #
370
+ # @param resource_group_name [String] The name of the resource group associated
371
+ # with the Recovery Services vault.
372
+ # @param vault_name [String] The name of the Recovery Services vault.
373
+ # @param identity_name [String] Name of the protection container to unregister.
374
+ # @param [Hash{String => String}] A hash of custom headers that will be added
375
+ # to the HTTP request.
376
+ #
377
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
378
+ #
379
+ def unregister_async(resource_group_name, vault_name, identity_name, custom_headers = nil)
380
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
381
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
382
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
383
+ api_version = '2016-06-01'
384
+ fail ArgumentError, 'identity_name is nil' if identity_name.nil?
385
+
386
+
387
+ request_headers = {}
388
+
389
+ # Set Headers
390
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
391
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
392
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/registeredIdentities/{identityName}'
393
+
394
+ request_url = @base_url || @client.base_url
395
+
396
+ options = {
397
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
398
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'vaultName' => vault_name,'identityName' => identity_name},
399
+ query_params: {'api-version' => api_version},
400
+ headers: request_headers.merge(custom_headers || {}),
401
+ base_url: request_url
402
+ }
403
+ promise = @client.make_request_async(:delete, path_template, options)
404
+
405
+ promise = promise.then do |result|
406
+ http_response = result.response
407
+ status_code = http_response.status
408
+ response_content = http_response.body
409
+ unless status_code == 204
410
+ error_model = JSON.load(response_content)
411
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
412
+ end
413
+
414
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
415
+
416
+ result
417
+ end
418
+
419
+ promise.execute
420
+ end
421
+
422
+ #
423
+ # Lists the containers registered to the Recovery Services vault.
424
+ #
425
+ # @param next_page_link [String] The NextLink from the previous successful call
426
+ # to List operation.
427
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
428
+ # will be added to the HTTP request.
429
+ #
430
+ # @return [ProtectionContainerResourceList] operation results.
431
+ #
432
+ def list_next(next_page_link, custom_headers = nil)
433
+ response = list_next_async(next_page_link, custom_headers).value!
434
+ response.body unless response.nil?
435
+ end
436
+
437
+ #
438
+ # Lists the containers registered to the Recovery Services vault.
439
+ #
440
+ # @param next_page_link [String] The NextLink from the previous successful call
441
+ # to List operation.
442
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
443
+ # will be added to the HTTP request.
444
+ #
445
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
446
+ #
447
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
448
+ list_next_async(next_page_link, custom_headers).value!
449
+ end
450
+
451
+ #
452
+ # Lists the containers registered to the Recovery Services vault.
453
+ #
454
+ # @param next_page_link [String] The NextLink from the previous successful call
455
+ # to List operation.
456
+ # @param [Hash{String => String}] A hash of custom headers that will be added
457
+ # to the HTTP request.
458
+ #
459
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
460
+ #
461
+ def list_next_async(next_page_link, custom_headers = nil)
462
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
463
+
464
+
465
+ request_headers = {}
466
+
467
+ # Set Headers
468
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
469
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
470
+ path_template = '{nextLink}'
471
+
472
+ request_url = @base_url || @client.base_url
473
+
474
+ options = {
475
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
476
+ skip_encoding_path_params: {'nextLink' => next_page_link},
477
+ headers: request_headers.merge(custom_headers || {}),
478
+ base_url: request_url
479
+ }
480
+ promise = @client.make_request_async(:get, path_template, options)
481
+
482
+ promise = promise.then do |result|
483
+ http_response = result.response
484
+ status_code = http_response.status
485
+ response_content = http_response.body
486
+ unless status_code == 200
487
+ error_model = JSON.load(response_content)
488
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
489
+ end
490
+
491
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
492
+ # Deserialize Response
493
+ if status_code == 200
494
+ begin
495
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
496
+ result_mapper = ProtectionContainerResourceList.mapper()
497
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
498
+ rescue Exception => e
499
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
500
+ end
501
+ end
502
+
503
+ result
504
+ end
505
+
506
+ promise.execute
507
+ end
508
+
509
+ #
510
+ # Lists the containers registered to the Recovery Services vault.
511
+ #
512
+ # @param vault_name [String] The name of the Recovery Services vault.
513
+ # @param resource_group_name [String] The name of the resource group associated
514
+ # with the Recovery Services vault.
515
+ # @param filter [String] The following equation is used to sort or filter the
516
+ # containers registered to the vault. providerType eq {AzureIaasVM, MAB, DPM,
517
+ # AzureBackupServer, AzureSql} and status eq {Unknown, NotRegistered,
518
+ # Registered, Registering} and friendlyName eq {containername} and
519
+ # backupManagementType eq {AzureIaasVM, MAB, DPM, AzureBackupServer, AzureSql}.
520
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
521
+ # will be added to the HTTP request.
522
+ #
523
+ # @return [ProtectionContainerResourceList] which provide lazy access to pages
524
+ # of the response.
525
+ #
526
+ def list_as_lazy(vault_name, resource_group_name, filter = nil, custom_headers = nil)
527
+ response = list_async(vault_name, resource_group_name, filter, custom_headers).value!
528
+ unless response.nil?
529
+ page = response.body
530
+ page.next_method = Proc.new do |next_page_link|
531
+ list_next_async(next_page_link, custom_headers)
532
+ end
533
+ page
534
+ end
535
+ end
536
+
537
+ end
538
+ end