azure_mgmt_migrate 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2018-02-02/generated/azure_mgmt_migrate.rb +80 -0
  4. data/lib/2018-02-02/generated/azure_mgmt_migrate/assessed_machines.rb +293 -0
  5. data/lib/2018-02-02/generated/azure_mgmt_migrate/assessment_options.rb +121 -0
  6. data/lib/2018-02-02/generated/azure_mgmt_migrate/assessments.rb +790 -0
  7. data/lib/2018-02-02/generated/azure_mgmt_migrate/azure_migrate.rb +160 -0
  8. data/lib/2018-02-02/generated/azure_mgmt_migrate/groups.rb +506 -0
  9. data/lib/2018-02-02/generated/azure_mgmt_migrate/location.rb +129 -0
  10. data/lib/2018-02-02/generated/azure_mgmt_migrate/machines.rb +241 -0
  11. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessed_disk.rb +312 -0
  12. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessed_machine.rb +547 -0
  13. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessed_machine_result_list.rb +55 -0
  14. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessed_network_adapter.rb +197 -0
  15. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessment.rb +367 -0
  16. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessment_options_result_list.rb +78 -0
  17. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessment_result_list.rb +55 -0
  18. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessment_sizing_criterion.rb +16 -0
  19. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessment_stage.rb +17 -0
  20. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/assessment_status.rb +19 -0
  21. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_disk_size.rb +29 -0
  22. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_disk_suitability_explanation.rb +22 -0
  23. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_disk_type.rb +17 -0
  24. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_hybrid_use_benefit.rb +17 -0
  25. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_location.rb +45 -0
  26. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_network_adapter_suitability_explanation.rb +17 -0
  27. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_offer_code.rb +52 -0
  28. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_pricing_tier.rb +16 -0
  29. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_storage_redundancy.rb +19 -0
  30. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_vm_size.rb +105 -0
  31. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/azure_vm_suitability_explanation.rb +50 -0
  32. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/check_name_availability_parameters.rb +61 -0
  33. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/check_name_availability_result.rb +78 -0
  34. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/cloud_suitability.rb +19 -0
  35. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/currency.rb +40 -0
  36. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/discovery_status.rb +18 -0
  37. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/disk.rb +59 -0
  38. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/download_url.rb +59 -0
  39. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/group.rb +151 -0
  40. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/group_result_list.rb +55 -0
  41. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/machine.rb +317 -0
  42. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/machine_boot_type.rb +17 -0
  43. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/machine_result_list.rb +55 -0
  44. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/name_availability_reason.rb +17 -0
  45. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/network_adapter.rb +67 -0
  46. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/operation.rb +71 -0
  47. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/operation_display.rb +83 -0
  48. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/operation_result_list.rb +55 -0
  49. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/percentile.rb +18 -0
  50. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/project.rb +256 -0
  51. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/project_key.rb +59 -0
  52. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/project_result_list.rb +55 -0
  53. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/provisioning_state.rb +20 -0
  54. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/time_range.rb +17 -0
  55. data/lib/2018-02-02/generated/azure_mgmt_migrate/models/vm_family.rb +88 -0
  56. data/lib/2018-02-02/generated/azure_mgmt_migrate/module_definition.rb +9 -0
  57. data/lib/2018-02-02/generated/azure_mgmt_migrate/operations.rb +113 -0
  58. data/lib/2018-02-02/generated/azure_mgmt_migrate/projects.rb +756 -0
  59. data/lib/azure_mgmt_migrate.rb +6 -0
  60. data/lib/module_definition.rb +7 -0
  61. data/lib/profiles/latest/migrate_latest_profile_client.rb +40 -0
  62. data/lib/profiles/latest/migrate_module_definition.rb +8 -0
  63. data/lib/profiles/latest/modules/migrate_profile_module.rb +255 -0
  64. data/lib/version.rb +7 -0
  65. metadata +180 -0
