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,160 @@
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
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class AzureMigrate < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Azure Subscription Id in which project was created.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] Standard request header. Used by service to identify API
24
+ # version used by client.
25
+ attr_reader :api_version
26
+
27
+ # @return [String] Standard request header. Used by service to respond to
28
+ # client in appropriate language.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] The retry timeout in seconds for Long Running
32
+ # Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
36
+ # generated. When set to true a unique x-ms-client-request-id value is
37
+ # generated and included in each request. Default is true.
38
+ attr_accessor :generate_client_request_id
39
+
40
+ # @return [Location] location
41
+ attr_reader :location
42
+
43
+ # @return [AssessmentOptions] assessment_options
44
+ attr_reader :assessment_options
45
+
46
+ # @return [Projects] projects
47
+ attr_reader :projects
48
+
49
+ # @return [Machines] machines
50
+ attr_reader :machines
51
+
52
+ # @return [Groups] groups
53
+ attr_reader :groups
54
+
55
+ # @return [Assessments] assessments
56
+ attr_reader :assessments
57
+
58
+ # @return [AssessedMachines] assessed_machines
59
+ attr_reader :assessed_machines
60
+
61
+ # @return [Operations] operations
62
+ attr_reader :operations
63
+
64
+ #
65
+ # Creates initializes a new instance of the AzureMigrate class.
66
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
67
+ # @param base_url [String] the base URI of the service.
68
+ # @param options [Array] filters to be applied to the HTTP requests.
69
+ #
70
+ def initialize(credentials = nil, base_url = nil, options = nil)
71
+ super(credentials, options)
72
+ @base_url = base_url || 'https://management.azure.com'
73
+
74
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
75
+ @credentials = credentials
76
+
77
+ @location = Location.new(self)
78
+ @assessment_options = AssessmentOptions.new(self)
79
+ @projects = Projects.new(self)
80
+ @machines = Machines.new(self)
81
+ @groups = Groups.new(self)
82
+ @assessments = Assessments.new(self)
83
+ @assessed_machines = AssessedMachines.new(self)
84
+ @operations = Operations.new(self)
85
+ @api_version = '2018-02-02'
86
+ @long_running_operation_retry_timeout = 30
87
+ @generate_client_request_id = true
88
+ add_telemetry
89
+ end
90
+
91
+ #
92
+ # Makes a request and returns the body of the response.
93
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
94
+ # @param path [String] the path, relative to {base_url}.
95
+ # @param options [Hash{String=>String}] specifying any request options like :body.
96
+ # @return [Hash{String=>String}] containing the body of the response.
97
+ # Example:
98
+ #
99
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
100
+ # path = "/path"
101
+ # options = {
102
+ # body: request_content,
103
+ # query_params: {'api-version' => '2016-02-01'}
104
+ # }
105
+ # result = @client.make_request(:put, path, options)
106
+ #
107
+ def make_request(method, path, options = {})
108
+ result = make_request_with_http_info(method, path, options)
109
+ result.body unless result.nil?
110
+ end
111
+
112
+ #
113
+ # Makes a request and returns the operation response.
114
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
115
+ # @param path [String] the path, relative to {base_url}.
116
+ # @param options [Hash{String=>String}] specifying any request options like :body.
117
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
118
+ #
119
+ def make_request_with_http_info(method, path, options = {})
120
+ result = make_request_async(method, path, options).value!
121
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
122
+ result
123
+ end
124
+
125
+ #
126
+ # Makes a request asynchronously.
127
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
128
+ # @param path [String] the path, relative to {base_url}.
129
+ # @param options [Hash{String=>String}] specifying any request options like :body.
130
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
131
+ #
132
+ def make_request_async(method, path, options = {})
133
+ fail ArgumentError, 'method is nil' if method.nil?
134
+ fail ArgumentError, 'path is nil' if path.nil?
135
+
136
+ request_url = options[:base_url] || @base_url
137
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
138
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
139
+ end
140
+
141
+ request_headers = @request_headers
142
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
143
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
144
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
145
+
146
+ super(request_url, method, path, options)
147
+ end
148
+
149
+
150
+ private
151
+ #
152
+ # Adds telemetry information.
153
+ #
154
+ def add_telemetry
155
+ sdk_information = 'azure_mgmt_migrate'
156
+ sdk_information = "#{sdk_information}/0.17.0"
157
+ add_user_agent_information(sdk_information)
158
+ end
159
+ end
160
+ end
@@ -0,0 +1,506 @@
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 Groups
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Groups 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 groups
26
+ #
27
+ # Get all groups created in the project. Returns a json array of objects of
28
+ # type 'group' as specified in the Models section.
29
+ #
30
+ # @param resource_group_name [String] Name of the Azure Resource Group that
31
+ # project is part of.
32
+ # @param project_name [String] Name of the Azure Migrate project.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [GroupResultList] operation results.
37
+ #
38
+ def list_by_project(resource_group_name, project_name, custom_headers:nil)
39
+ response = list_by_project_async(resource_group_name, project_name, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Get all groups
45
+ #
46
+ # Get all groups created in the project. Returns a json array of objects of
47
+ # type 'group' as specified in the Models section.
48
+ #
49
+ # @param resource_group_name [String] Name of the Azure Resource Group that
50
+ # project is part of.
51
+ # @param project_name [String] Name of the Azure Migrate project.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def list_by_project_with_http_info(resource_group_name, project_name, custom_headers:nil)
58
+ list_by_project_async(resource_group_name, project_name, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Get all groups
63
+ #
64
+ # Get all groups created in the project. Returns a json array of objects of
65
+ # type 'group' as specified in the Models section.
66
+ #
67
+ # @param resource_group_name [String] Name of the Azure Resource Group that
68
+ # project is part of.
69
+ # @param project_name [String] Name of the Azure Migrate project.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def list_by_project_async(resource_group_name, project_name, custom_headers:nil)
76
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
77
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
78
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
79
+ @client.api_version = '2018-02-02'
80
+
81
+
82
+ request_headers = {}
83
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
84
+
85
+ # Set Headers
86
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
87
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
88
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/groups'
89
+
90
+ request_url = @base_url || @client.base_url
91
+
92
+ options = {
93
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
94
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name},
95
+ query_params: {'api-version' => @client.api_version},
96
+ headers: request_headers.merge(custom_headers || {}),
97
+ base_url: request_url
98
+ }
99
+ promise = @client.make_request_async(:get, path_template, options)
100
+
101
+ promise = promise.then do |result|
102
+ http_response = result.response
103
+ status_code = http_response.status
104
+ response_content = http_response.body
105
+ unless status_code == 200
106
+ error_model = JSON.load(response_content)
107
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
108
+ end
109
+
110
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
111
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
112
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
113
+ # Deserialize Response
114
+ if status_code == 200
115
+ begin
116
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
117
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::GroupResultList.mapper()
118
+ result.body = @client.deserialize(result_mapper, parsed_response)
119
+ rescue Exception => e
120
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
121
+ end
122
+ end
123
+
124
+ result
125
+ end
126
+
127
+ promise.execute
128
+ end
129
+
130
+ #
131
+ # Get a specific group.
132
+ #
133
+ # Get information related to a specific group in the project. Returns a json
134
+ # object of type 'group' as specified in the models section.
135
+ #
136
+ # @param resource_group_name [String] Name of the Azure Resource Group that
137
+ # project is part of.
138
+ # @param project_name [String] Name of the Azure Migrate project.
139
+ # @param group_name [String] Unique name of a group within a project.
140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
+ # will be added to the HTTP request.
142
+ #
143
+ # @return [Group] operation results.
144
+ #
145
+ def get(resource_group_name, project_name, group_name, custom_headers:nil)
146
+ response = get_async(resource_group_name, project_name, group_name, custom_headers:custom_headers).value!
147
+ response.body unless response.nil?
148
+ end
149
+
150
+ #
151
+ # Get a specific group.
152
+ #
153
+ # Get information related to a specific group in the project. Returns a json
154
+ # object of type 'group' as specified in the models section.
155
+ #
156
+ # @param resource_group_name [String] Name of the Azure Resource Group that
157
+ # project is part of.
158
+ # @param project_name [String] Name of the Azure Migrate project.
159
+ # @param group_name [String] Unique name of a group within a project.
160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
161
+ # will be added to the HTTP request.
162
+ #
163
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
164
+ #
165
+ def get_with_http_info(resource_group_name, project_name, group_name, custom_headers:nil)
166
+ get_async(resource_group_name, project_name, group_name, custom_headers:custom_headers).value!
167
+ end
168
+
169
+ #
170
+ # Get a specific group.
171
+ #
172
+ # Get information related to a specific group in the project. Returns a json
173
+ # object of type 'group' as specified in the models section.
174
+ #
175
+ # @param resource_group_name [String] Name of the Azure Resource Group that
176
+ # project is part of.
177
+ # @param project_name [String] Name of the Azure Migrate project.
178
+ # @param group_name [String] Unique name of a group within a project.
179
+ # @param [Hash{String => String}] A hash of custom headers that will be added
180
+ # to the HTTP request.
181
+ #
182
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
183
+ #
184
+ def get_async(resource_group_name, project_name, group_name, custom_headers:nil)
185
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
186
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
187
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
188
+ fail ArgumentError, 'group_name is nil' if group_name.nil?
189
+ @client.api_version = '2018-02-02'
190
+
191
+
192
+ request_headers = {}
193
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
194
+
195
+ # Set Headers
196
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
197
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
198
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/groups/{groupName}'
199
+
200
+ request_url = @base_url || @client.base_url
201
+
202
+ options = {
203
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
204
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name,'groupName' => group_name},
205
+ query_params: {'api-version' => @client.api_version},
206
+ headers: request_headers.merge(custom_headers || {}),
207
+ base_url: request_url
208
+ }
209
+ promise = @client.make_request_async(:get, path_template, options)
210
+
211
+ promise = promise.then do |result|
212
+ http_response = result.response
213
+ status_code = http_response.status
214
+ response_content = http_response.body
215
+ unless status_code == 200
216
+ error_model = JSON.load(response_content)
217
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
218
+ end
219
+
220
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
221
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
222
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
223
+ # Deserialize Response
224
+ if status_code == 200
225
+ begin
226
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
227
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Group.mapper()
228
+ result.body = @client.deserialize(result_mapper, parsed_response)
229
+ rescue Exception => e
230
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
231
+ end
232
+ end
233
+
234
+ result
235
+ end
236
+
237
+ promise.execute
238
+ end
239
+
240
+ #
241
+ # Create a new group with specified settings. If group with the name provided
242
+ # already exists, then the existing group is updated.
243
+ #
244
+ # Create a new group by sending a json object of type 'group' as given in
245
+ # Models section as part of the Request Body. The group name in a project is
246
+ # unique. Labels can be applied on a group as part of creation.
247
+ #
248
+ # If a group with the groupName specified in the URL already exists, then this
249
+ # call acts as an update.
250
+ #
251
+ # This operation is Idempotent.
252
+ #
253
+ #
254
+ # @param resource_group_name [String] Name of the Azure Resource Group that
255
+ # project is part of.
256
+ # @param project_name [String] Name of the Azure Migrate project.
257
+ # @param group_name [String] Unique name of a group within a project.
258
+ # @param group [Group] New or Updated Group object.
259
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
260
+ # will be added to the HTTP request.
261
+ #
262
+ # @return [Group] operation results.
263
+ #
264
+ def create(resource_group_name, project_name, group_name, group:nil, custom_headers:nil)
265
+ response = create_async(resource_group_name, project_name, group_name, group:group, custom_headers:custom_headers).value!
266
+ response.body unless response.nil?
267
+ end
268
+
269
+ #
270
+ # Create a new group with specified settings. If group with the name provided
271
+ # already exists, then the existing group is updated.
272
+ #
273
+ # Create a new group by sending a json object of type 'group' as given in
274
+ # Models section as part of the Request Body. The group name in a project is
275
+ # unique. Labels can be applied on a group as part of creation.
276
+ #
277
+ # If a group with the groupName specified in the URL already exists, then this
278
+ # call acts as an update.
279
+ #
280
+ # This operation is Idempotent.
281
+ #
282
+ #
283
+ # @param resource_group_name [String] Name of the Azure Resource Group that
284
+ # project is part of.
285
+ # @param project_name [String] Name of the Azure Migrate project.
286
+ # @param group_name [String] Unique name of a group within a project.
287
+ # @param group [Group] New or Updated Group object.
288
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
289
+ # will be added to the HTTP request.
290
+ #
291
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
292
+ #
293
+ def create_with_http_info(resource_group_name, project_name, group_name, group:nil, custom_headers:nil)
294
+ create_async(resource_group_name, project_name, group_name, group:group, custom_headers:custom_headers).value!
295
+ end
296
+
297
+ #
298
+ # Create a new group with specified settings. If group with the name provided
299
+ # already exists, then the existing group is updated.
300
+ #
301
+ # Create a new group by sending a json object of type 'group' as given in
302
+ # Models section as part of the Request Body. The group name in a project is
303
+ # unique. Labels can be applied on a group as part of creation.
304
+ #
305
+ # If a group with the groupName specified in the URL already exists, then this
306
+ # call acts as an update.
307
+ #
308
+ # This operation is Idempotent.
309
+ #
310
+ #
311
+ # @param resource_group_name [String] Name of the Azure Resource Group that
312
+ # project is part of.
313
+ # @param project_name [String] Name of the Azure Migrate project.
314
+ # @param group_name [String] Unique name of a group within a project.
315
+ # @param group [Group] New or Updated Group object.
316
+ # @param [Hash{String => String}] A hash of custom headers that will be added
317
+ # to the HTTP request.
318
+ #
319
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
320
+ #
321
+ def create_async(resource_group_name, project_name, group_name, group:nil, custom_headers:nil)
322
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
323
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
324
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
325
+ fail ArgumentError, 'group_name is nil' if group_name.nil?
326
+ @client.api_version = '2018-02-02'
327
+
328
+
329
+ request_headers = {}
330
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
331
+
332
+ # Set Headers
333
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
334
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
335
+
336
+ # Serialize Request
337
+ request_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Group.mapper()
338
+ request_content = @client.serialize(request_mapper, group)
339
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
340
+
341
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/groups/{groupName}'
342
+
343
+ request_url = @base_url || @client.base_url
344
+
345
+ options = {
346
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
347
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name,'groupName' => group_name},
348
+ query_params: {'api-version' => @client.api_version},
349
+ body: request_content,
350
+ headers: request_headers.merge(custom_headers || {}),
351
+ base_url: request_url
352
+ }
353
+ promise = @client.make_request_async(:put, path_template, options)
354
+
355
+ promise = promise.then do |result|
356
+ http_response = result.response
357
+ status_code = http_response.status
358
+ response_content = http_response.body
359
+ unless status_code == 200 || status_code == 201
360
+ error_model = JSON.load(response_content)
361
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
362
+ end
363
+
364
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
365
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
366
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
367
+ # Deserialize Response
368
+ if status_code == 200
369
+ begin
370
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
371
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Group.mapper()
372
+ result.body = @client.deserialize(result_mapper, parsed_response)
373
+ rescue Exception => e
374
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
375
+ end
376
+ end
377
+ # Deserialize Response
378
+ if status_code == 201
379
+ begin
380
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
381
+ result_mapper = Azure::Migrate::Mgmt::V2018_02_02::Models::Group.mapper()
382
+ result.body = @client.deserialize(result_mapper, parsed_response)
383
+ rescue Exception => e
384
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
385
+ end
386
+ end
387
+
388
+ result
389
+ end
390
+
391
+ promise.execute
392
+ end
393
+
394
+ #
395
+ # Delete the group
396
+ #
397
+ # Delete the group from the project. The machines remain in the project.
398
+ # Deleting a non-existent group results in a no-operation.
399
+ #
400
+ # A group is an aggregation mechanism for machines in a project. Therefore,
401
+ # deleting group does not delete machines in it.
402
+ #
403
+ #
404
+ # @param resource_group_name [String] Name of the Azure Resource Group that
405
+ # project is part of.
406
+ # @param project_name [String] Name of the Azure Migrate project.
407
+ # @param group_name [String] Unique name of a group within a project.
408
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
409
+ # will be added to the HTTP request.
410
+ #
411
+ #
412
+ def delete(resource_group_name, project_name, group_name, custom_headers:nil)
413
+ response = delete_async(resource_group_name, project_name, group_name, custom_headers:custom_headers).value!
414
+ nil
415
+ end
416
+
417
+ #
418
+ # Delete the group
419
+ #
420
+ # Delete the group from the project. The machines remain in the project.
421
+ # Deleting a non-existent group results in a no-operation.
422
+ #
423
+ # A group is an aggregation mechanism for machines in a project. Therefore,
424
+ # deleting group does not delete machines in it.
425
+ #
426
+ #
427
+ # @param resource_group_name [String] Name of the Azure Resource Group that
428
+ # project is part of.
429
+ # @param project_name [String] Name of the Azure Migrate project.
430
+ # @param group_name [String] Unique name of a group within a project.
431
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
432
+ # will be added to the HTTP request.
433
+ #
434
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
435
+ #
436
+ def delete_with_http_info(resource_group_name, project_name, group_name, custom_headers:nil)
437
+ delete_async(resource_group_name, project_name, group_name, custom_headers:custom_headers).value!
438
+ end
439
+
440
+ #
441
+ # Delete the group
442
+ #
443
+ # Delete the group from the project. The machines remain in the project.
444
+ # Deleting a non-existent group results in a no-operation.
445
+ #
446
+ # A group is an aggregation mechanism for machines in a project. Therefore,
447
+ # deleting group does not delete machines in it.
448
+ #
449
+ #
450
+ # @param resource_group_name [String] Name of the Azure Resource Group that
451
+ # project is part of.
452
+ # @param project_name [String] Name of the Azure Migrate project.
453
+ # @param group_name [String] Unique name of a group within a project.
454
+ # @param [Hash{String => String}] A hash of custom headers that will be added
455
+ # to the HTTP request.
456
+ #
457
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
458
+ #
459
+ def delete_async(resource_group_name, project_name, group_name, custom_headers:nil)
460
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
461
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
462
+ fail ArgumentError, 'project_name is nil' if project_name.nil?
463
+ fail ArgumentError, 'group_name is nil' if group_name.nil?
464
+ @client.api_version = '2018-02-02'
465
+
466
+
467
+ request_headers = {}
468
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
469
+
470
+ # Set Headers
471
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
472
+ request_headers['Accept-Language'] = @client.accept_language unless @client.accept_language.nil?
473
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/projects/{projectName}/groups/{groupName}'
474
+
475
+ request_url = @base_url || @client.base_url
476
+
477
+ options = {
478
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
479
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'projectName' => project_name,'groupName' => group_name},
480
+ query_params: {'api-version' => @client.api_version},
481
+ headers: request_headers.merge(custom_headers || {}),
482
+ base_url: request_url
483
+ }
484
+ promise = @client.make_request_async(:delete, path_template, options)
485
+
486
+ promise = promise.then do |result|
487
+ http_response = result.response
488
+ status_code = http_response.status
489
+ response_content = http_response.body
490
+ unless status_code == 200
491
+ error_model = JSON.load(response_content)
492
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
493
+ end
494
+
495
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
496
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
497
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
498
+
499
+ result
500
+ end
501
+
502
+ promise.execute
503
+ end
504
+
505
+ end
506
+ end