azure_mgmt_advisor 0.17.0 → 0.17.1

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 (50) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/advisor_management_client.rb +1 -1
  3. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/operations.rb +4 -0
  4. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/recommendations.rb +10 -0
  5. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/suppressions.rb +8 -0
  6. data/lib/2017-03-31/generated/azure_mgmt_advisor/advisor_management_client.rb +1 -1
  7. data/lib/2017-03-31/generated/azure_mgmt_advisor/operations.rb +4 -0
  8. data/lib/2017-03-31/generated/azure_mgmt_advisor/recommendations.rb +10 -0
  9. data/lib/2017-03-31/generated/azure_mgmt_advisor/suppressions.rb +8 -0
  10. data/lib/2017-04-19/generated/azure_mgmt_advisor/advisor_management_client.rb +1 -1
  11. data/lib/2017-04-19/generated/azure_mgmt_advisor/configurations.rb +10 -0
  12. data/lib/2017-04-19/generated/azure_mgmt_advisor/operations.rb +4 -0
  13. data/lib/2017-04-19/generated/azure_mgmt_advisor/recommendations.rb +10 -0
  14. data/lib/2017-04-19/generated/azure_mgmt_advisor/suppressions.rb +10 -0
  15. data/lib/2020-01-01/generated/azure_mgmt_advisor.rb +56 -0
  16. data/lib/2020-01-01/generated/azure_mgmt_advisor/advisor_management_client.rb +148 -0
  17. data/lib/2020-01-01/generated/azure_mgmt_advisor/configurations.rb +547 -0
  18. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/arm_error_response.rb +48 -0
  19. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/armerror_response_body.rb +59 -0
  20. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/category.rb +19 -0
  21. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/config_data.rb +108 -0
  22. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/configuration_list_result.rb +98 -0
  23. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/cpu_threshold.rb +18 -0
  24. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/digest_config.rb +115 -0
  25. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/digest_config_state.rb +16 -0
  26. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/impact.rb +17 -0
  27. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/metadata_entity.rb +140 -0
  28. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/metadata_entity_list_result.rb +98 -0
  29. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/metadata_supported_value_detail.rb +57 -0
  30. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/operation_display_info.rb +80 -0
  31. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/operation_entity.rb +58 -0
  32. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/operation_entity_list_result.rb +98 -0
  33. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/resource.rb +80 -0
  34. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/resource_metadata.rb +57 -0
  35. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/resource_recommendation_base.rb +225 -0
  36. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/resource_recommendation_base_list_result.rb +99 -0
  37. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/risk.rb +17 -0
  38. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/scenario.rb +15 -0
  39. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/short_description.rb +59 -0
  40. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/suppression_contract.rb +85 -0
  41. data/lib/2020-01-01/generated/azure_mgmt_advisor/models/suppression_contract_list_result.rb +98 -0
  42. data/lib/2020-01-01/generated/azure_mgmt_advisor/module_definition.rb +9 -0
  43. data/lib/2020-01-01/generated/azure_mgmt_advisor/operations.rb +219 -0
  44. data/lib/2020-01-01/generated/azure_mgmt_advisor/recommendation_metadata.rb +318 -0
  45. data/lib/2020-01-01/generated/azure_mgmt_advisor/recommendations.rb +513 -0
  46. data/lib/2020-01-01/generated/azure_mgmt_advisor/suppressions.rb +563 -0
  47. data/lib/azure_mgmt_advisor.rb +2 -1
  48. data/lib/profiles/latest/modules/advisor_profile_module.rb +80 -46
  49. data/lib/version.rb +1 -1
  50. metadata +37 -5
