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.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor.rb +41 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/advisor_management_client.rb +140 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/category.rb +18 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/impact.rb +17 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/operation_display_info.rb +80 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/operation_entity.rb +58 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/operation_entity_list_result.rb +98 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/resource.rb +111 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/resource_recommendation_base.rb +201 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/resource_recommendation_base_list_result.rb +99 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/risk.rb +17 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/short_description.rb +59 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/suppression_contract.rb +109 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/module_definition.rb +9 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/operations.rb +215 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/recommendations.rb +503 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/suppressions.rb +437 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor.rb +41 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/advisor_management_client.rb +140 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/category.rb +18 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/impact.rb +17 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/operation_display_info.rb +80 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/operation_entity.rb +58 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/operation_entity_list_result.rb +98 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/resource.rb +80 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/resource_recommendation_base.rb +193 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/resource_recommendation_base_list_result.rb +99 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/risk.rb +17 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/short_description.rb +59 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/models/suppression_contract.rb +85 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/module_definition.rb +9 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/operations.rb +215 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/recommendations.rb +503 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/suppressions.rb +437 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor.rb +47 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/advisor_management_client.rb +144 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/configurations.rb +535 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/armerror_response_body.rb +59 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/category.rb +18 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/config_data.rb +80 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/config_data_properties.rb +79 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/configuration_list_result.rb +98 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/impact.rb +17 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/operation_display_info.rb +80 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/operation_entity.rb +58 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/operation_entity_list_result.rb +98 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/resource.rb +80 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/resource_recommendation_base.rb +212 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/resource_recommendation_base_list_result.rb +99 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/risk.rb +17 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/short_description.rb +59 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/suppression_contract.rb +85 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/models/suppression_contract_list_result.rb +98 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/module_definition.rb +9 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/operations.rb +215 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/recommendations.rb +503 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/suppressions.rb +553 -0
- data/lib/azure_mgmt_advisor.rb +8 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/advisor_latest_profile_client.rb +40 -0
- data/lib/profiles/latest/advisor_module_definition.rb +8 -0
- data/lib/profiles/latest/modules/advisor_profile_module.rb +131 -0
- data/lib/version.rb +7 -0
- metadata +182 -0
|
@@ -0,0 +1,109 @@
|
|
|
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::V2016_07_12_preview
|
|
7
|
+
module Models
|
|
8
|
+
#
|
|
9
|
+
# The details of the snoozed or dismissed rule; for example, the duration,
|
|
10
|
+
# name, and GUID associated with the rule.
|
|
11
|
+
#
|
|
12
|
+
class SuppressionContract < Resource
|
|
13
|
+
|
|
14
|
+
include MsRestAzure
|
|
15
|
+
|
|
16
|
+
# @return [String] The GUID of the suppression.
|
|
17
|
+
attr_accessor :suppression_id
|
|
18
|
+
|
|
19
|
+
# @return [String] The duration for which the suppression is valid.
|
|
20
|
+
attr_accessor :ttl
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#
|
|
24
|
+
# Mapper for SuppressionContract class as Ruby Hash.
|
|
25
|
+
# This will be used for serialization/deserialization.
|
|
26
|
+
#
|
|
27
|
+
def self.mapper()
|
|
28
|
+
{
|
|
29
|
+
client_side_validation: true,
|
|
30
|
+
required: false,
|
|
31
|
+
serialized_name: 'SuppressionContract',
|
|
32
|
+
type: {
|
|
33
|
+
name: 'Composite',
|
|
34
|
+
class_name: 'SuppressionContract',
|
|
35
|
+
model_properties: {
|
|
36
|
+
id: {
|
|
37
|
+
client_side_validation: true,
|
|
38
|
+
required: false,
|
|
39
|
+
read_only: true,
|
|
40
|
+
serialized_name: 'id',
|
|
41
|
+
type: {
|
|
42
|
+
name: 'String'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
name: {
|
|
46
|
+
client_side_validation: true,
|
|
47
|
+
required: false,
|
|
48
|
+
read_only: true,
|
|
49
|
+
serialized_name: 'name',
|
|
50
|
+
type: {
|
|
51
|
+
name: 'String'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
type: {
|
|
55
|
+
client_side_validation: true,
|
|
56
|
+
required: false,
|
|
57
|
+
read_only: true,
|
|
58
|
+
serialized_name: 'type',
|
|
59
|
+
type: {
|
|
60
|
+
name: 'String'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
location: {
|
|
64
|
+
client_side_validation: true,
|
|
65
|
+
required: false,
|
|
66
|
+
serialized_name: 'location',
|
|
67
|
+
type: {
|
|
68
|
+
name: 'String'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
tags: {
|
|
72
|
+
client_side_validation: true,
|
|
73
|
+
required: false,
|
|
74
|
+
serialized_name: 'tags',
|
|
75
|
+
type: {
|
|
76
|
+
name: 'Dictionary',
|
|
77
|
+
value: {
|
|
78
|
+
client_side_validation: true,
|
|
79
|
+
required: false,
|
|
80
|
+
serialized_name: 'StringElementType',
|
|
81
|
+
type: {
|
|
82
|
+
name: 'String'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
suppression_id: {
|
|
88
|
+
client_side_validation: true,
|
|
89
|
+
required: false,
|
|
90
|
+
serialized_name: 'suppressionId',
|
|
91
|
+
type: {
|
|
92
|
+
name: 'String'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
ttl: {
|
|
96
|
+
client_side_validation: true,
|
|
97
|
+
required: false,
|
|
98
|
+
serialized_name: 'ttl',
|
|
99
|
+
type: {
|
|
100
|
+
name: 'String'
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
|
4
|
+
# regenerated.
|
|
5
|
+
|
|
6
|
+
module Azure end
|
|
7
|
+
module Azure::Advisor end
|
|
8
|
+
module Azure::Advisor::Mgmt end
|
|
9
|
+
module Azure::Advisor::Mgmt::V2016_07_12_preview end
|
|
@@ -0,0 +1,215 @@
|
|
|
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::V2016_07_12_preview
|
|
7
|
+
#
|
|
8
|
+
# REST APIs for Azure Advisor
|
|
9
|
+
#
|
|
10
|
+
class Operations
|
|
11
|
+
include MsRestAzure
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# Creates and initializes a new instance of the Operations class.
|
|
15
|
+
# @param client service class for accessing basic functionality.
|
|
16
|
+
#
|
|
17
|
+
def initialize(client)
|
|
18
|
+
@client = client
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# @return [AdvisorManagementClient] reference to the AdvisorManagementClient
|
|
22
|
+
attr_reader :client
|
|
23
|
+
|
|
24
|
+
#
|
|
25
|
+
# Lists all the available Advisor REST API operations.
|
|
26
|
+
#
|
|
27
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
28
|
+
# will be added to the HTTP request.
|
|
29
|
+
#
|
|
30
|
+
# @return [Array<OperationEntity>] operation results.
|
|
31
|
+
#
|
|
32
|
+
def list(custom_headers:nil)
|
|
33
|
+
first_page = list_as_lazy(custom_headers:custom_headers)
|
|
34
|
+
first_page.get_all_items
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#
|
|
38
|
+
# Lists all the available Advisor REST API operations.
|
|
39
|
+
#
|
|
40
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
41
|
+
# will be added to the HTTP request.
|
|
42
|
+
#
|
|
43
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
44
|
+
#
|
|
45
|
+
def list_with_http_info(custom_headers:nil)
|
|
46
|
+
list_async(custom_headers:custom_headers).value!
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
#
|
|
50
|
+
# Lists all the available Advisor REST API operations.
|
|
51
|
+
#
|
|
52
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
53
|
+
# to the HTTP request.
|
|
54
|
+
#
|
|
55
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
56
|
+
#
|
|
57
|
+
def list_async(custom_headers:nil)
|
|
58
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
request_headers = {}
|
|
62
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
63
|
+
|
|
64
|
+
# Set Headers
|
|
65
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
66
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
67
|
+
path_template = 'providers/Microsoft.Advisor/operations'
|
|
68
|
+
|
|
69
|
+
request_url = @base_url || @client.base_url
|
|
70
|
+
|
|
71
|
+
options = {
|
|
72
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
73
|
+
query_params: {'api-version' => @client.api_version},
|
|
74
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
75
|
+
base_url: request_url
|
|
76
|
+
}
|
|
77
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
78
|
+
|
|
79
|
+
promise = promise.then do |result|
|
|
80
|
+
http_response = result.response
|
|
81
|
+
status_code = http_response.status
|
|
82
|
+
response_content = http_response.body
|
|
83
|
+
unless status_code == 200
|
|
84
|
+
error_model = JSON.load(response_content)
|
|
85
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
89
|
+
# Deserialize Response
|
|
90
|
+
if status_code == 200
|
|
91
|
+
begin
|
|
92
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
93
|
+
result_mapper = Azure::Advisor::Mgmt::V2016_07_12_preview::Models::OperationEntityListResult.mapper()
|
|
94
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
95
|
+
rescue Exception => e
|
|
96
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
result
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
promise.execute
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
#
|
|
107
|
+
# Lists all the available Advisor REST API operations.
|
|
108
|
+
#
|
|
109
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
110
|
+
# to List operation.
|
|
111
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
112
|
+
# will be added to the HTTP request.
|
|
113
|
+
#
|
|
114
|
+
# @return [OperationEntityListResult] operation results.
|
|
115
|
+
#
|
|
116
|
+
def list_next(next_page_link, custom_headers:nil)
|
|
117
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
|
118
|
+
response.body unless response.nil?
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
#
|
|
122
|
+
# Lists all the available Advisor REST API operations.
|
|
123
|
+
#
|
|
124
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
125
|
+
# to List operation.
|
|
126
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
127
|
+
# will be added to the HTTP request.
|
|
128
|
+
#
|
|
129
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
130
|
+
#
|
|
131
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
|
132
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
#
|
|
136
|
+
# Lists all the available Advisor REST API operations.
|
|
137
|
+
#
|
|
138
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
139
|
+
# to List operation.
|
|
140
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
141
|
+
# to the HTTP request.
|
|
142
|
+
#
|
|
143
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
144
|
+
#
|
|
145
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
|
146
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
request_headers = {}
|
|
150
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
151
|
+
|
|
152
|
+
# Set Headers
|
|
153
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
154
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
155
|
+
path_template = '{nextLink}'
|
|
156
|
+
|
|
157
|
+
request_url = @base_url || @client.base_url
|
|
158
|
+
|
|
159
|
+
options = {
|
|
160
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
161
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
|
162
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
163
|
+
base_url: request_url
|
|
164
|
+
}
|
|
165
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
166
|
+
|
|
167
|
+
promise = promise.then do |result|
|
|
168
|
+
http_response = result.response
|
|
169
|
+
status_code = http_response.status
|
|
170
|
+
response_content = http_response.body
|
|
171
|
+
unless status_code == 200
|
|
172
|
+
error_model = JSON.load(response_content)
|
|
173
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
177
|
+
# Deserialize Response
|
|
178
|
+
if status_code == 200
|
|
179
|
+
begin
|
|
180
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
181
|
+
result_mapper = Azure::Advisor::Mgmt::V2016_07_12_preview::Models::OperationEntityListResult.mapper()
|
|
182
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
183
|
+
rescue Exception => e
|
|
184
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
result
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
promise.execute
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
#
|
|
195
|
+
# Lists all the available Advisor REST API operations.
|
|
196
|
+
#
|
|
197
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
198
|
+
# will be added to the HTTP request.
|
|
199
|
+
#
|
|
200
|
+
# @return [OperationEntityListResult] which provide lazy access to pages of the
|
|
201
|
+
# response.
|
|
202
|
+
#
|
|
203
|
+
def list_as_lazy(custom_headers:nil)
|
|
204
|
+
response = list_async(custom_headers:custom_headers).value!
|
|
205
|
+
unless response.nil?
|
|
206
|
+
page = response.body
|
|
207
|
+
page.next_method = Proc.new do |next_page_link|
|
|
208
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
|
209
|
+
end
|
|
210
|
+
page
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
end
|
|
215
|
+
end
|
|
@@ -0,0 +1,503 @@
|
|
|
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::V2016_07_12_preview
|
|
7
|
+
#
|
|
8
|
+
# REST APIs for Azure Advisor
|
|
9
|
+
#
|
|
10
|
+
class Recommendations
|
|
11
|
+
include MsRestAzure
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# Creates and initializes a new instance of the Recommendations 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
|
+
# Initiates the recommendation generation or computation process for a
|
|
26
|
+
# subscription. This operation is asynchronous. The generated recommendations
|
|
27
|
+
# are stored in a cache in the Advisor service.
|
|
28
|
+
#
|
|
29
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
30
|
+
# will be added to the HTTP request.
|
|
31
|
+
#
|
|
32
|
+
#
|
|
33
|
+
def generate(custom_headers:nil)
|
|
34
|
+
response = generate_async(custom_headers:custom_headers).value!
|
|
35
|
+
nil
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
#
|
|
39
|
+
# Initiates the recommendation generation or computation process for a
|
|
40
|
+
# subscription. This operation is asynchronous. The generated recommendations
|
|
41
|
+
# are stored in a cache in the Advisor service.
|
|
42
|
+
#
|
|
43
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
44
|
+
# will be added to the HTTP request.
|
|
45
|
+
#
|
|
46
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
47
|
+
#
|
|
48
|
+
def generate_with_http_info(custom_headers:nil)
|
|
49
|
+
generate_async(custom_headers:custom_headers).value!
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
#
|
|
53
|
+
# Initiates the recommendation generation or computation process for a
|
|
54
|
+
# subscription. This operation is asynchronous. The generated recommendations
|
|
55
|
+
# are stored in a cache in the Advisor service.
|
|
56
|
+
#
|
|
57
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
58
|
+
# to the HTTP request.
|
|
59
|
+
#
|
|
60
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
61
|
+
#
|
|
62
|
+
def generate_async(custom_headers:nil)
|
|
63
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
64
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
request_headers = {}
|
|
68
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
69
|
+
|
|
70
|
+
# Set Headers
|
|
71
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
72
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
73
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations'
|
|
74
|
+
|
|
75
|
+
request_url = @base_url || @client.base_url
|
|
76
|
+
|
|
77
|
+
options = {
|
|
78
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
79
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
|
80
|
+
query_params: {'api-version' => @client.api_version},
|
|
81
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
82
|
+
base_url: request_url
|
|
83
|
+
}
|
|
84
|
+
promise = @client.make_request_async(:post, path_template, options)
|
|
85
|
+
|
|
86
|
+
promise = promise.then do |result|
|
|
87
|
+
http_response = result.response
|
|
88
|
+
status_code = http_response.status
|
|
89
|
+
response_content = http_response.body
|
|
90
|
+
unless status_code == 202
|
|
91
|
+
error_model = JSON.load(response_content)
|
|
92
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
96
|
+
|
|
97
|
+
result
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
promise.execute
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
#
|
|
104
|
+
# Retrieves the status of the recommendation computation or generation process.
|
|
105
|
+
# Invoke this API after calling the generation recommendation. The URI of this
|
|
106
|
+
# API is returned in the Location field of the response header.
|
|
107
|
+
#
|
|
108
|
+
# @param operation_id The operation ID, which can be found from the Location
|
|
109
|
+
# field in the generate recommendation response header.
|
|
110
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
111
|
+
# will be added to the HTTP request.
|
|
112
|
+
#
|
|
113
|
+
#
|
|
114
|
+
def get_generate_recommendations_status(operation_id, custom_headers:nil)
|
|
115
|
+
response = get_generate_recommendations_status_async(operation_id, custom_headers:custom_headers).value!
|
|
116
|
+
nil
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
#
|
|
120
|
+
# Retrieves the status of the recommendation computation or generation process.
|
|
121
|
+
# Invoke this API after calling the generation recommendation. The URI of this
|
|
122
|
+
# API is returned in the Location field of the response header.
|
|
123
|
+
#
|
|
124
|
+
# @param operation_id The operation ID, which can be found from the Location
|
|
125
|
+
# field in the generate recommendation response header.
|
|
126
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
127
|
+
# will be added to the HTTP request.
|
|
128
|
+
#
|
|
129
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
130
|
+
#
|
|
131
|
+
def get_generate_recommendations_status_with_http_info(operation_id, custom_headers:nil)
|
|
132
|
+
get_generate_recommendations_status_async(operation_id, custom_headers:custom_headers).value!
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
#
|
|
136
|
+
# Retrieves the status of the recommendation computation or generation process.
|
|
137
|
+
# Invoke this API after calling the generation recommendation. The URI of this
|
|
138
|
+
# API is returned in the Location field of the response header.
|
|
139
|
+
#
|
|
140
|
+
# @param operation_id The operation ID, which can be found from the Location
|
|
141
|
+
# field in the generate recommendation response header.
|
|
142
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
143
|
+
# to the HTTP request.
|
|
144
|
+
#
|
|
145
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
146
|
+
#
|
|
147
|
+
def get_generate_recommendations_status_async(operation_id, custom_headers:nil)
|
|
148
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
149
|
+
fail ArgumentError, 'operation_id is nil' if operation_id.nil?
|
|
150
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
request_headers = {}
|
|
154
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
155
|
+
|
|
156
|
+
# Set Headers
|
|
157
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
158
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
159
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}'
|
|
160
|
+
|
|
161
|
+
request_url = @base_url || @client.base_url
|
|
162
|
+
|
|
163
|
+
options = {
|
|
164
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
165
|
+
path_params: {'subscriptionId' => @client.subscription_id,'operationId' => operation_id},
|
|
166
|
+
query_params: {'api-version' => @client.api_version},
|
|
167
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
168
|
+
base_url: request_url
|
|
169
|
+
}
|
|
170
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
171
|
+
|
|
172
|
+
promise = promise.then do |result|
|
|
173
|
+
http_response = result.response
|
|
174
|
+
status_code = http_response.status
|
|
175
|
+
response_content = http_response.body
|
|
176
|
+
unless status_code == 202 || status_code == 204
|
|
177
|
+
error_model = JSON.load(response_content)
|
|
178
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
182
|
+
|
|
183
|
+
result
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
promise.execute
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
#
|
|
190
|
+
# Obtains cached recommendations for a subscription. The recommendations are
|
|
191
|
+
# generated or computed by invoking generateRecommendations.
|
|
192
|
+
#
|
|
193
|
+
# @param filter [String] The filter to apply to the recommendations.
|
|
194
|
+
# @param top [Integer] The number of recommendations per page if a paged
|
|
195
|
+
# version of this API is being used.
|
|
196
|
+
# @param skip_token [String] The page-continuation token to use with a paged
|
|
197
|
+
# version of this API.
|
|
198
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
199
|
+
# will be added to the HTTP request.
|
|
200
|
+
#
|
|
201
|
+
# @return [Array<ResourceRecommendationBase>] operation results.
|
|
202
|
+
#
|
|
203
|
+
def list(filter:nil, top:nil, skip_token:nil, custom_headers:nil)
|
|
204
|
+
first_page = list_as_lazy(filter:filter, top:top, skip_token:skip_token, custom_headers:custom_headers)
|
|
205
|
+
first_page.get_all_items
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
#
|
|
209
|
+
# Obtains cached recommendations for a subscription. The recommendations are
|
|
210
|
+
# generated or computed by invoking generateRecommendations.
|
|
211
|
+
#
|
|
212
|
+
# @param filter [String] The filter to apply to the recommendations.
|
|
213
|
+
# @param top [Integer] The number of recommendations per page if a paged
|
|
214
|
+
# version of this API is being used.
|
|
215
|
+
# @param skip_token [String] The page-continuation token to use with a paged
|
|
216
|
+
# version of this API.
|
|
217
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
218
|
+
# will be added to the HTTP request.
|
|
219
|
+
#
|
|
220
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
221
|
+
#
|
|
222
|
+
def list_with_http_info(filter:nil, top:nil, skip_token:nil, custom_headers:nil)
|
|
223
|
+
list_async(filter:filter, top:top, skip_token:skip_token, custom_headers:custom_headers).value!
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
#
|
|
227
|
+
# Obtains cached recommendations for a subscription. The recommendations are
|
|
228
|
+
# generated or computed by invoking generateRecommendations.
|
|
229
|
+
#
|
|
230
|
+
# @param filter [String] The filter to apply to the recommendations.
|
|
231
|
+
# @param top [Integer] The number of recommendations per page if a paged
|
|
232
|
+
# version of this API is being used.
|
|
233
|
+
# @param skip_token [String] The page-continuation token to use with a paged
|
|
234
|
+
# version of this API.
|
|
235
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
236
|
+
# to the HTTP request.
|
|
237
|
+
#
|
|
238
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
239
|
+
#
|
|
240
|
+
def list_async(filter:nil, top:nil, skip_token:nil, custom_headers:nil)
|
|
241
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
242
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
request_headers = {}
|
|
246
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
247
|
+
|
|
248
|
+
# Set Headers
|
|
249
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
250
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
251
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations'
|
|
252
|
+
|
|
253
|
+
request_url = @base_url || @client.base_url
|
|
254
|
+
|
|
255
|
+
options = {
|
|
256
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
257
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
|
258
|
+
query_params: {'api-version' => @client.api_version,'$filter' => filter,'$top' => top,'$skipToken' => skip_token},
|
|
259
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
260
|
+
base_url: request_url
|
|
261
|
+
}
|
|
262
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
263
|
+
|
|
264
|
+
promise = promise.then do |result|
|
|
265
|
+
http_response = result.response
|
|
266
|
+
status_code = http_response.status
|
|
267
|
+
response_content = http_response.body
|
|
268
|
+
unless status_code == 200
|
|
269
|
+
error_model = JSON.load(response_content)
|
|
270
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
274
|
+
# Deserialize Response
|
|
275
|
+
if status_code == 200
|
|
276
|
+
begin
|
|
277
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
278
|
+
result_mapper = Azure::Advisor::Mgmt::V2016_07_12_preview::Models::ResourceRecommendationBaseListResult.mapper()
|
|
279
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
280
|
+
rescue Exception => e
|
|
281
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
result
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
promise.execute
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
#
|
|
292
|
+
# Obtains details of a cached recommendation.
|
|
293
|
+
#
|
|
294
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
|
295
|
+
# identifier of the resource to which the recommendation applies.
|
|
296
|
+
# @param recommendation_id [String] The recommendation ID.
|
|
297
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
298
|
+
# will be added to the HTTP request.
|
|
299
|
+
#
|
|
300
|
+
# @return [ResourceRecommendationBase] operation results.
|
|
301
|
+
#
|
|
302
|
+
def get(resource_uri, recommendation_id, custom_headers:nil)
|
|
303
|
+
response = get_async(resource_uri, recommendation_id, custom_headers:custom_headers).value!
|
|
304
|
+
response.body unless response.nil?
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
#
|
|
308
|
+
# Obtains details of a cached recommendation.
|
|
309
|
+
#
|
|
310
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
|
311
|
+
# identifier of the resource to which the recommendation applies.
|
|
312
|
+
# @param recommendation_id [String] The recommendation ID.
|
|
313
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
314
|
+
# will be added to the HTTP request.
|
|
315
|
+
#
|
|
316
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
317
|
+
#
|
|
318
|
+
def get_with_http_info(resource_uri, recommendation_id, custom_headers:nil)
|
|
319
|
+
get_async(resource_uri, recommendation_id, custom_headers:custom_headers).value!
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
#
|
|
323
|
+
# Obtains details of a cached recommendation.
|
|
324
|
+
#
|
|
325
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
|
326
|
+
# identifier of the resource to which the recommendation applies.
|
|
327
|
+
# @param recommendation_id [String] The recommendation ID.
|
|
328
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
329
|
+
# to the HTTP request.
|
|
330
|
+
#
|
|
331
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
332
|
+
#
|
|
333
|
+
def get_async(resource_uri, recommendation_id, custom_headers:nil)
|
|
334
|
+
fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
|
|
335
|
+
fail ArgumentError, 'recommendation_id is nil' if recommendation_id.nil?
|
|
336
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
request_headers = {}
|
|
340
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
341
|
+
|
|
342
|
+
# Set Headers
|
|
343
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
344
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
345
|
+
path_template = '{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}'
|
|
346
|
+
|
|
347
|
+
request_url = @base_url || @client.base_url
|
|
348
|
+
|
|
349
|
+
options = {
|
|
350
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
351
|
+
path_params: {'resourceUri' => resource_uri,'recommendationId' => recommendation_id},
|
|
352
|
+
query_params: {'api-version' => @client.api_version},
|
|
353
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
354
|
+
base_url: request_url
|
|
355
|
+
}
|
|
356
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
357
|
+
|
|
358
|
+
promise = promise.then do |result|
|
|
359
|
+
http_response = result.response
|
|
360
|
+
status_code = http_response.status
|
|
361
|
+
response_content = http_response.body
|
|
362
|
+
unless status_code == 200
|
|
363
|
+
error_model = JSON.load(response_content)
|
|
364
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
368
|
+
# Deserialize Response
|
|
369
|
+
if status_code == 200
|
|
370
|
+
begin
|
|
371
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
372
|
+
result_mapper = Azure::Advisor::Mgmt::V2016_07_12_preview::Models::ResourceRecommendationBase.mapper()
|
|
373
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
374
|
+
rescue Exception => e
|
|
375
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
result
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
promise.execute
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
#
|
|
386
|
+
# Obtains cached recommendations for a subscription. The recommendations are
|
|
387
|
+
# generated or computed by invoking generateRecommendations.
|
|
388
|
+
#
|
|
389
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
390
|
+
# to List operation.
|
|
391
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
392
|
+
# will be added to the HTTP request.
|
|
393
|
+
#
|
|
394
|
+
# @return [ResourceRecommendationBaseListResult] operation results.
|
|
395
|
+
#
|
|
396
|
+
def list_next(next_page_link, custom_headers:nil)
|
|
397
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
|
398
|
+
response.body unless response.nil?
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
#
|
|
402
|
+
# Obtains cached recommendations for a subscription. The recommendations are
|
|
403
|
+
# generated or computed by invoking generateRecommendations.
|
|
404
|
+
#
|
|
405
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
406
|
+
# to List operation.
|
|
407
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
408
|
+
# will be added to the HTTP request.
|
|
409
|
+
#
|
|
410
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
411
|
+
#
|
|
412
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
|
413
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
#
|
|
417
|
+
# Obtains cached recommendations for a subscription. The recommendations are
|
|
418
|
+
# generated or computed by invoking generateRecommendations.
|
|
419
|
+
#
|
|
420
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
421
|
+
# to List operation.
|
|
422
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
423
|
+
# to the HTTP request.
|
|
424
|
+
#
|
|
425
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
426
|
+
#
|
|
427
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
|
428
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
request_headers = {}
|
|
432
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
433
|
+
|
|
434
|
+
# Set Headers
|
|
435
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
436
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
437
|
+
path_template = '{nextLink}'
|
|
438
|
+
|
|
439
|
+
request_url = @base_url || @client.base_url
|
|
440
|
+
|
|
441
|
+
options = {
|
|
442
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
443
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
|
444
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
445
|
+
base_url: request_url
|
|
446
|
+
}
|
|
447
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
448
|
+
|
|
449
|
+
promise = promise.then do |result|
|
|
450
|
+
http_response = result.response
|
|
451
|
+
status_code = http_response.status
|
|
452
|
+
response_content = http_response.body
|
|
453
|
+
unless status_code == 200
|
|
454
|
+
error_model = JSON.load(response_content)
|
|
455
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
459
|
+
# Deserialize Response
|
|
460
|
+
if status_code == 200
|
|
461
|
+
begin
|
|
462
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
463
|
+
result_mapper = Azure::Advisor::Mgmt::V2016_07_12_preview::Models::ResourceRecommendationBaseListResult.mapper()
|
|
464
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
465
|
+
rescue Exception => e
|
|
466
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
467
|
+
end
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
result
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
promise.execute
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
#
|
|
477
|
+
# Obtains cached recommendations for a subscription. The recommendations are
|
|
478
|
+
# generated or computed by invoking generateRecommendations.
|
|
479
|
+
#
|
|
480
|
+
# @param filter [String] The filter to apply to the recommendations.
|
|
481
|
+
# @param top [Integer] The number of recommendations per page if a paged
|
|
482
|
+
# version of this API is being used.
|
|
483
|
+
# @param skip_token [String] The page-continuation token to use with a paged
|
|
484
|
+
# version of this API.
|
|
485
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
486
|
+
# will be added to the HTTP request.
|
|
487
|
+
#
|
|
488
|
+
# @return [ResourceRecommendationBaseListResult] which provide lazy access to
|
|
489
|
+
# pages of the response.
|
|
490
|
+
#
|
|
491
|
+
def list_as_lazy(filter:nil, top:nil, skip_token:nil, custom_headers:nil)
|
|
492
|
+
response = list_async(filter:filter, top:top, skip_token:skip_token, custom_headers:custom_headers).value!
|
|
493
|
+
unless response.nil?
|
|
494
|
+
page = response.body
|
|
495
|
+
page.next_method = Proc.new do |next_page_link|
|
|
496
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
|
497
|
+
end
|
|
498
|
+
page
|
|
499
|
+
end
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
end
|
|
503
|
+
end
|