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