@@ -0,0 +1,148 @@
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::Advisor::Mgmt::V2020_01_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class AdvisorManagementClient < 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] The Azure subscription ID.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] The version of the API to be used with the client
24
+ # request.
25
+ attr_reader :api_version
26
+
27
+ # @return [String] The preferred language for the response.
28
+ attr_accessor :accept_language
29
+
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
+ attr_accessor :long_running_operation_retry_timeout
33
+
34
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
35
+ # generated. When set to true a unique x-ms-client-request-id value is
36
+ # generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return [RecommendationMetadata] recommendation_metadata
40
+ attr_reader :recommendation_metadata
41
+
42
+ # @return [Configurations] configurations
43
+ attr_reader :configurations
44
+
45
+ # @return [Recommendations] recommendations
46
+ attr_reader :recommendations
47
+
48
+ # @return [Operations] operations
49
+ attr_reader :operations
50
+
51
+ # @return [Suppressions] suppressions
52
+ attr_reader :suppressions
53
+
54
+ #
55
+ # Creates initializes a new instance of the AdvisorManagementClient class.
56
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
57
+ # @param base_url [String] the base URI of the service.
58
+ # @param options [Array] filters to be applied to the HTTP requests.
59
+ #
60
+ def initialize(credentials = nil, base_url = nil, options = nil)
61
+ super(credentials, options)
62
+ @base_url = base_url || 'https://management.azure.com'
63
+
64
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
65
+ @credentials = credentials
66
+
67
+ @recommendation_metadata = RecommendationMetadata.new(self)
68
+ @configurations = Configurations.new(self)
69
+ @recommendations = Recommendations.new(self)
70
+ @operations = Operations.new(self)
71
+ @suppressions = Suppressions.new(self)
72
+ @api_version = '2020-01-01'
73
+ @accept_language = 'en-US'
74
+ @long_running_operation_retry_timeout = 30
75
+ @generate_client_request_id = true
76
+ add_telemetry
77
+ end
78
+
79
+ #
80
+ # Makes a request and returns the body of the response.
81
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
82
+ # @param path [String] the path, relative to {base_url}.
83
+ # @param options [Hash{String=>String}] specifying any request options like :body.
84
+ # @return [Hash{String=>String}] containing the body of the response.
85
+ # Example:
86
+ #
87
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
88
+ # path = "/path"
89
+ # options = {
90
+ # body: request_content,
91
+ # query_params: {'api-version' => '2016-02-01'}
92
+ # }
93
+ # result = @client.make_request(:put, path, options)
94
+ #
95
+ def make_request(method, path, options = {})
96
+ result = make_request_with_http_info(method, path, options)
97
+ result.body unless result.nil?
98
+ end
99
+
100
+ #
101
+ # Makes a request and returns the operation response.
102
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
103
+ # @param path [String] the path, relative to {base_url}.
104
+ # @param options [Hash{String=>String}] specifying any request options like :body.
105
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
106
+ #
107
+ def make_request_with_http_info(method, path, options = {})
108
+ result = make_request_async(method, path, options).value!
109
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
110
+ result
111
+ end
112
+
113
+ #
114
+ # Makes a request asynchronously.
115
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
116
+ # @param path [String] the path, relative to {base_url}.
117
+ # @param options [Hash{String=>String}] specifying any request options like :body.
118
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
119
+ #
120
+ def make_request_async(method, path, options = {})
121
+ fail ArgumentError, 'method is nil' if method.nil?
122
+ fail ArgumentError, 'path is nil' if path.nil?
123
+
124
+ request_url = options[:base_url] || @base_url
125
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
126
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
127
+ end
128
+
129
+ request_headers = @request_headers
130
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
131
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
132
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
133
+
134
+ super(request_url, method, path, options)
135
+ end
136
+
137
+
138
+ private
139
+ #
140
+ # Adds telemetry information.
141
+ #
142
+ def add_telemetry
143
+ sdk_information = 'azure_mgmt_advisor'
144
+ sdk_information = "#{sdk_information}/0.17.1"
145
+ add_user_agent_information(sdk_information)
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,547 @@
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::Advisor::Mgmt::V2020_01_01
7
+ #
8
+ # REST APIs for Azure Advisor
9
+ #
10
+ class Configurations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Configurations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AdvisorManagementClient] reference to the AdvisorManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Retrieve Azure Advisor configurations.
26
+ #
27
+ # Retrieve Azure Advisor configurations and also retrieve configurations of
28
+ # contained resource groups.
29
+ #
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<ConfigData>] operation results.
34
+ #
35
+ def list_by_subscription(custom_headers:nil)
36
+ first_page = list_by_subscription_as_lazy(custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Retrieve Azure Advisor configurations.
42
+ #
43
+ # Retrieve Azure Advisor configurations and also retrieve configurations of
44
+ # contained resource groups.
45
+ #
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_by_subscription_with_http_info(custom_headers:nil)
52
+ list_by_subscription_async(custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Retrieve Azure Advisor configurations.
57
+ #
58
+ # Retrieve Azure Advisor configurations and also retrieve configurations of
59
+ # contained resource groups.
60
+ #
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_by_subscription_async(custom_headers:nil)
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+
70
+
71
+ request_headers = {}
72
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
73
+
74
+ # Set Headers
75
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
76
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
77
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations'
78
+
79
+ request_url = @base_url || @client.base_url
80
+
81
+ options = {
82
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
83
+ path_params: {'subscriptionId' => @client.subscription_id},
84
+ query_params: {'api-version' => @client.api_version},
85
+ headers: request_headers.merge(custom_headers || {}),
86
+ base_url: request_url
87
+ }
88
+ promise = @client.make_request_async(:get, path_template, options)
89
+
90
+ promise = promise.then do |result|
91
+ http_response = result.response
92
+ status_code = http_response.status
93
+ response_content = http_response.body
94
+ unless status_code == 200
95
+ error_model = JSON.load(response_content)
96
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
97
+ end
98
+
99
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
100
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
101
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
102
+ # Deserialize Response
103
+ if status_code == 200
104
+ begin
105
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
106
+ result_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::ConfigurationListResult.mapper()
107
+ result.body = @client.deserialize(result_mapper, parsed_response)
108
+ rescue Exception => e
109
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
110
+ end
111
+ end
112
+
113
+ result
114
+ end
115
+
116
+ promise.execute
117
+ end
118
+
119
+ #
120
+ # Create/Overwrite Azure Advisor configuration.
121
+ #
122
+ # Create/Overwrite Azure Advisor configuration and also delete all
123
+ # configurations of contained resource groups.
124
+ #
125
+ # @param config_contract [ConfigData] The Azure Advisor configuration data
126
+ # structure.
127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
128
+ # will be added to the HTTP request.
129
+ #
130
+ # @return [ConfigData] operation results.
131
+ #
132
+ def create_in_subscription(config_contract, custom_headers:nil)
133
+ response = create_in_subscription_async(config_contract, custom_headers:custom_headers).value!
134
+ response.body unless response.nil?
135
+ end
136
+
137
+ #
138
+ # Create/Overwrite Azure Advisor configuration.
139
+ #
140
+ # Create/Overwrite Azure Advisor configuration and also delete all
141
+ # configurations of contained resource groups.
142
+ #
143
+ # @param config_contract [ConfigData] The Azure Advisor configuration data
144
+ # structure.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
149
+ #
150
+ def create_in_subscription_with_http_info(config_contract, custom_headers:nil)
151
+ create_in_subscription_async(config_contract, custom_headers:custom_headers).value!
152
+ end
153
+
154
+ #
155
+ # Create/Overwrite Azure Advisor configuration.
156
+ #
157
+ # Create/Overwrite Azure Advisor configuration and also delete all
158
+ # configurations of contained resource groups.
159
+ #
160
+ # @param config_contract [ConfigData] The Azure Advisor configuration data
161
+ # structure.
162
+ # @param [Hash{String => String}] A hash of custom headers that will be added
163
+ # to the HTTP request.
164
+ #
165
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
166
+ #
167
+ def create_in_subscription_async(config_contract, custom_headers:nil)
168
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
169
+ fail ArgumentError, 'config_contract is nil' if config_contract.nil?
170
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
171
+ configuration_name = 'default'
172
+
173
+
174
+ request_headers = {}
175
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
176
+
177
+ # Set Headers
178
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
179
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
180
+
181
+ # Serialize Request
182
+ request_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::ConfigData.mapper()
183
+ request_content = @client.serialize(request_mapper, config_contract)
184
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
185
+
186
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}'
187
+
188
+ request_url = @base_url || @client.base_url
189
+
190
+ options = {
191
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
192
+ path_params: {'subscriptionId' => @client.subscription_id,'configurationName' => configuration_name},
193
+ query_params: {'api-version' => @client.api_version},
194
+ body: request_content,
195
+ headers: request_headers.merge(custom_headers || {}),
196
+ base_url: request_url
197
+ }
198
+ promise = @client.make_request_async(:put, path_template, options)
199
+
200
+ promise = promise.then do |result|
201
+ http_response = result.response
202
+ status_code = http_response.status
203
+ response_content = http_response.body
204
+ unless status_code == 200
205
+ error_model = JSON.load(response_content)
206
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
207
+ end
208
+
209
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
210
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
211
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
212
+ # Deserialize Response
213
+ if status_code == 200
214
+ begin
215
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
216
+ result_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::ConfigData.mapper()
217
+ result.body = @client.deserialize(result_mapper, parsed_response)
218
+ rescue Exception => e
219
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
220
+ end
221
+ end
222
+
223
+ result
224
+ end
225
+
226
+ promise.execute
227
+ end
228
+
229
+ #
230
+ # Retrieve Azure Advisor configurations.
231
+ #
232
+ # @param resource_group [String] The name of the Azure resource group.
233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
234
+ # will be added to the HTTP request.
235
+ #
236
+ # @return [ConfigurationListResult] operation results.
237
+ #
238
+ def list_by_resource_group(resource_group, custom_headers:nil)
239
+ response = list_by_resource_group_async(resource_group, custom_headers:custom_headers).value!
240
+ response.body unless response.nil?
241
+ end
242
+
243
+ #
244
+ # Retrieve Azure Advisor configurations.
245
+ #
246
+ # @param resource_group [String] The name of the Azure resource group.
247
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
248
+ # will be added to the HTTP request.
249
+ #
250
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
251
+ #
252
+ def list_by_resource_group_with_http_info(resource_group, custom_headers:nil)
253
+ list_by_resource_group_async(resource_group, custom_headers:custom_headers).value!
254
+ end
255
+
256
+ #
257
+ # Retrieve Azure Advisor configurations.
258
+ #
259
+ # @param resource_group [String] The name of the Azure resource group.
260
+ # @param [Hash{String => String}] A hash of custom headers that will be added
261
+ # to the HTTP request.
262
+ #
263
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
264
+ #
265
+ def list_by_resource_group_async(resource_group, custom_headers:nil)
266
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
267
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
268
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
269
+
270
+
271
+ request_headers = {}
272
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
273
+
274
+ # Set Headers
275
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
276
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
277
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations'
278
+
279
+ request_url = @base_url || @client.base_url
280
+
281
+ options = {
282
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
283
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group},
284
+ query_params: {'api-version' => @client.api_version},
285
+ headers: request_headers.merge(custom_headers || {}),
286
+ base_url: request_url
287
+ }
288
+ promise = @client.make_request_async(:get, path_template, options)
289
+
290
+ promise = promise.then do |result|
291
+ http_response = result.response
292
+ status_code = http_response.status
293
+ response_content = http_response.body
294
+ unless status_code == 200
295
+ error_model = JSON.load(response_content)
296
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
297
+ end
298
+
299
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
300
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
301
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
302
+ # Deserialize Response
303
+ if status_code == 200
304
+ begin
305
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
306
+ result_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::ConfigurationListResult.mapper()
307
+ result.body = @client.deserialize(result_mapper, parsed_response)
308
+ rescue Exception => e
309
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
310
+ end
311
+ end
312
+
313
+ result
314
+ end
315
+
316
+ promise.execute
317
+ end
318
+
319
+ #
320
+ # Create/Overwrite Azure Advisor configuration.
321
+ #
322
+ # @param config_contract [ConfigData] The Azure Advisor configuration data
323
+ # structure.
324
+ # @param resource_group [String] The name of the Azure resource group.
325
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
326
+ # will be added to the HTTP request.
327
+ #
328
+ # @return [ConfigData] operation results.
329
+ #
330
+ def create_in_resource_group(config_contract, resource_group, custom_headers:nil)
331
+ response = create_in_resource_group_async(config_contract, resource_group, custom_headers:custom_headers).value!
332
+ response.body unless response.nil?
333
+ end
334
+
335
+ #
336
+ # Create/Overwrite Azure Advisor configuration.
337
+ #
338
+ # @param config_contract [ConfigData] The Azure Advisor configuration data
339
+ # structure.
340
+ # @param resource_group [String] The name of the Azure resource group.
341
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
342
+ # will be added to the HTTP request.
343
+ #
344
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
345
+ #
346
+ def create_in_resource_group_with_http_info(config_contract, resource_group, custom_headers:nil)
347
+ create_in_resource_group_async(config_contract, resource_group, custom_headers:custom_headers).value!
348
+ end
349
+
350
+ #
351
+ # Create/Overwrite Azure Advisor configuration.
352
+ #
353
+ # @param config_contract [ConfigData] The Azure Advisor configuration data
354
+ # structure.
355
+ # @param resource_group [String] The name of the Azure resource group.
356
+ # @param [Hash{String => String}] A hash of custom headers that will be added
357
+ # to the HTTP request.
358
+ #
359
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
360
+ #
361
+ def create_in_resource_group_async(config_contract, resource_group, custom_headers:nil)
362
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
363
+ fail ArgumentError, 'config_contract is nil' if config_contract.nil?
364
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
365
+ configuration_name = 'default'
366
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
367
+
368
+
369
+ request_headers = {}
370
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
371
+
372
+ # Set Headers
373
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
374
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
375
+
376
+ # Serialize Request
377
+ request_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::ConfigData.mapper()
378
+ request_content = @client.serialize(request_mapper, config_contract)
379
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
380
+
381
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}'
382
+
383
+ request_url = @base_url || @client.base_url
384
+
385
+ options = {
386
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
387
+ path_params: {'subscriptionId' => @client.subscription_id,'configurationName' => configuration_name,'resourceGroup' => resource_group},
388
+ query_params: {'api-version' => @client.api_version},
389
+ body: request_content,
390
+ headers: request_headers.merge(custom_headers || {}),
391
+ base_url: request_url
392
+ }
393
+ promise = @client.make_request_async(:put, path_template, options)
394
+
395
+ promise = promise.then do |result|
396
+ http_response = result.response
397
+ status_code = http_response.status
398
+ response_content = http_response.body
399
+ unless status_code == 200
400
+ error_model = JSON.load(response_content)
401
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
402
+ end
403
+
404
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
405
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
406
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
407
+ # Deserialize Response
408
+ if status_code == 200
409
+ begin
410
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
411
+ result_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::ConfigData.mapper()
412
+ result.body = @client.deserialize(result_mapper, parsed_response)
413
+ rescue Exception => e
414
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
415
+ end
416
+ end
417
+
418
+ result
419
+ end
420
+
421
+ promise.execute
422
+ end
423
+
424
+ #
425
+ # Retrieve Azure Advisor configurations.
426
+ #
427
+ # Retrieve Azure Advisor configurations and also retrieve configurations of
428
+ # contained resource groups.
429
+ #
430
+ # @param next_page_link [String] The NextLink from the previous successful call
431
+ # to List operation.
432
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
433
+ # will be added to the HTTP request.
434
+ #
435
+ # @return [ConfigurationListResult] operation results.
436
+ #
437
+ def list_by_subscription_next(next_page_link, custom_headers:nil)
438
+ response = list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
439
+ response.body unless response.nil?
440
+ end
441
+
442
+ #
443
+ # Retrieve Azure Advisor configurations.
444
+ #
445
+ # Retrieve Azure Advisor configurations and also retrieve configurations of
446
+ # contained resource groups.
447
+ #
448
+ # @param next_page_link [String] The NextLink from the previous successful call
449
+ # to List operation.
450
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
451
+ # will be added to the HTTP request.
452
+ #
453
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
454
+ #
455
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers:nil)
456
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
457
+ end
458
+
459
+ #
460
+ # Retrieve Azure Advisor configurations.
461
+ #
462
+ # Retrieve Azure Advisor configurations and also retrieve configurations of
463
+ # contained resource groups.
464
+ #
465
+ # @param next_page_link [String] The NextLink from the previous successful call
466
+ # to List operation.
467
+ # @param [Hash{String => String}] A hash of custom headers that will be added
468
+ # to the HTTP request.
469
+ #
470
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
471
+ #
472
+ def list_by_subscription_next_async(next_page_link, custom_headers:nil)
473
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
474
+
475
+
476
+ request_headers = {}
477
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
478
+
479
+ # Set Headers
480
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
481
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
482
+ path_template = '{nextLink}'
483
+
484
+ request_url = @base_url || @client.base_url
485
+
486
+ options = {
487
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
488
+ skip_encoding_path_params: {'nextLink' => next_page_link},
489
+ headers: request_headers.merge(custom_headers || {}),
490
+ base_url: request_url
491
+ }
492
+ promise = @client.make_request_async(:get, path_template, options)
493
+
494
+ promise = promise.then do |result|
495
+ http_response = result.response
496
+ status_code = http_response.status
497
+ response_content = http_response.body
498
+ unless status_code == 200
499
+ error_model = JSON.load(response_content)
500
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
501
+ end
502
+
503
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
504
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
505
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
506
+ # Deserialize Response
507
+ if status_code == 200
508
+ begin
509
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
510
+ result_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::ConfigurationListResult.mapper()
511
+ result.body = @client.deserialize(result_mapper, parsed_response)
512
+ rescue Exception => e
513
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
514
+ end
515
+ end
516
+
517
+ result
518
+ end
519
+
520
+ promise.execute
521
+ end
522
+
523
+ #
524
+ # Retrieve Azure Advisor configurations.
525
+ #
526
+ # Retrieve Azure Advisor configurations and also retrieve configurations of
527
+ # contained resource groups.
528
+ #
529
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
530
+ # will be added to the HTTP request.
531
+ #
532
+ # @return [ConfigurationListResult] which provide lazy access to pages of the
533
+ # response.
534
+ #
535
+ def list_by_subscription_as_lazy(custom_headers:nil)
536
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
537
+ unless response.nil?
538
+ page = response.body
539
+ page.next_method = Proc.new do |next_page_link|
540
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers)
541
+ end
542
+ page
543
+ end
544
+ end
545
+
546
+ end
547
+ end