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,142 @@
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 ProtectedItemOperationResults
11
+ include Azure::ARM::RecoveryServicesBackup::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ProtectedItemOperationResults 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 backup item.
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 backup item.
32
+ # @param container_name [String] The container name associated with the backup
33
+ # item.
34
+ # @param protected_item_name [String] The name of backup item used in this GET
35
+ # operation.
36
+ # @param operation_id [String] The OperationID used in this GET operation.
37
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
38
+ # will be added to the HTTP request.
39
+ #
40
+ # @return [ProtectedItemResource] operation results.
41
+ #
42
+ def get(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers = nil)
43
+ response = get_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers).value!
44
+ response.body unless response.nil?
45
+ end
46
+
47
+ #
48
+ # Gets the result of any operation on the backup item.
49
+ #
50
+ # @param vault_name [String] The name of the Recovery Services vault.
51
+ # @param resource_group_name [String] The name of the resource group associated
52
+ # with the Recovery Services vault.
53
+ # @param fabric_name [String] The fabric name associated with the backup item.
54
+ # @param container_name [String] The container name associated with the backup
55
+ # item.
56
+ # @param protected_item_name [String] The name of backup item used in this GET
57
+ # operation.
58
+ # @param operation_id [String] The OperationID used in this GET operation.
59
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
60
+ # will be added to the HTTP request.
61
+ #
62
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
63
+ #
64
+ def get_with_http_info(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers = nil)
65
+ get_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers).value!
66
+ end
67
+
68
+ #
69
+ # Gets the result of any operation on the backup item.
70
+ #
71
+ # @param vault_name [String] The name of the Recovery Services vault.
72
+ # @param resource_group_name [String] The name of the resource group associated
73
+ # with the Recovery Services vault.
74
+ # @param fabric_name [String] The fabric name associated with the backup item.
75
+ # @param container_name [String] The container name associated with the backup
76
+ # item.
77
+ # @param protected_item_name [String] The name of backup item used in this GET
78
+ # operation.
79
+ # @param operation_id [String] The OperationID used in this GET operation.
80
+ # @param [Hash{String => String}] A hash of custom headers that will be added
81
+ # to the HTTP request.
82
+ #
83
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
84
+ #
85
+ def get_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers = nil)
86
+ api_version = '2016-06-01'
87
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
88
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
89
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
90
+ fail ArgumentError, 'fabric_name is nil' if fabric_name.nil?
91
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
92
+ fail ArgumentError, 'protected_item_name is nil' if protected_item_name.nil?
93
+ fail ArgumentError, 'operation_id is nil' if operation_id.nil?
94
+
95
+
96
+ request_headers = {}
97
+
98
+ # Set Headers
99
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
100
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
101
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}'
102
+
103
+ request_url = @base_url || @client.base_url
104
+
105
+ options = {
106
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
107
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'containerName' => container_name,'protectedItemName' => protected_item_name,'operationId' => operation_id},
108
+ query_params: {'api-version' => api_version},
109
+ headers: request_headers.merge(custom_headers || {}),
110
+ base_url: request_url
111
+ }
112
+ promise = @client.make_request_async(:get, path_template, options)
113
+
114
+ promise = promise.then do |result|
115
+ http_response = result.response
116
+ status_code = http_response.status
117
+ response_content = http_response.body
118
+ unless status_code == 200 || status_code == 202 || status_code == 204
119
+ error_model = JSON.load(response_content)
120
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
121
+ end
122
+
123
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
124
+ # Deserialize Response
125
+ if status_code == 200
126
+ begin
127
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
128
+ result_mapper = ProtectedItemResource.mapper()
129
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
130
+ rescue Exception => e
131
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
132
+ end
133
+ end
134
+
135
+ result
136
+ end
137
+
138
+ promise.execute
139
+ end
140
+
141
+ end
142
+ end
@@ -0,0 +1,154 @@
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 ProtectedItemOperationStatuses
11
+ include Azure::ARM::RecoveryServicesBackup::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ProtectedItemOperationStatuses 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 status of an operation such as triggering a backup or restore. The
27
+ # status can be: In progress, Completed, or Failed. You can refer to the
28
+ # OperationStatus enum for all the possible states of the operation. Some
29
+ # operations create jobs. This method returns the list of jobs associated with
30
+ # the operation.
31
+ #
32
+ # @param vault_name [String] The name of the Recovery Services vault.
33
+ # @param resource_group_name [String] The name of the resource group associated
34
+ # with the Recovery Services vault.
35
+ # @param fabric_name [String] The fabric name associated with the backup item.
36
+ # @param container_name [String] The container name associated with the backup
37
+ # item.
38
+ # @param protected_item_name [String] The name of backup item used in this GET
39
+ # operation.
40
+ # @param operation_id [String] The OperationID used in this GET operation.
41
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
42
+ # will be added to the HTTP request.
43
+ #
44
+ # @return [OperationStatus] operation results.
45
+ #
46
+ def get(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers = nil)
47
+ response = get_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers).value!
48
+ response.body unless response.nil?
49
+ end
50
+
51
+ #
52
+ # Gets the status of an operation such as triggering a backup or restore. The
53
+ # status can be: In progress, Completed, or Failed. You can refer to the
54
+ # OperationStatus enum for all the possible states of the operation. Some
55
+ # operations create jobs. This method returns the list of jobs associated with
56
+ # the operation.
57
+ #
58
+ # @param vault_name [String] The name of the Recovery Services vault.
59
+ # @param resource_group_name [String] The name of the resource group associated
60
+ # with the Recovery Services vault.
61
+ # @param fabric_name [String] The fabric name associated with the backup item.
62
+ # @param container_name [String] The container name associated with the backup
63
+ # item.
64
+ # @param protected_item_name [String] The name of backup item used in this GET
65
+ # operation.
66
+ # @param operation_id [String] The OperationID used in this GET operation.
67
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
68
+ # will be added to the HTTP request.
69
+ #
70
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
71
+ #
72
+ def get_with_http_info(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers = nil)
73
+ get_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers).value!
74
+ end
75
+
76
+ #
77
+ # Gets the status of an operation such as triggering a backup or restore. The
78
+ # status can be: In progress, Completed, or Failed. You can refer to the
79
+ # OperationStatus enum for all the possible states of the operation. Some
80
+ # operations create jobs. This method returns the list of jobs associated with
81
+ # the operation.
82
+ #
83
+ # @param vault_name [String] The name of the Recovery Services vault.
84
+ # @param resource_group_name [String] The name of the resource group associated
85
+ # with the Recovery Services vault.
86
+ # @param fabric_name [String] The fabric name associated with the backup item.
87
+ # @param container_name [String] The container name associated with the backup
88
+ # item.
89
+ # @param protected_item_name [String] The name of backup item used in this GET
90
+ # operation.
91
+ # @param operation_id [String] The OperationID used in this GET operation.
92
+ # @param [Hash{String => String}] A hash of custom headers that will be added
93
+ # to the HTTP request.
94
+ #
95
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
96
+ #
97
+ def get_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, operation_id, custom_headers = nil)
98
+ api_version = '2016-06-01'
99
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
100
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
101
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
102
+ fail ArgumentError, 'fabric_name is nil' if fabric_name.nil?
103
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
104
+ fail ArgumentError, 'protected_item_name is nil' if protected_item_name.nil?
105
+ fail ArgumentError, 'operation_id is nil' if operation_id.nil?
106
+
107
+
108
+ request_headers = {}
109
+
110
+ # Set Headers
111
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
112
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
113
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}'
114
+
115
+ request_url = @base_url || @client.base_url
116
+
117
+ options = {
118
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
119
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'containerName' => container_name,'protectedItemName' => protected_item_name,'operationId' => operation_id},
120
+ query_params: {'api-version' => api_version},
121
+ headers: request_headers.merge(custom_headers || {}),
122
+ base_url: request_url
123
+ }
124
+ promise = @client.make_request_async(:get, path_template, options)
125
+
126
+ promise = promise.then do |result|
127
+ http_response = result.response
128
+ status_code = http_response.status
129
+ response_content = http_response.body
130
+ unless status_code == 200
131
+ error_model = JSON.load(response_content)
132
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
133
+ end
134
+
135
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
136
+ # Deserialize Response
137
+ if status_code == 200
138
+ begin
139
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
140
+ result_mapper = OperationStatus.mapper()
141
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
142
+ rescue Exception => e
143
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
144
+ end
145
+ end
146
+
147
+ result
148
+ end
149
+
150
+ promise.execute
151
+ end
152
+
153
+ end
154
+ end
@@ -0,0 +1,609 @@
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 ProtectedItems
11
+ include Azure::ARM::RecoveryServicesBackup::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ProtectedItems 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 a pageable list of all items in a subscription, that can be
27
+ # protected.
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 filter [String] itemType eq { VM , FileFolder , AzureSqlDb , SQLDB ,
33
+ # Exchange , Sharepoint , DPMUnknown } and providerType eq { AzureIaasVM, MAB,
34
+ # DPM, AzureBackupServer, AzureSql } and policyName eq {policyname} and
35
+ # containerName eq {containername} and backupManagementType eq { AzureIaasVM,
36
+ # MAB, DPM, AzureBackupServer, AzureSql }.
37
+ # @param skip_token [String] The Skip Token filter.
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ # @return [Array<ProtectedItemResource>] operation results.
42
+ #
43
+ def list(vault_name, resource_group_name, filter = nil, skip_token = nil, custom_headers = nil)
44
+ first_page = list_as_lazy(vault_name, resource_group_name, filter, skip_token, custom_headers)
45
+ first_page.get_all_items
46
+ end
47
+
48
+ #
49
+ # Provides a pageable list of all items in a subscription, that can be
50
+ # protected.
51
+ #
52
+ # @param vault_name [String] The name of the Recovery Services vault.
53
+ # @param resource_group_name [String] The name of the resource group associated
54
+ # with the Recovery Services vault.
55
+ # @param filter [String] itemType eq { VM , FileFolder , AzureSqlDb , SQLDB ,
56
+ # Exchange , Sharepoint , DPMUnknown } and providerType eq { AzureIaasVM, MAB,
57
+ # DPM, AzureBackupServer, AzureSql } and policyName eq {policyname} and
58
+ # containerName eq {containername} and backupManagementType eq { AzureIaasVM,
59
+ # MAB, DPM, AzureBackupServer, AzureSql }.
60
+ # @param skip_token [String] The Skip Token filter.
61
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
62
+ # will be added to the HTTP request.
63
+ #
64
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
65
+ #
66
+ def list_with_http_info(vault_name, resource_group_name, filter = nil, skip_token = nil, custom_headers = nil)
67
+ list_async(vault_name, resource_group_name, filter, skip_token, custom_headers).value!
68
+ end
69
+
70
+ #
71
+ # Provides a pageable list of all items in a subscription, that can be
72
+ # protected.
73
+ #
74
+ # @param vault_name [String] The name of the Recovery Services vault.
75
+ # @param resource_group_name [String] The name of the resource group associated
76
+ # with the Recovery Services vault.
77
+ # @param filter [String] itemType eq { VM , FileFolder , AzureSqlDb , SQLDB ,
78
+ # Exchange , Sharepoint , DPMUnknown } and providerType eq { AzureIaasVM, MAB,
79
+ # DPM, AzureBackupServer, AzureSql } and policyName eq {policyname} and
80
+ # containerName eq {containername} and backupManagementType eq { AzureIaasVM,
81
+ # MAB, DPM, AzureBackupServer, AzureSql }.
82
+ # @param skip_token [String] The Skip Token filter.
83
+ # @param [Hash{String => String}] A hash of custom headers that will be added
84
+ # to the HTTP request.
85
+ #
86
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
87
+ #
88
+ def list_async(vault_name, resource_group_name, filter = nil, skip_token = nil, custom_headers = nil)
89
+ api_version = '2016-06-01'
90
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
91
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
92
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
93
+
94
+
95
+ request_headers = {}
96
+
97
+ # Set Headers
98
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
99
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
100
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems'
101
+
102
+ request_url = @base_url || @client.base_url
103
+
104
+ options = {
105
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
106
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
107
+ query_params: {'api-version' => api_version,'$filter' => filter,'$skipToken' => skip_token},
108
+ headers: request_headers.merge(custom_headers || {}),
109
+ base_url: request_url
110
+ }
111
+ promise = @client.make_request_async(:get, path_template, options)
112
+
113
+ promise = promise.then do |result|
114
+ http_response = result.response
115
+ status_code = http_response.status
116
+ response_content = http_response.body
117
+ unless status_code == 200
118
+ error_model = JSON.load(response_content)
119
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
120
+ end
121
+
122
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
123
+ # Deserialize Response
124
+ if status_code == 200
125
+ begin
126
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
127
+ result_mapper = ProtectedItemResourceList.mapper()
128
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
129
+ rescue Exception => e
130
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
131
+ end
132
+ end
133
+
134
+ result
135
+ end
136
+
137
+ promise.execute
138
+ end
139
+
140
+ #
141
+ # Provides the details of the backup item. This is an asynchronous operation.
142
+ # To know the status of the operation, call the GetItemOperationResult API.
143
+ #
144
+ # @param vault_name [String] The name of the Recovery Services vault.
145
+ # @param resource_group_name [String] The name of the resource group associated
146
+ # with the Recovery Services vault.
147
+ # @param fabric_name [String] The fabric name associated with the backup item.
148
+ # @param container_name [String] The container name associated with the backup
149
+ # item.
150
+ # @param protected_item_name [String] The backup item name used in this GET
151
+ # operation.
152
+ # @param filter [String] expand eq {extendedinfo}. This filter enables you to
153
+ # choose (or filter) specific items in the list of backup items.
154
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
155
+ # will be added to the HTTP request.
156
+ #
157
+ # @return [ProtectedItemResource] operation results.
158
+ #
159
+ def get(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, filter = nil, custom_headers = nil)
160
+ response = get_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, filter, custom_headers).value!
161
+ response.body unless response.nil?
162
+ end
163
+
164
+ #
165
+ # Provides the details of the backup item. This is an asynchronous operation.
166
+ # To know the status of the operation, call the GetItemOperationResult API.
167
+ #
168
+ # @param vault_name [String] The name of the Recovery Services vault.
169
+ # @param resource_group_name [String] The name of the resource group associated
170
+ # with the Recovery Services vault.
171
+ # @param fabric_name [String] The fabric name associated with the backup item.
172
+ # @param container_name [String] The container name associated with the backup
173
+ # item.
174
+ # @param protected_item_name [String] The backup item name used in this GET
175
+ # operation.
176
+ # @param filter [String] expand eq {extendedinfo}. This filter enables you to
177
+ # choose (or filter) specific items in the list of backup items.
178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
179
+ # will be added to the HTTP request.
180
+ #
181
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
182
+ #
183
+ def get_with_http_info(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, filter = nil, custom_headers = nil)
184
+ get_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, filter, custom_headers).value!
185
+ end
186
+
187
+ #
188
+ # Provides the details of the backup item. This is an asynchronous operation.
189
+ # To know the status of the operation, call the GetItemOperationResult API.
190
+ #
191
+ # @param vault_name [String] The name of the Recovery Services vault.
192
+ # @param resource_group_name [String] The name of the resource group associated
193
+ # with the Recovery Services vault.
194
+ # @param fabric_name [String] The fabric name associated with the backup item.
195
+ # @param container_name [String] The container name associated with the backup
196
+ # item.
197
+ # @param protected_item_name [String] The backup item name used in this GET
198
+ # operation.
199
+ # @param filter [String] expand eq {extendedinfo}. This filter enables you to
200
+ # choose (or filter) specific items in the list of backup items.
201
+ # @param [Hash{String => String}] A hash of custom headers that will be added
202
+ # to the HTTP request.
203
+ #
204
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
205
+ #
206
+ def get_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, filter = nil, custom_headers = nil)
207
+ api_version = '2016-06-01'
208
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
209
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
210
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
211
+ fail ArgumentError, 'fabric_name is nil' if fabric_name.nil?
212
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
213
+ fail ArgumentError, 'protected_item_name is nil' if protected_item_name.nil?
214
+
215
+
216
+ request_headers = {}
217
+
218
+ # Set Headers
219
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
220
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
221
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}'
222
+
223
+ request_url = @base_url || @client.base_url
224
+
225
+ options = {
226
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
227
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'containerName' => container_name,'protectedItemName' => protected_item_name},
228
+ query_params: {'api-version' => api_version,'$filter' => filter},
229
+ headers: request_headers.merge(custom_headers || {}),
230
+ base_url: request_url
231
+ }
232
+ promise = @client.make_request_async(:get, path_template, options)
233
+
234
+ promise = promise.then do |result|
235
+ http_response = result.response
236
+ status_code = http_response.status
237
+ response_content = http_response.body
238
+ unless status_code == 200
239
+ error_model = JSON.load(response_content)
240
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
241
+ end
242
+
243
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
244
+ # Deserialize Response
245
+ if status_code == 200
246
+ begin
247
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
248
+ result_mapper = ProtectedItemResource.mapper()
249
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
250
+ rescue Exception => e
251
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
252
+ end
253
+ end
254
+
255
+ result
256
+ end
257
+
258
+ promise.execute
259
+ end
260
+
261
+ #
262
+ # This operation enables an item to be backed up, or modifies the existing
263
+ # backup policy information for an item that has been backed up. This is an
264
+ # asynchronous operation. To learn the status of the operation, call the
265
+ # GetItemOperationResult API.
266
+ #
267
+ # @param vault_name [String] The name of the Recovery Services vault.
268
+ # @param resource_group_name [String] The name of the resource group associated
269
+ # with the Recovery Services vault.
270
+ # @param fabric_name [String] The fabric name associated with the backup item.
271
+ # @param container_name [String] The container name associated with the backup
272
+ # item.
273
+ # @param protected_item_name [String] The name of the backup item.
274
+ # @param resource_protected_item [ProtectedItemResource] The resource backup
275
+ # item.
276
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
277
+ # will be added to the HTTP request.
278
+ #
279
+ #
280
+ def create_or_update(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, resource_protected_item, custom_headers = nil)
281
+ response = create_or_update_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, resource_protected_item, custom_headers).value!
282
+ nil
283
+ end
284
+
285
+ #
286
+ # This operation enables an item to be backed up, or modifies the existing
287
+ # backup policy information for an item that has been backed up. This is an
288
+ # asynchronous operation. To learn the status of the operation, call the
289
+ # GetItemOperationResult API.
290
+ #
291
+ # @param vault_name [String] The name of the Recovery Services vault.
292
+ # @param resource_group_name [String] The name of the resource group associated
293
+ # with the Recovery Services vault.
294
+ # @param fabric_name [String] The fabric name associated with the backup item.
295
+ # @param container_name [String] The container name associated with the backup
296
+ # item.
297
+ # @param protected_item_name [String] The name of the backup item.
298
+ # @param resource_protected_item [ProtectedItemResource] The resource backup
299
+ # item.
300
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
301
+ # will be added to the HTTP request.
302
+ #
303
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
304
+ #
305
+ def create_or_update_with_http_info(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, resource_protected_item, custom_headers = nil)
306
+ create_or_update_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, resource_protected_item, custom_headers).value!
307
+ end
308
+
309
+ #
310
+ # This operation enables an item to be backed up, or modifies the existing
311
+ # backup policy information for an item that has been backed up. This is an
312
+ # asynchronous operation. To learn the status of the operation, call the
313
+ # GetItemOperationResult API.
314
+ #
315
+ # @param vault_name [String] The name of the Recovery Services vault.
316
+ # @param resource_group_name [String] The name of the resource group associated
317
+ # with the Recovery Services vault.
318
+ # @param fabric_name [String] The fabric name associated with the backup item.
319
+ # @param container_name [String] The container name associated with the backup
320
+ # item.
321
+ # @param protected_item_name [String] The name of the backup item.
322
+ # @param resource_protected_item [ProtectedItemResource] The resource backup
323
+ # item.
324
+ # @param [Hash{String => String}] A hash of custom headers that will be added
325
+ # to the HTTP request.
326
+ #
327
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
328
+ #
329
+ def create_or_update_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, resource_protected_item, custom_headers = nil)
330
+ api_version = '2016-06-01'
331
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
332
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
333
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
334
+ fail ArgumentError, 'fabric_name is nil' if fabric_name.nil?
335
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
336
+ fail ArgumentError, 'protected_item_name is nil' if protected_item_name.nil?
337
+ fail ArgumentError, 'resource_protected_item is nil' if resource_protected_item.nil?
338
+
339
+
340
+ request_headers = {}
341
+
342
+ # Set Headers
343
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
344
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
345
+
346
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
347
+
348
+ # Serialize Request
349
+ request_mapper = ProtectedItemResource.mapper()
350
+ request_content = @client.serialize(request_mapper, resource_protected_item, 'resource_protected_item')
351
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
352
+
353
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}'
354
+
355
+ request_url = @base_url || @client.base_url
356
+
357
+ options = {
358
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
359
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'containerName' => container_name,'protectedItemName' => protected_item_name},
360
+ query_params: {'api-version' => api_version},
361
+ body: request_content,
362
+ headers: request_headers.merge(custom_headers || {}),
363
+ base_url: request_url
364
+ }
365
+ promise = @client.make_request_async(:put, path_template, options)
366
+
367
+ promise = promise.then do |result|
368
+ http_response = result.response
369
+ status_code = http_response.status
370
+ response_content = http_response.body
371
+ unless status_code == 202
372
+ error_model = JSON.load(response_content)
373
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
374
+ end
375
+
376
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
377
+
378
+ result
379
+ end
380
+
381
+ promise.execute
382
+ end
383
+
384
+ #
385
+ # Used to disable the backup job for an item within a container. This is an
386
+ # asynchronous operation. To learn the status of the request, call the
387
+ # GetItemOperationResult API.
388
+ #
389
+ # @param vault_name [String] The name of the Recovery Services vault.
390
+ # @param resource_group_name [String] The name of the resource group associated
391
+ # with the Recovery Services vault.
392
+ # @param fabric_name [String] The fabric name associated with the backup item.
393
+ # @param container_name [String] The container name associated with the backup
394
+ # item.
395
+ # @param protected_item_name [String] The backup item to be deleted.
396
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
397
+ # will be added to the HTTP request.
398
+ #
399
+ #
400
+ def delete(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, custom_headers = nil)
401
+ response = delete_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, custom_headers).value!
402
+ nil
403
+ end
404
+
405
+ #
406
+ # Used to disable the backup job for an item within a container. This is an
407
+ # asynchronous operation. To learn the status of the request, call the
408
+ # GetItemOperationResult API.
409
+ #
410
+ # @param vault_name [String] The name of the Recovery Services vault.
411
+ # @param resource_group_name [String] The name of the resource group associated
412
+ # with the Recovery Services vault.
413
+ # @param fabric_name [String] The fabric name associated with the backup item.
414
+ # @param container_name [String] The container name associated with the backup
415
+ # item.
416
+ # @param protected_item_name [String] The backup item to be deleted.
417
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
418
+ # will be added to the HTTP request.
419
+ #
420
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
421
+ #
422
+ def delete_with_http_info(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, custom_headers = nil)
423
+ delete_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, custom_headers).value!
424
+ end
425
+
426
+ #
427
+ # Used to disable the backup job for an item within a container. This is an
428
+ # asynchronous operation. To learn the status of the request, call the
429
+ # GetItemOperationResult API.
430
+ #
431
+ # @param vault_name [String] The name of the Recovery Services vault.
432
+ # @param resource_group_name [String] The name of the resource group associated
433
+ # with the Recovery Services vault.
434
+ # @param fabric_name [String] The fabric name associated with the backup item.
435
+ # @param container_name [String] The container name associated with the backup
436
+ # item.
437
+ # @param protected_item_name [String] The backup item to be deleted.
438
+ # @param [Hash{String => String}] A hash of custom headers that will be added
439
+ # to the HTTP request.
440
+ #
441
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
442
+ #
443
+ def delete_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, custom_headers = nil)
444
+ api_version = '2016-06-01'
445
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
446
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
447
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
448
+ fail ArgumentError, 'fabric_name is nil' if fabric_name.nil?
449
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
450
+ fail ArgumentError, 'protected_item_name is nil' if protected_item_name.nil?
451
+
452
+
453
+ request_headers = {}
454
+
455
+ # Set Headers
456
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
457
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
458
+ path_template = '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}'
459
+
460
+ request_url = @base_url || @client.base_url
461
+
462
+ options = {
463
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
464
+ path_params: {'vaultName' => vault_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'fabricName' => fabric_name,'containerName' => container_name,'protectedItemName' => protected_item_name},
465
+ query_params: {'api-version' => api_version},
466
+ headers: request_headers.merge(custom_headers || {}),
467
+ base_url: request_url
468
+ }
469
+ promise = @client.make_request_async(:delete, path_template, options)
470
+
471
+ promise = promise.then do |result|
472
+ http_response = result.response
473
+ status_code = http_response.status
474
+ response_content = http_response.body
475
+ unless status_code == 202 || status_code == 204
476
+ error_model = JSON.load(response_content)
477
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
478
+ end
479
+
480
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
481
+
482
+ result
483
+ end
484
+
485
+ promise.execute
486
+ end
487
+
488
+ #
489
+ # Provides a pageable list of all items in a subscription, that can be
490
+ # protected.
491
+ #
492
+ # @param next_page_link [String] The NextLink from the previous successful call
493
+ # to List operation.
494
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
495
+ # will be added to the HTTP request.
496
+ #
497
+ # @return [ProtectedItemResourceList] operation results.
498
+ #
499
+ def list_next(next_page_link, custom_headers = nil)
500
+ response = list_next_async(next_page_link, custom_headers).value!
501
+ response.body unless response.nil?
502
+ end
503
+
504
+ #
505
+ # Provides a pageable list of all items in a subscription, that can be
506
+ # protected.
507
+ #
508
+ # @param next_page_link [String] The NextLink from the previous successful call
509
+ # to List operation.
510
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
511
+ # will be added to the HTTP request.
512
+ #
513
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
514
+ #
515
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
516
+ list_next_async(next_page_link, custom_headers).value!
517
+ end
518
+
519
+ #
520
+ # Provides a pageable list of all items in a subscription, that can be
521
+ # protected.
522
+ #
523
+ # @param next_page_link [String] The NextLink from the previous successful call
524
+ # to List operation.
525
+ # @param [Hash{String => String}] A hash of custom headers that will be added
526
+ # to the HTTP request.
527
+ #
528
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
529
+ #
530
+ def list_next_async(next_page_link, custom_headers = nil)
531
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
532
+
533
+
534
+ request_headers = {}
535
+
536
+ # Set Headers
537
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
538
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
539
+ path_template = '{nextLink}'
540
+
541
+ request_url = @base_url || @client.base_url
542
+
543
+ options = {
544
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
545
+ skip_encoding_path_params: {'nextLink' => next_page_link},
546
+ headers: request_headers.merge(custom_headers || {}),
547
+ base_url: request_url
548
+ }
549
+ promise = @client.make_request_async(:get, path_template, options)
550
+
551
+ promise = promise.then do |result|
552
+ http_response = result.response
553
+ status_code = http_response.status
554
+ response_content = http_response.body
555
+ unless status_code == 200
556
+ error_model = JSON.load(response_content)
557
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
558
+ end
559
+
560
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
561
+ # Deserialize Response
562
+ if status_code == 200
563
+ begin
564
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
565
+ result_mapper = ProtectedItemResourceList.mapper()
566
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
567
+ rescue Exception => e
568
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
569
+ end
570
+ end
571
+
572
+ result
573
+ end
574
+
575
+ promise.execute
576
+ end
577
+
578
+ #
579
+ # Provides a pageable list of all items in a subscription, that can be
580
+ # protected.
581
+ #
582
+ # @param vault_name [String] The name of the Recovery Services vault.
583
+ # @param resource_group_name [String] The name of the resource group associated
584
+ # with the Recovery Services vault.
585
+ # @param filter [String] itemType eq { VM , FileFolder , AzureSqlDb , SQLDB ,
586
+ # Exchange , Sharepoint , DPMUnknown } and providerType eq { AzureIaasVM, MAB,
587
+ # DPM, AzureBackupServer, AzureSql } and policyName eq {policyname} and
588
+ # containerName eq {containername} and backupManagementType eq { AzureIaasVM,
589
+ # MAB, DPM, AzureBackupServer, AzureSql }.
590
+ # @param skip_token [String] The Skip Token filter.
591
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
592
+ # will be added to the HTTP request.
593
+ #
594
+ # @return [ProtectedItemResourceList] which provide lazy access to pages of the
595
+ # response.
596
+ #
597
+ def list_as_lazy(vault_name, resource_group_name, filter = nil, skip_token = nil, custom_headers = nil)
598
+ response = list_async(vault_name, resource_group_name, filter, skip_token, custom_headers).value!
599
+ unless response.nil?
600
+ page = response.body
601
+ page.next_method = Proc.new do |next_page_link|
602
+ list_next_async(next_page_link, custom_headers)
603
+ end
604
+ page
605
+ end
606
+ end
607
+
608
+ end
609
+ end