azure_mgmt_migrate 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,59 @@
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
+ module Models
8
+ #
9
+ # ID and Key for Migration Project.
10
+ #
11
+ class ProjectKey
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] ID of Migration Project.
16
+ attr_accessor :workspace_id
17
+
18
+ # @return [String] Key of Migration Project.
19
+ attr_accessor :workspace_key
20
+
21
+
22
+ #
23
+ # Mapper for ProjectKey class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ client_side_validation: true,
29
+ required: false,
30
+ serialized_name: 'ProjectKey',
31
+ type: {
32
+ name: 'Composite',
33
+ class_name: 'ProjectKey',
34
+ model_properties: {
35
+ workspace_id: {
36
+ client_side_validation: true,
37
+ required: false,
38
+ read_only: true,
39
+ serialized_name: 'workspaceId',
40
+ type: {
41
+ name: 'String'
42
+ }
43
+ },
44
+ workspace_key: {
45
+ client_side_validation: true,
46
+ required: false,
47
+ read_only: true,
48
+ serialized_name: 'workspaceKey',
49
+ type: {
50
+ name: 'String'
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,55 @@
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
+ module Models
8
+ #
9
+ # List of projects.
10
+ #
11
+ class ProjectResultList
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<Project>] List of projects.
16
+ attr_accessor :value
17
+
18
+
19
+ #
20
+ # Mapper for ProjectResultList class as Ruby Hash.
21
+ # This will be used for serialization/deserialization.
22
+ #
23
+ def self.mapper()
24
+ {
25
+ client_side_validation: true,
26
+ required: false,
27
+ serialized_name: 'ProjectResultList',
28
+ type: {
29
+ name: 'Composite',
30
+ class_name: 'ProjectResultList',
31
+ model_properties: {
32
+ value: {
33
+ client_side_validation: true,
34
+ required: false,
35
+ serialized_name: 'value',
36
+ type: {
37
+ name: 'Sequence',
38
+ element: {
39
+ client_side_validation: true,
40
+ required: false,
41
+ serialized_name: 'ProjectElementType',
42
+ type: {
43
+ name: 'Composite',
44
+ class_name: 'Project'
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,20 @@
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
+ module Models
8
+ #
9
+ # Defines values for ProvisioningState
10
+ #
11
+ module ProvisioningState
12
+ Accepted = "Accepted"
13
+ Creating = "Creating"
14
+ Deleting = "Deleting"
15
+ Failed = "Failed"
16
+ Moving = "Moving"
17
+ Succeeded = "Succeeded"
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
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
+ module Models
8
+ #
9
+ # Defines values for TimeRange
10
+ #
11
+ module TimeRange
12
+ Day = "Day"
13
+ Week = "Week"
14
+ Month = "Month"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,88 @@
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
+ module Models
8
+ #
9
+ # VM family name, the list of targeted azure locations and the category of
10
+ # the family.
11
+ #
12
+ class VmFamily
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] Name of the VM family.
17
+ attr_accessor :family_name
18
+
19
+ # @return [Array<String>] List of Azure regions.
20
+ attr_accessor :target_locations
21
+
22
+ # @return [Array<String>] Category of the VM family.
23
+ attr_accessor :category
24
+
25
+
26
+ #
27
+ # Mapper for VmFamily class as Ruby Hash.
28
+ # This will be used for serialization/deserialization.
29
+ #
30
+ def self.mapper()
31
+ {
32
+ client_side_validation: true,
33
+ required: false,
34
+ serialized_name: 'VmFamily',
35
+ type: {
36
+ name: 'Composite',
37
+ class_name: 'VmFamily',
38
+ model_properties: {
39
+ family_name: {
40
+ client_side_validation: true,
41
+ required: false,
42
+ read_only: true,
43
+ serialized_name: 'familyName',
44
+ type: {
45
+ name: 'String'
46
+ }
47
+ },
48
+ target_locations: {
49
+ client_side_validation: true,
50
+ required: false,
51
+ read_only: true,
52
+ serialized_name: 'targetLocations',
53
+ type: {
54
+ name: 'Sequence',
55
+ element: {
56
+ client_side_validation: true,
57
+ required: false,
58
+ serialized_name: 'StringElementType',
59
+ type: {
60
+ name: 'String'
61
+ }
62
+ }
63
+ }
64
+ },
65
+ category: {
66
+ client_side_validation: true,
67
+ required: false,
68
+ read_only: true,
69
+ serialized_name: 'category',
70
+ type: {
71
+ name: 'Sequence',
72
+ element: {
73
+ client_side_validation: true,
74
+ required: false,
75
+ serialized_name: 'StringElementType',
76
+ type: {
77
+ name: 'String'
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::Migrate end
8
+ module Azure::Migrate::Mgmt end
9
+ module Azure::Migrate::Mgmt::V2018_02_02 end
@@ -0,0 +1,113 @@
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 Operations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Operations 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 list of operations supported in the API.
26
+ #
27
+ # Get a list of REST API supported by Microsoft.Migrate provider.
28
+ #
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [OperationResultList] operation results.
33
+ #
34
+ def list(custom_headers:nil)
35
+ response = list_async(custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Get list of operations supported in the API.
41
+ #
42
+ # Get a list of REST API supported by Microsoft.Migrate provider.
43
+ #
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_with_http_info(custom_headers:nil)
50
+ list_async(custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Get list of operations supported in the API.
55
+ #
56
+ # Get a list of REST API supported by Microsoft.Migrate provider.
57
+ #
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_async(custom_headers:nil)
64
+
65
+
66
+ request_headers = {}
67
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
72
+ path_template = 'providers/Microsoft.Migrate/operations'
73
+
74
+ request_url = @base_url || @client.base_url
75
+
76
+ options = {
77
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
+ headers: request_headers.merge(custom_headers || {}),
79
+ base_url: request_url
80
+ }
81
+ promise = @client.make_request_async(:get, path_template, options)
82
+
83
+ promise = promise.then do |result|
84
+ http_response = result.response
85
+ status_code = http_response.status
86
+ response_content = http_response.body
87
+ unless status_code == 200
88
+ error_model = JSON.load(response_content)
89
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
90
+ end
91
+
92
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
93
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
94
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
95
+ # Deserialize Response
96
+ if status_code == 200
97
+ begin
98
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
99
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::OperationResultList.mapper()
100
+ result.body = @client.deserialize(result_mapper, parsed_response)
101
+ rescue Exception => e
102
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
103
+ end
104
+ end
105
+
106
+ result
107
+ end
108
+
109
+ promise.execute
110
+ end
111
+
112
+ end
113
+ end
@@ -0,0 +1,756 @@
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 Projects
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Projects 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 projects.
26
+ #
27
+ # Get all the projects in the subscription.
28
+ #
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [ProjectResultList] operation results.
33
+ #
34
+ def list_by_subscription(custom_headers:nil)
35
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Get all projects.
41
+ #
42
+ # Get all the projects in the subscription.
43
+ #
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_by_subscription_with_http_info(custom_headers:nil)
50
+ list_by_subscription_async(custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Get all projects.
55
+ #
56
+ # Get all the projects in the subscription.
57
+ #
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_by_subscription_async(custom_headers:nil)
64
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
65
+ @client.api_version = '2018-02-02'
66
+
67
+
68
+ request_headers = {}
69
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
70
+
71
+ # Set Headers
72
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
73
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
74
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Migrate/projects'
75
+
76
+ request_url = @base_url || @client.base_url
77
+
78
+ options = {
79
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
80
+ path_params: {'subscriptionId' => @client.subscription_id},
81
+ query_params: {'api-version' => @client.api_version},
82
+ headers: request_headers.merge(custom_headers || {}),
83
+ base_url: request_url
84
+ }
85
+ promise = @client.make_request_async(:get, path_template, options)
86
+
87
+ promise = promise.then do |result|
88
+ http_response = result.response
89
+ status_code = http_response.status
90
+ response_content = http_response.body
91
+ unless status_code == 200
92
+ error_model = JSON.load(response_content)
93
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
94
+ end
95
+
96
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
97
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
98
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
99
+ # Deserialize Response
100
+ if status_code == 200
101
+ begin
102
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
103
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::ProjectResultList.mapper()
104
+ result.body = @client.deserialize(result_mapper, parsed_response)
105
+ rescue Exception => e
106
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
107
+ end
108
+ end
109
+
110
+ result
111
+ end
112
+
113
+ promise.execute
114
+ end
115
+
116
+ #
117
+ # Get all projects.
118
+ #
119
+ # Get all the projects in the resource group.
120
+ #
121
+ # @param resource_group_name [String] Name of the Azure Resource Group that
122
+ # project is part of.
123
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
124
+ # will be added to the HTTP request.
125
+ #
126
+ # @return [ProjectResultList] operation results.
127
+ #
128
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
129
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
130
+ response.body unless response.nil?
131
+ end
132
+
133
+ #
134
+ # Get all projects.
135
+ #
136
+ # Get all the projects in the resource group.
137
+ #
138
+ # @param resource_group_name [String] Name of the Azure Resource Group that
139
+ # project is part of.
140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
+ # will be added to the HTTP request.
142
+ #
143
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
144
+ #
145
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
146
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
147
+ end
148
+
149
+ #
150
+ # Get all projects.
151
+ #
152
+ # Get all the projects in the resource group.
153
+ #
154
+ # @param resource_group_name [String] Name of the Azure Resource Group that
155
+ # project is part of.
156
+ # @param [Hash{String => String}] A hash of custom headers that will be added
157
+ # to the HTTP request.
158
+ #
159
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
160
+ #
161
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
162
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
163
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
164
+ @client.api_version = '2018-02-02'
165
+
166
+
167
+ request_headers = {}
168
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
169
+
170
+ # Set Headers
171
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
172
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
173
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/projects'
174
+
175
+ request_url = @base_url || @client.base_url
176
+
177
+ options = {
178
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
179
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
180
+ query_params: {'api-version' => @client.api_version},
181
+ headers: request_headers.merge(custom_headers || {}),
182
+ base_url: request_url
183
+ }
184
+ promise = @client.make_request_async(:get, path_template, options)
185
+
186
+ promise = promise.then do |result|
187
+ http_response = result.response
188
+ status_code = http_response.status
189
+ response_content = http_response.body
190
+ unless status_code == 200
191
+ error_model = JSON.load(response_content)
192
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
193
+ end
194
+
195
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
196
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
197
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
198
+ # Deserialize Response
199
+ if status_code == 200
200
+ begin
201
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
202
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::ProjectResultList.mapper()
203
+ result.body = @client.deserialize(result_mapper, parsed_response)
204
+ rescue Exception => e
205
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
206
+ end
207
+ end
208
+
209
+ result
210
+ end
211
+
212
+ promise.execute
213
+ end
214
+
215
+ #
216
+ # Get the specified project.
217
+ #
218
+ # Get the project with the specified name.
219
+ #
220
+ # @param resource_group_name [String] Name of the Azure Resource Group that
221
+ # project is part of.
222
+ # @param project_name [String] Name of the Azure Migrate project.
223
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
224
+ # will be added to the HTTP request.
225
+ #
226
+ # @return [Project] operation results.
227
+ #
228
+ def get(resource_group_name, project_name, custom_headers:nil)
229
+ response = get_async(resource_group_name, project_name, custom_headers:custom_headers).value!
230
+ response.body unless response.nil?
231
+ end
232
+
233
+ #
234
+ # Get the specified project.
235
+ #
236
+ # Get the project with the specified name.
237
+ #
238
+ # @param resource_group_name [String] Name of the Azure Resource Group that
239
+ # project is part of.
240
+ # @param project_name [String] Name of the Azure Migrate project.
241
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
242
+ # will be added to the HTTP request.
243
+ #
244
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
245
+ #
246
+ def get_with_http_info(resource_group_name, project_name, custom_headers:nil)
247
+ get_async(resource_group_name, project_name, custom_headers:custom_headers).value!
248
+ end
249
+
250
+ #
251
+ # Get the specified project.
252
+ #
253
+ # Get the project with the specified name.
254
+ #
255
+ # @param resource_group_name [String] Name of the Azure Resource Group that
256
+ # project is part of.
257
+ # @param project_name [String] Name of the Azure Migrate project.
258
+ # @param [Hash{String => String}] A hash of custom headers that will be added
259
+ # to the HTTP request.
260
+ #
261
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
262
+ #
263
+ def get_async(resource_group_name, project_name, custom_headers:nil)
264
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
265
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
266
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
267
+ @client.api_version = '2018-02-02'
268
+
269
+
270
+ request_headers = {}
271
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
272
+
273
+ # Set Headers
274
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
275
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
276
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}'
277
+
278
+ request_url = @base_url || @client.base_url
279
+
280
+ options = {
281
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
282
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name},
283
+ query_params: {'api-version' => @client.api_version},
284
+ headers: request_headers.merge(custom_headers || {}),
285
+ base_url: request_url
286
+ }
287
+ promise = @client.make_request_async(:get, path_template, options)
288
+
289
+ promise = promise.then do |result|
290
+ http_response = result.response
291
+ status_code = http_response.status
292
+ response_content = http_response.body
293
+ unless status_code == 200
294
+ error_model = JSON.load(response_content)
295
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
296
+ end
297
+
298
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
299
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
300
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
301
+ # Deserialize Response
302
+ if status_code == 200
303
+ begin
304
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
305
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Project.mapper()
306
+ result.body = @client.deserialize(result_mapper, parsed_response)
307
+ rescue Exception => e
308
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
309
+ end
310
+ end
311
+
312
+ result
313
+ end
314
+
315
+ promise.execute
316
+ end
317
+
318
+ #
319
+ # Create or update project.
320
+ #
321
+ # Create a project with specified name. If a project already exists, update it.
322
+ #
323
+ # @param resource_group_name [String] Name of the Azure Resource Group that
324
+ # project is part of.
325
+ # @param project_name [String] Name of the Azure Migrate project.
326
+ # @param project [Project] New or Updated project object.
327
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
328
+ # will be added to the HTTP request.
329
+ #
330
+ # @return [Project] operation results.
331
+ #
332
+ def create(resource_group_name, project_name, project:nil, custom_headers:nil)
333
+ response = create_async(resource_group_name, project_name, project:project, custom_headers:custom_headers).value!
334
+ response.body unless response.nil?
335
+ end
336
+
337
+ #
338
+ # Create or update project.
339
+ #
340
+ # Create a project with specified name. If a project already exists, update it.
341
+ #
342
+ # @param resource_group_name [String] Name of the Azure Resource Group that
343
+ # project is part of.
344
+ # @param project_name [String] Name of the Azure Migrate project.
345
+ # @param project [Project] New or Updated project object.
346
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
347
+ # will be added to the HTTP request.
348
+ #
349
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
350
+ #
351
+ def create_with_http_info(resource_group_name, project_name, project:nil, custom_headers:nil)
352
+ create_async(resource_group_name, project_name, project:project, custom_headers:custom_headers).value!
353
+ end
354
+
355
+ #
356
+ # Create or update project.
357
+ #
358
+ # Create a project with specified name. If a project already exists, update it.
359
+ #
360
+ # @param resource_group_name [String] Name of the Azure Resource Group that
361
+ # project is part of.
362
+ # @param project_name [String] Name of the Azure Migrate project.
363
+ # @param project [Project] New or Updated project object.
364
+ # @param [Hash{String => String}] A hash of custom headers that will be added
365
+ # to the HTTP request.
366
+ #
367
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
368
+ #
369
+ def create_async(resource_group_name, project_name, project:nil, custom_headers:nil)
370
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
371
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
372
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
373
+ @client.api_version = '2018-02-02'
374
+
375
+
376
+ request_headers = {}
377
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
378
+
379
+ # Set Headers
380
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
381
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
382
+
383
+ # Serialize Request
384
+ request_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Project.mapper()
385
+ request_content = @client.serialize(request_mapper, project)
386
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
387
+
388
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}'
389
+
390
+ request_url = @base_url || @client.base_url
391
+
392
+ options = {
393
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
394
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name},
395
+ query_params: {'api-version' => @client.api_version},
396
+ body: request_content,
397
+ headers: request_headers.merge(custom_headers || {}),
398
+ base_url: request_url
399
+ }
400
+ promise = @client.make_request_async(:put, path_template, options)
401
+
402
+ promise = promise.then do |result|
403
+ http_response = result.response
404
+ status_code = http_response.status
405
+ response_content = http_response.body
406
+ unless status_code == 200 || status_code == 201
407
+ error_model = JSON.load(response_content)
408
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
409
+ end
410
+
411
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
412
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
413
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
414
+ # Deserialize Response
415
+ if status_code == 200
416
+ begin
417
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
418
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Project.mapper()
419
+ result.body = @client.deserialize(result_mapper, parsed_response)
420
+ rescue Exception => e
421
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
422
+ end
423
+ end
424
+ # Deserialize Response
425
+ if status_code == 201
426
+ begin
427
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
428
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Project.mapper()
429
+ result.body = @client.deserialize(result_mapper, parsed_response)
430
+ rescue Exception => e
431
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
432
+ end
433
+ end
434
+
435
+ result
436
+ end
437
+
438
+ promise.execute
439
+ end
440
+
441
+ #
442
+ # Update project.
443
+ #
444
+ # Update a project with specified name. Supports partial updates, for example
445
+ # only tags can be provided.
446
+ #
447
+ # @param resource_group_name [String] Name of the Azure Resource Group that
448
+ # project is part of.
449
+ # @param project_name [String] Name of the Azure Migrate project.
450
+ # @param project [Project] Updated project object.
451
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
452
+ # will be added to the HTTP request.
453
+ #
454
+ # @return [Project] operation results.
455
+ #
456
+ def update(resource_group_name, project_name, project:nil, custom_headers:nil)
457
+ response = update_async(resource_group_name, project_name, project:project, custom_headers:custom_headers).value!
458
+ response.body unless response.nil?
459
+ end
460
+
461
+ #
462
+ # Update project.
463
+ #
464
+ # Update a project with specified name. Supports partial updates, for example
465
+ # only tags can be provided.
466
+ #
467
+ # @param resource_group_name [String] Name of the Azure Resource Group that
468
+ # project is part of.
469
+ # @param project_name [String] Name of the Azure Migrate project.
470
+ # @param project [Project] Updated project object.
471
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
472
+ # will be added to the HTTP request.
473
+ #
474
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
475
+ #
476
+ def update_with_http_info(resource_group_name, project_name, project:nil, custom_headers:nil)
477
+ update_async(resource_group_name, project_name, project:project, custom_headers:custom_headers).value!
478
+ end
479
+
480
+ #
481
+ # Update project.
482
+ #
483
+ # Update a project with specified name. Supports partial updates, for example
484
+ # only tags can be provided.
485
+ #
486
+ # @param resource_group_name [String] Name of the Azure Resource Group that
487
+ # project is part of.
488
+ # @param project_name [String] Name of the Azure Migrate project.
489
+ # @param project [Project] Updated project object.
490
+ # @param [Hash{String => String}] A hash of custom headers that will be added
491
+ # to the HTTP request.
492
+ #
493
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
494
+ #
495
+ def update_async(resource_group_name, project_name, project:nil, custom_headers:nil)
496
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
497
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
498
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
499
+ @client.api_version = '2018-02-02'
500
+
501
+
502
+ request_headers = {}
503
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
504
+
505
+ # Set Headers
506
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
507
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
508
+
509
+ # Serialize Request
510
+ request_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Project.mapper()
511
+ request_content = @client.serialize(request_mapper, project)
512
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
513
+
514
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}'
515
+
516
+ request_url = @base_url || @client.base_url
517
+
518
+ options = {
519
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
520
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name},
521
+ query_params: {'api-version' => @client.api_version},
522
+ body: request_content,
523
+ headers: request_headers.merge(custom_headers || {}),
524
+ base_url: request_url
525
+ }
526
+ promise = @client.make_request_async(:patch, path_template, options)
527
+
528
+ promise = promise.then do |result|
529
+ http_response = result.response
530
+ status_code = http_response.status
531
+ response_content = http_response.body
532
+ unless status_code == 200
533
+ error_model = JSON.load(response_content)
534
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
535
+ end
536
+
537
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
538
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
539
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
540
+ # Deserialize Response
541
+ if status_code == 200
542
+ begin
543
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
544
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Project.mapper()
545
+ result.body = @client.deserialize(result_mapper, parsed_response)
546
+ rescue Exception => e
547
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
548
+ end
549
+ end
550
+
551
+ result
552
+ end
553
+
554
+ promise.execute
555
+ end
556
+
557
+ #
558
+ # Delete the project
559
+ #
560
+ # Delete the project. Deleting non-existent project is a no-operation.
561
+ #
562
+ # @param resource_group_name [String] Name of the Azure Resource Group that
563
+ # project is part of.
564
+ # @param project_name [String] Name of the Azure Migrate project.
565
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
566
+ # will be added to the HTTP request.
567
+ #
568
+ #
569
+ def delete(resource_group_name, project_name, custom_headers:nil)
570
+ response = delete_async(resource_group_name, project_name, custom_headers:custom_headers).value!
571
+ nil
572
+ end
573
+
574
+ #
575
+ # Delete the project
576
+ #
577
+ # Delete the project. Deleting non-existent project is a no-operation.
578
+ #
579
+ # @param resource_group_name [String] Name of the Azure Resource Group that
580
+ # project is part of.
581
+ # @param project_name [String] Name of the Azure Migrate project.
582
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
583
+ # will be added to the HTTP request.
584
+ #
585
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
586
+ #
587
+ def delete_with_http_info(resource_group_name, project_name, custom_headers:nil)
588
+ delete_async(resource_group_name, project_name, custom_headers:custom_headers).value!
589
+ end
590
+
591
+ #
592
+ # Delete the project
593
+ #
594
+ # Delete the project. Deleting non-existent project is a no-operation.
595
+ #
596
+ # @param resource_group_name [String] Name of the Azure Resource Group that
597
+ # project is part of.
598
+ # @param project_name [String] Name of the Azure Migrate project.
599
+ # @param [Hash{String => String}] A hash of custom headers that will be added
600
+ # to the HTTP request.
601
+ #
602
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
603
+ #
604
+ def delete_async(resource_group_name, project_name, custom_headers:nil)
605
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
606
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
607
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
608
+ @client.api_version = '2018-02-02'
609
+
610
+
611
+ request_headers = {}
612
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
613
+
614
+ # Set Headers
615
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
616
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
617
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}'
618
+
619
+ request_url = @base_url || @client.base_url
620
+
621
+ options = {
622
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
623
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name},
624
+ query_params: {'api-version' => @client.api_version},
625
+ headers: request_headers.merge(custom_headers || {}),
626
+ base_url: request_url
627
+ }
628
+ promise = @client.make_request_async(:delete, path_template, options)
629
+
630
+ promise = promise.then do |result|
631
+ http_response = result.response
632
+ status_code = http_response.status
633
+ response_content = http_response.body
634
+ unless status_code == 200
635
+ error_model = JSON.load(response_content)
636
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
637
+ end
638
+
639
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
640
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
641
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
642
+
643
+ result
644
+ end
645
+
646
+ promise.execute
647
+ end
648
+
649
+ #
650
+ # Get shared keys for the project.
651
+ #
652
+ # Gets the Log Analytics Workspace ID and Primary Key for the specified
653
+ # project.
654
+ #
655
+ # @param resource_group_name [String] Name of the Azure Resource Group that
656
+ # project is part of.
657
+ # @param project_name [String] Name of the Azure Migrate project.
658
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
659
+ # will be added to the HTTP request.
660
+ #
661
+ # @return [ProjectKey] operation results.
662
+ #
663
+ def get_keys(resource_group_name, project_name, custom_headers:nil)
664
+ response = get_keys_async(resource_group_name, project_name, custom_headers:custom_headers).value!
665
+ response.body unless response.nil?
666
+ end
667
+
668
+ #
669
+ # Get shared keys for the project.
670
+ #
671
+ # Gets the Log Analytics Workspace ID and Primary Key for the specified
672
+ # project.
673
+ #
674
+ # @param resource_group_name [String] Name of the Azure Resource Group that
675
+ # project is part of.
676
+ # @param project_name [String] Name of the Azure Migrate project.
677
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
678
+ # will be added to the HTTP request.
679
+ #
680
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
681
+ #
682
+ def get_keys_with_http_info(resource_group_name, project_name, custom_headers:nil)
683
+ get_keys_async(resource_group_name, project_name, custom_headers:custom_headers).value!
684
+ end
685
+
686
+ #
687
+ # Get shared keys for the project.
688
+ #
689
+ # Gets the Log Analytics Workspace ID and Primary Key for the specified
690
+ # project.
691
+ #
692
+ # @param resource_group_name [String] Name of the Azure Resource Group that
693
+ # project is part of.
694
+ # @param project_name [String] Name of the Azure Migrate project.
695
+ # @param [Hash{String => String}] A hash of custom headers that will be added
696
+ # to the HTTP request.
697
+ #
698
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
699
+ #
700
+ def get_keys_async(resource_group_name, project_name, custom_headers:nil)
701
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
702
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
703
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
704
+ @client.api_version = '2018-02-02'
705
+
706
+
707
+ request_headers = {}
708
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
709
+
710
+ # Set Headers
711
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
712
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
713
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/keys'
714
+
715
+ request_url = @base_url || @client.base_url
716
+
717
+ options = {
718
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
719
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name},
720
+ query_params: {'api-version' => @client.api_version},
721
+ headers: request_headers.merge(custom_headers || {}),
722
+ base_url: request_url
723
+ }
724
+ promise = @client.make_request_async(:post, path_template, options)
725
+
726
+ promise = promise.then do |result|
727
+ http_response = result.response
728
+ status_code = http_response.status
729
+ response_content = http_response.body
730
+ unless status_code == 200
731
+ error_model = JSON.load(response_content)
732
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
733
+ end
734
+
735
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
736
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
737
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
738
+ # Deserialize Response
739
+ if status_code == 200
740
+ begin
741
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
742
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::ProjectKey.mapper()
743
+ result.body = @client.deserialize(result_mapper, parsed_response)
744
+ rescue Exception => e
745
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
746
+ end
747
+ end
748
+
749
+ result
750
+ end
751
+
752
+ promise.execute
753
+ end
754
+
755
+ end
756
+ end