@@ -0,0 +1,790 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Migrate::Mgmt::V2018_02_02
7
+ #
8
+ # Move your workloads to Azure.
9
+ #
10
+ class Assessments
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Assessments class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AzureMigrate] reference to the AzureMigrate
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get all assessments created for the specified group.
26
+ #
27
+ # Get all assessments created for the specified group.
28
+ #
29
+ # Returns a json array of objects of type 'assessment' as specified in Models
30
+ # section.
31
+ #
32
+ #
33
+ # @param resource_group_name [String] Name of the Azure Resource Group that
34
+ # project is part of.
35
+ # @param project_name [String] Name of the Azure Migrate project.
36
+ # @param group_name [String] Unique name of a group within a project.
37
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
38
+ # will be added to the HTTP request.
39
+ #
40
+ # @return [AssessmentResultList] operation results.
41
+ #
42
+ def list_by_group(resource_group_name, project_name, group_name, custom_headers:nil)
43
+ response = list_by_group_async(resource_group_name, project_name, group_name, custom_headers:custom_headers).value!
44
+ response.body unless response.nil?
45
+ end
46
+
47
+ #
48
+ # Get all assessments created for the specified group.
49
+ #
50
+ # Get all assessments created for the specified group.
51
+ #
52
+ # Returns a json array of objects of type 'assessment' as specified in Models
53
+ # section.
54
+ #
55
+ #
56
+ # @param resource_group_name [String] Name of the Azure Resource Group that
57
+ # project is part of.
58
+ # @param project_name [String] Name of the Azure Migrate project.
59
+ # @param group_name [String] Unique name of a group within a project.
60
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
61
+ # will be added to the HTTP request.
62
+ #
63
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
64
+ #
65
+ def list_by_group_with_http_info(resource_group_name, project_name, group_name, custom_headers:nil)
66
+ list_by_group_async(resource_group_name, project_name, group_name, custom_headers:custom_headers).value!
67
+ end
68
+
69
+ #
70
+ # Get all assessments created for the specified group.
71
+ #
72
+ # Get all assessments created for the specified group.
73
+ #
74
+ # Returns a json array of objects of type 'assessment' as specified in Models
75
+ # section.
76
+ #
77
+ #
78
+ # @param resource_group_name [String] Name of the Azure Resource Group that
79
+ # project is part of.
80
+ # @param project_name [String] Name of the Azure Migrate project.
81
+ # @param group_name [String] Unique name of a group within a project.
82
+ # @param [Hash{String => String}] A hash of custom headers that will be added
83
+ # to the HTTP request.
84
+ #
85
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
86
+ #
87
+ def list_by_group_async(resource_group_name, project_name, group_name, custom_headers:nil)
88
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
89
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
90
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
91
+ fail ArgumentError, 'group_name is nil' if group_name.nil?
92
+ @client.api_version = '2018-02-02'
93
+
94
+
95
+ request_headers = {}
96
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
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.Migrate/projects/{projectName}/groups/{groupName}/assessments'
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: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name,'groupName' => group_name},
108
+ query_params: {'api-version' => @client.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
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
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
125
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
126
+ # Deserialize Response
127
+ if status_code == 200
128
+ begin
129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
130
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::AssessmentResultList.mapper()
131
+ result.body = @client.deserialize(result_mapper, parsed_response)
132
+ rescue Exception => e
133
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
134
+ end
135
+ end
136
+
137
+ result
138
+ end
139
+
140
+ promise.execute
141
+ end
142
+
143
+ #
144
+ # Get all assessments created in the project.
145
+ #
146
+ # Get all assessments created in the project.
147
+ #
148
+ # Returns a json array of objects of type 'assessment' as specified in Models
149
+ # section.
150
+ #
151
+ #
152
+ # @param resource_group_name [String] Name of the Azure Resource Group that
153
+ # project is part of.
154
+ # @param project_name [String] Name of the Azure Migrate project.
155
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
156
+ # will be added to the HTTP request.
157
+ #
158
+ # @return [AssessmentResultList] operation results.
159
+ #
160
+ def list_by_project(resource_group_name, project_name, custom_headers:nil)
161
+ response = list_by_project_async(resource_group_name, project_name, custom_headers:custom_headers).value!
162
+ response.body unless response.nil?
163
+ end
164
+
165
+ #
166
+ # Get all assessments created in the project.
167
+ #
168
+ # Get all assessments created in the project.
169
+ #
170
+ # Returns a json array of objects of type 'assessment' as specified in Models
171
+ # section.
172
+ #
173
+ #
174
+ # @param resource_group_name [String] Name of the Azure Resource Group that
175
+ # project is part of.
176
+ # @param project_name [String] Name of the Azure Migrate project.
177
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
178
+ # will be added to the HTTP request.
179
+ #
180
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
181
+ #
182
+ def list_by_project_with_http_info(resource_group_name, project_name, custom_headers:nil)
183
+ list_by_project_async(resource_group_name, project_name, custom_headers:custom_headers).value!
184
+ end
185
+
186
+ #
187
+ # Get all assessments created in the project.
188
+ #
189
+ # Get all assessments created in the project.
190
+ #
191
+ # Returns a json array of objects of type 'assessment' as specified in Models
192
+ # section.
193
+ #
194
+ #
195
+ # @param resource_group_name [String] Name of the Azure Resource Group that
196
+ # project is part of.
197
+ # @param project_name [String] Name of the Azure Migrate project.
198
+ # @param [Hash{String => String}] A hash of custom headers that will be added
199
+ # to the HTTP request.
200
+ #
201
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
202
+ #
203
+ def list_by_project_async(resource_group_name, project_name, custom_headers:nil)
204
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
205
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
206
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
207
+ @client.api_version = '2018-02-02'
208
+
209
+
210
+ request_headers = {}
211
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
212
+
213
+ # Set Headers
214
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
215
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
216
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/assessments'
217
+
218
+ request_url = @base_url || @client.base_url
219
+
220
+ options = {
221
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
222
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name},
223
+ query_params: {'api-version' => @client.api_version},
224
+ headers: request_headers.merge(custom_headers || {}),
225
+ base_url: request_url
226
+ }
227
+ promise = @client.make_request_async(:get, path_template, options)
228
+
229
+ promise = promise.then do |result|
230
+ http_response = result.response
231
+ status_code = http_response.status
232
+ response_content = http_response.body
233
+ unless status_code == 200
234
+ error_model = JSON.load(response_content)
235
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
236
+ end
237
+
238
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
239
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
240
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
241
+ # Deserialize Response
242
+ if status_code == 200
243
+ begin
244
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
245
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::AssessmentResultList.mapper()
246
+ result.body = @client.deserialize(result_mapper, parsed_response)
247
+ rescue Exception => e
248
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
249
+ end
250
+ end
251
+
252
+ result
253
+ end
254
+
255
+ promise.execute
256
+ end
257
+
258
+ #
259
+ # Get an assessment.
260
+ #
261
+ # Get an existing assessment with the specified name. Returns a json object of
262
+ # type 'assessment' as specified in Models section.
263
+ #
264
+ # @param resource_group_name [String] Name of the Azure Resource Group that
265
+ # project is part of.
266
+ # @param project_name [String] Name of the Azure Migrate project.
267
+ # @param group_name [String] Unique name of a group within a project.
268
+ # @param assessment_name [String] Unique name of an assessment within a
269
+ # project.
270
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
271
+ # will be added to the HTTP request.
272
+ #
273
+ # @return [Assessment] operation results.
274
+ #
275
+ def get(resource_group_name, project_name, group_name, assessment_name, custom_headers:nil)
276
+ response = get_async(resource_group_name, project_name, group_name, assessment_name, custom_headers:custom_headers).value!
277
+ response.body unless response.nil?
278
+ end
279
+
280
+ #
281
+ # Get an assessment.
282
+ #
283
+ # Get an existing assessment with the specified name. Returns a json object of
284
+ # type 'assessment' as specified in Models section.
285
+ #
286
+ # @param resource_group_name [String] Name of the Azure Resource Group that
287
+ # project is part of.
288
+ # @param project_name [String] Name of the Azure Migrate project.
289
+ # @param group_name [String] Unique name of a group within a project.
290
+ # @param assessment_name [String] Unique name of an assessment within a
291
+ # project.
292
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
293
+ # will be added to the HTTP request.
294
+ #
295
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
296
+ #
297
+ def get_with_http_info(resource_group_name, project_name, group_name, assessment_name, custom_headers:nil)
298
+ get_async(resource_group_name, project_name, group_name, assessment_name, custom_headers:custom_headers).value!
299
+ end
300
+
301
+ #
302
+ # Get an assessment.
303
+ #
304
+ # Get an existing assessment with the specified name. Returns a json object of
305
+ # type 'assessment' as specified in Models section.
306
+ #
307
+ # @param resource_group_name [String] Name of the Azure Resource Group that
308
+ # project is part of.
309
+ # @param project_name [String] Name of the Azure Migrate project.
310
+ # @param group_name [String] Unique name of a group within a project.
311
+ # @param assessment_name [String] Unique name of an assessment within a
312
+ # project.
313
+ # @param [Hash{String => String}] A hash of custom headers that will be added
314
+ # to the HTTP request.
315
+ #
316
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
317
+ #
318
+ def get_async(resource_group_name, project_name, group_name, assessment_name, custom_headers:nil)
319
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
320
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
321
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
322
+ fail ArgumentError, 'group_name is nil' if group_name.nil?
323
+ fail ArgumentError, 'assessment_name is nil' if assessment_name.nil?
324
+ @client.api_version = '2018-02-02'
325
+
326
+
327
+ request_headers = {}
328
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
329
+
330
+ # Set Headers
331
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
332
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
333
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/groups/{groupName}/assessments/{assessmentName}'
334
+
335
+ request_url = @base_url || @client.base_url
336
+
337
+ options = {
338
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
339
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name,'groupName' => group_name,'assessmentName' => assessment_name},
340
+ query_params: {'api-version' => @client.api_version},
341
+ headers: request_headers.merge(custom_headers || {}),
342
+ base_url: request_url
343
+ }
344
+ promise = @client.make_request_async(:get, path_template, options)
345
+
346
+ promise = promise.then do |result|
347
+ http_response = result.response
348
+ status_code = http_response.status
349
+ response_content = http_response.body
350
+ unless status_code == 200
351
+ error_model = JSON.load(response_content)
352
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
353
+ end
354
+
355
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
356
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
357
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
358
+ # Deserialize Response
359
+ if status_code == 200
360
+ begin
361
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
362
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Assessment.mapper()
363
+ result.body = @client.deserialize(result_mapper, parsed_response)
364
+ rescue Exception => e
365
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
366
+ end
367
+ end
368
+
369
+ result
370
+ end
371
+
372
+ promise.execute
373
+ end
374
+
375
+ #
376
+ # Create or Update assessment.
377
+ #
378
+ # Create a new assessment with the given name and the specified settings. Since
379
+ # name of an assessment in a project is a unique identifier, if an assessment
380
+ # with the name provided already exists, then the existing assessment is
381
+ # updated.
382
+ #
383
+ # Any PUT operation, resulting in either create or update on an assessment,
384
+ # will cause the assessment to go in a "InProgress" state. This will be
385
+ # indicated by the field 'computationState' on the Assessment object. During
386
+ # this time no other PUT operation will be allowed on that assessment object,
387
+ # nor will a Delete operation. Once the computation for the assessment is
388
+ # complete, the field 'computationState' will be updated to 'Ready', and then
389
+ # other PUT or DELETE operations can happen on the assessment.
390
+ #
391
+ # When assessment is under computation, any PUT will lead to a 400 - Bad
392
+ # Request error.
393
+ #
394
+ #
395
+ # @param resource_group_name [String] Name of the Azure Resource Group that
396
+ # project is part of.
397
+ # @param project_name [String] Name of the Azure Migrate project.
398
+ # @param group_name [String] Unique name of a group within a project.
399
+ # @param assessment_name [String] Unique name of an assessment within a
400
+ # project.
401
+ # @param assessment [Assessment] New or Updated Assessment object.
402
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
403
+ # will be added to the HTTP request.
404
+ #
405
+ # @return [Assessment] operation results.
406
+ #
407
+ def create(resource_group_name, project_name, group_name, assessment_name, assessment:nil, custom_headers:nil)
408
+ response = create_async(resource_group_name, project_name, group_name, assessment_name, assessment:assessment, custom_headers:custom_headers).value!
409
+ response.body unless response.nil?
410
+ end
411
+
412
+ #
413
+ # Create or Update assessment.
414
+ #
415
+ # Create a new assessment with the given name and the specified settings. Since
416
+ # name of an assessment in a project is a unique identifier, if an assessment
417
+ # with the name provided already exists, then the existing assessment is
418
+ # updated.
419
+ #
420
+ # Any PUT operation, resulting in either create or update on an assessment,
421
+ # will cause the assessment to go in a "InProgress" state. This will be
422
+ # indicated by the field 'computationState' on the Assessment object. During
423
+ # this time no other PUT operation will be allowed on that assessment object,
424
+ # nor will a Delete operation. Once the computation for the assessment is
425
+ # complete, the field 'computationState' will be updated to 'Ready', and then
426
+ # other PUT or DELETE operations can happen on the assessment.
427
+ #
428
+ # When assessment is under computation, any PUT will lead to a 400 - Bad
429
+ # Request error.
430
+ #
431
+ #
432
+ # @param resource_group_name [String] Name of the Azure Resource Group that
433
+ # project is part of.
434
+ # @param project_name [String] Name of the Azure Migrate project.
435
+ # @param group_name [String] Unique name of a group within a project.
436
+ # @param assessment_name [String] Unique name of an assessment within a
437
+ # project.
438
+ # @param assessment [Assessment] New or Updated Assessment object.
439
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
440
+ # will be added to the HTTP request.
441
+ #
442
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
443
+ #
444
+ def create_with_http_info(resource_group_name, project_name, group_name, assessment_name, assessment:nil, custom_headers:nil)
445
+ create_async(resource_group_name, project_name, group_name, assessment_name, assessment:assessment, custom_headers:custom_headers).value!
446
+ end
447
+
448
+ #
449
+ # Create or Update assessment.
450
+ #
451
+ # Create a new assessment with the given name and the specified settings. Since
452
+ # name of an assessment in a project is a unique identifier, if an assessment
453
+ # with the name provided already exists, then the existing assessment is
454
+ # updated.
455
+ #
456
+ # Any PUT operation, resulting in either create or update on an assessment,
457
+ # will cause the assessment to go in a "InProgress" state. This will be
458
+ # indicated by the field 'computationState' on the Assessment object. During
459
+ # this time no other PUT operation will be allowed on that assessment object,
460
+ # nor will a Delete operation. Once the computation for the assessment is
461
+ # complete, the field 'computationState' will be updated to 'Ready', and then
462
+ # other PUT or DELETE operations can happen on the assessment.
463
+ #
464
+ # When assessment is under computation, any PUT will lead to a 400 - Bad
465
+ # Request error.
466
+ #
467
+ #
468
+ # @param resource_group_name [String] Name of the Azure Resource Group that
469
+ # project is part of.
470
+ # @param project_name [String] Name of the Azure Migrate project.
471
+ # @param group_name [String] Unique name of a group within a project.
472
+ # @param assessment_name [String] Unique name of an assessment within a
473
+ # project.
474
+ # @param assessment [Assessment] New or Updated Assessment object.
475
+ # @param [Hash{String => String}] A hash of custom headers that will be added
476
+ # to the HTTP request.
477
+ #
478
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
479
+ #
480
+ def create_async(resource_group_name, project_name, group_name, assessment_name, assessment:nil, custom_headers:nil)
481
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
482
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
483
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
484
+ fail ArgumentError, 'group_name is nil' if group_name.nil?
485
+ fail ArgumentError, 'assessment_name is nil' if assessment_name.nil?
486
+ @client.api_version = '2018-02-02'
487
+
488
+
489
+ request_headers = {}
490
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
491
+
492
+ # Set Headers
493
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
494
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
495
+
496
+ # Serialize Request
497
+ request_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Assessment.mapper()
498
+ request_content = @client.serialize(request_mapper, assessment)
499
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
500
+
501
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/groups/{groupName}/assessments/{assessmentName}'
502
+
503
+ request_url = @base_url || @client.base_url
504
+
505
+ options = {
506
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
507
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name,'groupName' => group_name,'assessmentName' => assessment_name},
508
+ query_params: {'api-version' => @client.api_version},
509
+ body: request_content,
510
+ headers: request_headers.merge(custom_headers || {}),
511
+ base_url: request_url
512
+ }
513
+ promise = @client.make_request_async(:put, path_template, options)
514
+
515
+ promise = promise.then do |result|
516
+ http_response = result.response
517
+ status_code = http_response.status
518
+ response_content = http_response.body
519
+ unless status_code == 200 || status_code == 201
520
+ error_model = JSON.load(response_content)
521
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
522
+ end
523
+
524
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
525
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
526
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
527
+ # Deserialize Response
528
+ if status_code == 200
529
+ begin
530
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
531
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Assessment.mapper()
532
+ result.body = @client.deserialize(result_mapper, parsed_response)
533
+ rescue Exception => e
534
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
535
+ end
536
+ end
537
+ # Deserialize Response
538
+ if status_code == 201
539
+ begin
540
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
541
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Assessment.mapper()
542
+ result.body = @client.deserialize(result_mapper, parsed_response)
543
+ rescue Exception => e
544
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
545
+ end
546
+ end
547
+
548
+ result
549
+ end
550
+
551
+ promise.execute
552
+ end
553
+
554
+ #
555
+ # Deletes an assessment from the project.
556
+ #
557
+ # Delete an assessment from the project. The machines remain in the assessment.
558
+ # Deleting a non-existent assessment results in a no-operation.
559
+ #
560
+ # When an assessment is under computation, as indicated by the
561
+ # 'computationState' field, it cannot be deleted. Any such attempt will return
562
+ # a 400 - Bad Request.
563
+ #
564
+ #
565
+ # @param resource_group_name [String] Name of the Azure Resource Group that
566
+ # project is part of.
567
+ # @param project_name [String] Name of the Azure Migrate project.
568
+ # @param group_name [String] Unique name of a group within a project.
569
+ # @param assessment_name [String] Unique name of an assessment within a
570
+ # project.
571
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
572
+ # will be added to the HTTP request.
573
+ #
574
+ #
575
+ def delete(resource_group_name, project_name, group_name, assessment_name, custom_headers:nil)
576
+ response = delete_async(resource_group_name, project_name, group_name, assessment_name, custom_headers:custom_headers).value!
577
+ nil
578
+ end
579
+
580
+ #
581
+ # Deletes an assessment from the project.
582
+ #
583
+ # Delete an assessment from the project. The machines remain in the assessment.
584
+ # Deleting a non-existent assessment results in a no-operation.
585
+ #
586
+ # When an assessment is under computation, as indicated by the
587
+ # 'computationState' field, it cannot be deleted. Any such attempt will return
588
+ # a 400 - Bad Request.
589
+ #
590
+ #
591
+ # @param resource_group_name [String] Name of the Azure Resource Group that
592
+ # project is part of.
593
+ # @param project_name [String] Name of the Azure Migrate project.
594
+ # @param group_name [String] Unique name of a group within a project.
595
+ # @param assessment_name [String] Unique name of an assessment within a
596
+ # project.
597
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
598
+ # will be added to the HTTP request.
599
+ #
600
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
601
+ #
602
+ def delete_with_http_info(resource_group_name, project_name, group_name, assessment_name, custom_headers:nil)
603
+ delete_async(resource_group_name, project_name, group_name, assessment_name, custom_headers:custom_headers).value!
604
+ end
605
+
606
+ #
607
+ # Deletes an assessment from the project.
608
+ #
609
+ # Delete an assessment from the project. The machines remain in the assessment.
610
+ # Deleting a non-existent assessment results in a no-operation.
611
+ #
612
+ # When an assessment is under computation, as indicated by the
613
+ # 'computationState' field, it cannot be deleted. Any such attempt will return
614
+ # a 400 - Bad Request.
615
+ #
616
+ #
617
+ # @param resource_group_name [String] Name of the Azure Resource Group that
618
+ # project is part of.
619
+ # @param project_name [String] Name of the Azure Migrate project.
620
+ # @param group_name [String] Unique name of a group within a project.
621
+ # @param assessment_name [String] Unique name of an assessment within a
622
+ # project.
623
+ # @param [Hash{String => String}] A hash of custom headers that will be added
624
+ # to the HTTP request.
625
+ #
626
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
627
+ #
628
+ def delete_async(resource_group_name, project_name, group_name, assessment_name, custom_headers:nil)
629
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
630
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
631
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
632
+ fail ArgumentError, 'group_name is nil' if group_name.nil?
633
+ fail ArgumentError, 'assessment_name is nil' if assessment_name.nil?
634
+ @client.api_version = '2018-02-02'
635
+
636
+
637
+ request_headers = {}
638
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
639
+
640
+ # Set Headers
641
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
642
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
643
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/groups/{groupName}/assessments/{assessmentName}'
644
+
645
+ request_url = @base_url || @client.base_url
646
+
647
+ options = {
648
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
649
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name,'groupName' => group_name,'assessmentName' => assessment_name},
650
+ query_params: {'api-version' => @client.api_version},
651
+ headers: request_headers.merge(custom_headers || {}),
652
+ base_url: request_url
653
+ }
654
+ promise = @client.make_request_async(:delete, path_template, options)
655
+
656
+ promise = promise.then do |result|
657
+ http_response = result.response
658
+ status_code = http_response.status
659
+ response_content = http_response.body
660
+ unless status_code == 200
661
+ error_model = JSON.load(response_content)
662
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
663
+ end
664
+
665
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
666
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
667
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
668
+
669
+ result
670
+ end
671
+
672
+ promise.execute
673
+ end
674
+
675
+ #
676
+ # Get download URL for the assessment report.
677
+ #
678
+ # Get the URL for downloading the assessment in a report format.
679
+ #
680
+ # @param resource_group_name [String] Name of the Azure Resource Group that
681
+ # project is part of.
682
+ # @param project_name [String] Name of the Azure Migrate project.
683
+ # @param group_name [String] Unique name of a group within a project.
684
+ # @param assessment_name [String] Unique name of an assessment within a
685
+ # project.
686
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
687
+ # will be added to the HTTP request.
688
+ #
689
+ # @return [DownloadUrl] operation results.
690
+ #
691
+ def get_report_download_url(resource_group_name, project_name, group_name, assessment_name, custom_headers:nil)
692
+ response = get_report_download_url_async(resource_group_name, project_name, group_name, assessment_name, custom_headers:custom_headers).value!
693
+ response.body unless response.nil?
694
+ end
695
+
696
+ #
697
+ # Get download URL for the assessment report.
698
+ #
699
+ # Get the URL for downloading the assessment in a report format.
700
+ #
701
+ # @param resource_group_name [String] Name of the Azure Resource Group that
702
+ # project is part of.
703
+ # @param project_name [String] Name of the Azure Migrate project.
704
+ # @param group_name [String] Unique name of a group within a project.
705
+ # @param assessment_name [String] Unique name of an assessment within a
706
+ # project.
707
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
708
+ # will be added to the HTTP request.
709
+ #
710
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
711
+ #
712
+ def get_report_download_url_with_http_info(resource_group_name, project_name, group_name, assessment_name, custom_headers:nil)
713
+ get_report_download_url_async(resource_group_name, project_name, group_name, assessment_name, custom_headers:custom_headers).value!
714
+ end
715
+
716
+ #
717
+ # Get download URL for the assessment report.
718
+ #
719
+ # Get the URL for downloading the assessment in a report format.
720
+ #
721
+ # @param resource_group_name [String] Name of the Azure Resource Group that
722
+ # project is part of.
723
+ # @param project_name [String] Name of the Azure Migrate project.
724
+ # @param group_name [String] Unique name of a group within a project.
725
+ # @param assessment_name [String] Unique name of an assessment within a
726
+ # project.
727
+ # @param [Hash{String => String}] A hash of custom headers that will be added
728
+ # to the HTTP request.
729
+ #
730
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
731
+ #
732
+ def get_report_download_url_async(resource_group_name, project_name, group_name, assessment_name, custom_headers:nil)
733
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
734
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
735
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
736
+ fail ArgumentError, 'group_name is nil' if group_name.nil?
737
+ fail ArgumentError, 'assessment_name is nil' if assessment_name.nil?
738
+ @client.api_version = '2018-02-02'
739
+
740
+
741
+ request_headers = {}
742
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
743
+
744
+ # Set Headers
745
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
746
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
747
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/groups/{groupName}/assessments/{assessmentName}/downloadUrl'
748
+
749
+ request_url = @base_url || @client.base_url
750
+
751
+ options = {
752
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
753
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name,'groupName' => group_name,'assessmentName' => assessment_name},
754
+ query_params: {'api-version' => @client.api_version},
755
+ headers: request_headers.merge(custom_headers || {}),
756
+ base_url: request_url
757
+ }
758
+ promise = @client.make_request_async(:post, path_template, options)
759
+
760
+ promise = promise.then do |result|
761
+ http_response = result.response
762
+ status_code = http_response.status
763
+ response_content = http_response.body
764
+ unless status_code == 200
765
+ error_model = JSON.load(response_content)
766
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
767
+ end
768
+
769
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
770
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
771
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
772
+ # Deserialize Response
773
+ if status_code == 200
774
+ begin
775
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
776
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::DownloadUrl.mapper()
777
+ result.body = @client.deserialize(result_mapper, parsed_response)
778
+ rescue Exception => e
779
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
780
+ end
781
+ end
782
+
783
+ result
784
+ end
785
+
786
+ promise.execute
787
+ end
788
+
789
+ end
790
+ end