azure_mgmt_reservations 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations.rb +53 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/applied_reservation_list.rb +66 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/applied_reservations.rb +85 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/catalog.rb +166 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/error.rb +48 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/extended_error_info.rb +84 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/extended_status_info.rb +61 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/kind.rb +15 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/merge_request.rb +56 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/operation_display.rb +80 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/operation_list.rb +98 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/operation_response.rb +70 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/patch.rb +66 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_list.rb +98 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_merge_properties.rb +70 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_order_list.rb +98 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_order_response.rb +187 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_properties.rb +176 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_response.rb +137 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_split_properties.rb +70 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/sku_capability.rb +58 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/sku_name.rb +47 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/sku_restriction.rb +79 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/models/split_request.rb +69 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/module_definition.rb +9 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/operation.rb +228 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/reservation.rb +1109 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/reservation_order.rb +332 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/reservations_management_client.rb +335 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations.rb +58 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/applied_reservation_list.rb +66 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/applied_reservations.rb +85 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/applied_scope_type.rb +16 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/catalog.rb +143 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/error.rb +48 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/error_response_code.rb +69 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/extended_error_info.rb +84 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/extended_status_info.rb +61 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/instance_flexibility.rb +17 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/merge_request.rb +56 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/operation_display.rb +80 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/operation_list.rb +98 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/operation_response.rb +70 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/patch.rb +89 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_list.rb +98 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_merge_properties.rb +70 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_order_list.rb +98 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_order_response.rb +184 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_properties.rb +208 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_response.rb +120 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_split_properties.rb +70 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_status_code.rb +23 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_term.rb +16 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reserved_resource_type.rb +19 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/sku_name.rb +47 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/sku_property.rb +58 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/sku_restriction.rb +79 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/split_request.rb +69 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/module_definition.rb +9 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/operation.rb +228 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservation.rb +1109 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservation_order.rb +332 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +348 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations.rb +64 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/applied_reservation_list.rb +66 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/applied_reservations.rb +85 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/applied_scope_type.rb +16 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/calculate_price_response.rb +48 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/calculate_price_response_properties.rb +110 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/calculate_price_response_properties_billing_currency_total.rb +59 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/calculate_price_response_properties_pricing_currency_total.rb +59 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/catalog.rb +143 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/error.rb +48 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/error_response_code.rb +69 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/extended_error_info.rb +84 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/extended_status_info.rb +61 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/instance_flexibility.rb +16 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/merge_request.rb +56 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/operation_display.rb +80 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/operation_list.rb +98 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/operation_response.rb +70 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/patch.rb +88 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/purchase_request.rb +159 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/purchase_request_properties_reserved_resource_properties.rb +48 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_list.rb +98 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_merge_properties.rb +70 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_order_list.rb +98 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_order_response.rb +183 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_properties.rb +206 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_response.rb +120 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_split_properties.rb +70 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_status_code.rb +23 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_term.rb +16 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reserved_resource_type.rb +18 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/sku_name.rb +47 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/sku_property.rb +58 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/sku_restriction.rb +79 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/split_request.rb +69 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/module_definition.rb +9 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/operation.rb +228 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservation.rb +1072 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservation_order.rb +594 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +348 -0
- data/lib/azure_mgmt_reservations.rb +8 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/modules/reservations_profile_module.rb +201 -0
- data/lib/profiles/latest/reservations_latest_profile_client.rb +40 -0
- data/lib/profiles/latest/reservations_module_definition.rb +8 -0
- data/lib/version.rb +7 -0
- metadata +227 -0
@@ -0,0 +1,332 @@
|
|
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::Reservations::Mgmt::V2018_06_01_preview
|
7
|
+
#
|
8
|
+
# This API describe Azure Reservation
|
9
|
+
#
|
10
|
+
class ReservationOrder
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the ReservationOrder class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [ReservationsManagementClient] reference to the ReservationsManagementClient
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# Get all `ReservationOrder`s.
|
26
|
+
#
|
27
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
28
|
+
# current tenant.
|
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<ReservationOrderResponse>] operation results.
|
34
|
+
#
|
35
|
+
def list(custom_headers:nil)
|
36
|
+
first_page = list_as_lazy(custom_headers:custom_headers)
|
37
|
+
first_page.get_all_items
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Get all `ReservationOrder`s.
|
42
|
+
#
|
43
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
44
|
+
# current tenant.
|
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_with_http_info(custom_headers:nil)
|
52
|
+
list_async(custom_headers:custom_headers).value!
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Get all `ReservationOrder`s.
|
57
|
+
#
|
58
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
59
|
+
# current tenant.
|
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_async(custom_headers:nil)
|
67
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
68
|
+
|
69
|
+
|
70
|
+
request_headers = {}
|
71
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
72
|
+
|
73
|
+
# Set Headers
|
74
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
75
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
76
|
+
path_template = 'providers/Microsoft.Capacity/reservationOrders'
|
77
|
+
|
78
|
+
request_url = @base_url || @client.base_url
|
79
|
+
|
80
|
+
options = {
|
81
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
82
|
+
query_params: {'api-version' => @client.api_version},
|
83
|
+
headers: request_headers.merge(custom_headers || {}),
|
84
|
+
base_url: request_url
|
85
|
+
}
|
86
|
+
promise = @client.make_request_async(:get, path_template, options)
|
87
|
+
|
88
|
+
promise = promise.then do |result|
|
89
|
+
http_response = result.response
|
90
|
+
status_code = http_response.status
|
91
|
+
response_content = http_response.body
|
92
|
+
unless status_code == 200
|
93
|
+
error_model = JSON.load(response_content)
|
94
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
95
|
+
end
|
96
|
+
|
97
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
98
|
+
# Deserialize Response
|
99
|
+
if status_code == 200
|
100
|
+
begin
|
101
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
102
|
+
result_mapper = Azure::Reservations::Mgmt::V2018_06_01_preview::Models::ReservationOrderList.mapper()
|
103
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
104
|
+
rescue Exception => e
|
105
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
result
|
110
|
+
end
|
111
|
+
|
112
|
+
promise.execute
|
113
|
+
end
|
114
|
+
|
115
|
+
#
|
116
|
+
# Get a specific `ReservationOrder`.
|
117
|
+
#
|
118
|
+
# Get the details of the `ReservationOrder`.
|
119
|
+
#
|
120
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
121
|
+
#
|
122
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
123
|
+
# will be added to the HTTP request.
|
124
|
+
#
|
125
|
+
# @return [ReservationOrderResponse] operation results.
|
126
|
+
#
|
127
|
+
def get(reservation_order_id, custom_headers:nil)
|
128
|
+
response = get_async(reservation_order_id, custom_headers:custom_headers).value!
|
129
|
+
response.body unless response.nil?
|
130
|
+
end
|
131
|
+
|
132
|
+
#
|
133
|
+
# Get a specific `ReservationOrder`.
|
134
|
+
#
|
135
|
+
# Get the details of the `ReservationOrder`.
|
136
|
+
#
|
137
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
138
|
+
#
|
139
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
140
|
+
# will be added to the HTTP request.
|
141
|
+
#
|
142
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
143
|
+
#
|
144
|
+
def get_with_http_info(reservation_order_id, custom_headers:nil)
|
145
|
+
get_async(reservation_order_id, custom_headers:custom_headers).value!
|
146
|
+
end
|
147
|
+
|
148
|
+
#
|
149
|
+
# Get a specific `ReservationOrder`.
|
150
|
+
#
|
151
|
+
# Get the details of the `ReservationOrder`.
|
152
|
+
#
|
153
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
154
|
+
#
|
155
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
156
|
+
# to the HTTP request.
|
157
|
+
#
|
158
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
159
|
+
#
|
160
|
+
def get_async(reservation_order_id, custom_headers:nil)
|
161
|
+
fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
|
162
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
163
|
+
|
164
|
+
|
165
|
+
request_headers = {}
|
166
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
167
|
+
|
168
|
+
# Set Headers
|
169
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
170
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
171
|
+
path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'
|
172
|
+
|
173
|
+
request_url = @base_url || @client.base_url
|
174
|
+
|
175
|
+
options = {
|
176
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
177
|
+
path_params: {'reservationOrderId' => reservation_order_id},
|
178
|
+
query_params: {'api-version' => @client.api_version},
|
179
|
+
headers: request_headers.merge(custom_headers || {}),
|
180
|
+
base_url: request_url
|
181
|
+
}
|
182
|
+
promise = @client.make_request_async(:get, path_template, options)
|
183
|
+
|
184
|
+
promise = promise.then do |result|
|
185
|
+
http_response = result.response
|
186
|
+
status_code = http_response.status
|
187
|
+
response_content = http_response.body
|
188
|
+
unless status_code == 200
|
189
|
+
error_model = JSON.load(response_content)
|
190
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
191
|
+
end
|
192
|
+
|
193
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
194
|
+
# Deserialize Response
|
195
|
+
if status_code == 200
|
196
|
+
begin
|
197
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
198
|
+
result_mapper = Azure::Reservations::Mgmt::V2018_06_01_preview::Models::ReservationOrderResponse.mapper()
|
199
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
200
|
+
rescue Exception => e
|
201
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
result
|
206
|
+
end
|
207
|
+
|
208
|
+
promise.execute
|
209
|
+
end
|
210
|
+
|
211
|
+
#
|
212
|
+
# Get all `ReservationOrder`s.
|
213
|
+
#
|
214
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
215
|
+
# current tenant.
|
216
|
+
#
|
217
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
218
|
+
# to List operation.
|
219
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
220
|
+
# will be added to the HTTP request.
|
221
|
+
#
|
222
|
+
# @return [ReservationOrderList] operation results.
|
223
|
+
#
|
224
|
+
def list_next(next_page_link, custom_headers:nil)
|
225
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
226
|
+
response.body unless response.nil?
|
227
|
+
end
|
228
|
+
|
229
|
+
#
|
230
|
+
# Get all `ReservationOrder`s.
|
231
|
+
#
|
232
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
233
|
+
# current tenant.
|
234
|
+
#
|
235
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
236
|
+
# to List operation.
|
237
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
238
|
+
# will be added to the HTTP request.
|
239
|
+
#
|
240
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
241
|
+
#
|
242
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
243
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
244
|
+
end
|
245
|
+
|
246
|
+
#
|
247
|
+
# Get all `ReservationOrder`s.
|
248
|
+
#
|
249
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
250
|
+
# current tenant.
|
251
|
+
#
|
252
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
253
|
+
# to List operation.
|
254
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
255
|
+
# to the HTTP request.
|
256
|
+
#
|
257
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
258
|
+
#
|
259
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
260
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
261
|
+
|
262
|
+
|
263
|
+
request_headers = {}
|
264
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
265
|
+
|
266
|
+
# Set Headers
|
267
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
268
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
269
|
+
path_template = '{nextLink}'
|
270
|
+
|
271
|
+
request_url = @base_url || @client.base_url
|
272
|
+
|
273
|
+
options = {
|
274
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
275
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
276
|
+
headers: request_headers.merge(custom_headers || {}),
|
277
|
+
base_url: request_url
|
278
|
+
}
|
279
|
+
promise = @client.make_request_async(:get, path_template, options)
|
280
|
+
|
281
|
+
promise = promise.then do |result|
|
282
|
+
http_response = result.response
|
283
|
+
status_code = http_response.status
|
284
|
+
response_content = http_response.body
|
285
|
+
unless status_code == 200
|
286
|
+
error_model = JSON.load(response_content)
|
287
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
288
|
+
end
|
289
|
+
|
290
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
291
|
+
# Deserialize Response
|
292
|
+
if status_code == 200
|
293
|
+
begin
|
294
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
295
|
+
result_mapper = Azure::Reservations::Mgmt::V2018_06_01_preview::Models::ReservationOrderList.mapper()
|
296
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
297
|
+
rescue Exception => e
|
298
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
result
|
303
|
+
end
|
304
|
+
|
305
|
+
promise.execute
|
306
|
+
end
|
307
|
+
|
308
|
+
#
|
309
|
+
# Get all `ReservationOrder`s.
|
310
|
+
#
|
311
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
312
|
+
# current tenant.
|
313
|
+
#
|
314
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
315
|
+
# will be added to the HTTP request.
|
316
|
+
#
|
317
|
+
# @return [ReservationOrderList] which provide lazy access to pages of the
|
318
|
+
# response.
|
319
|
+
#
|
320
|
+
def list_as_lazy(custom_headers:nil)
|
321
|
+
response = list_async(custom_headers:custom_headers).value!
|
322
|
+
unless response.nil?
|
323
|
+
page = response.body
|
324
|
+
page.next_method = Proc.new do |next_page_link|
|
325
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
326
|
+
end
|
327
|
+
page
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
332
|
+
end
|
data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb
ADDED
@@ -0,0 +1,348 @@
|
|
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::Reservations::Mgmt::V2018_06_01_preview
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class ReservationsManagementClient < 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] Supported version.
|
21
|
+
attr_reader :api_version
|
22
|
+
|
23
|
+
# @return [String] The preferred language for the response.
|
24
|
+
attr_accessor :accept_language
|
25
|
+
|
26
|
+
# @return [Integer] The retry timeout in seconds for Long Running
|
27
|
+
# Operations. Default value is 30.
|
28
|
+
attr_accessor :long_running_operation_retry_timeout
|
29
|
+
|
30
|
+
# @return [Boolean] Whether a unique x-ms-client-request-id should be
|
31
|
+
# generated. When set to true a unique x-ms-client-request-id value is
|
32
|
+
# generated and included in each request. Default is true.
|
33
|
+
attr_accessor :generate_client_request_id
|
34
|
+
|
35
|
+
# @return [ReservationOrder] reservation_order
|
36
|
+
attr_reader :reservation_order
|
37
|
+
|
38
|
+
# @return [Reservation] reservation
|
39
|
+
attr_reader :reservation
|
40
|
+
|
41
|
+
# @return [Operation] operation
|
42
|
+
attr_reader :operation
|
43
|
+
|
44
|
+
#
|
45
|
+
# Creates initializes a new instance of the ReservationsManagementClient class.
|
46
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
47
|
+
# @param base_url [String] the base URI of the service.
|
48
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
49
|
+
#
|
50
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
51
|
+
super(credentials, options)
|
52
|
+
@base_url = base_url || 'https://management.azure.com'
|
53
|
+
|
54
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
55
|
+
@credentials = credentials
|
56
|
+
|
57
|
+
@reservation_order = ReservationOrder.new(self)
|
58
|
+
@reservation = Reservation.new(self)
|
59
|
+
@operation = Operation.new(self)
|
60
|
+
@api_version = '2018-06-01'
|
61
|
+
@accept_language = 'en-US'
|
62
|
+
@long_running_operation_retry_timeout = 30
|
63
|
+
@generate_client_request_id = true
|
64
|
+
add_telemetry
|
65
|
+
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# Makes a request and returns the body of the response.
|
69
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
70
|
+
# @param path [String] the path, relative to {base_url}.
|
71
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
72
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
73
|
+
# Example:
|
74
|
+
#
|
75
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
76
|
+
# path = "/path"
|
77
|
+
# options = {
|
78
|
+
# body: request_content,
|
79
|
+
# query_params: {'api-version' => '2016-02-01'}
|
80
|
+
# }
|
81
|
+
# result = @client.make_request(:put, path, options)
|
82
|
+
#
|
83
|
+
def make_request(method, path, options = {})
|
84
|
+
result = make_request_with_http_info(method, path, options)
|
85
|
+
result.body unless result.nil?
|
86
|
+
end
|
87
|
+
|
88
|
+
#
|
89
|
+
# Makes a request and returns the operation response.
|
90
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
91
|
+
# @param path [String] the path, relative to {base_url}.
|
92
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
93
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
94
|
+
#
|
95
|
+
def make_request_with_http_info(method, path, options = {})
|
96
|
+
result = make_request_async(method, path, options).value!
|
97
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
98
|
+
result
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# Makes a request asynchronously.
|
103
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
104
|
+
# @param path [String] the path, relative to {base_url}.
|
105
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
106
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
107
|
+
#
|
108
|
+
def make_request_async(method, path, options = {})
|
109
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
110
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
111
|
+
|
112
|
+
request_url = options[:base_url] || @base_url
|
113
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
114
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
115
|
+
end
|
116
|
+
|
117
|
+
request_headers = @request_headers
|
118
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
119
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
120
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
121
|
+
|
122
|
+
super(request_url, method, path, options)
|
123
|
+
end
|
124
|
+
|
125
|
+
#
|
126
|
+
# Get the regions and skus that are available for RI purchase for the specified
|
127
|
+
# Azure subscription.
|
128
|
+
#
|
129
|
+
# @param subscription_id [String] Id of the subscription
|
130
|
+
# @param reserved_resource_type [String] The type of the resource for which the
|
131
|
+
# skus should be provided.
|
132
|
+
# @param location [String] Filters the skus based on the location specified in
|
133
|
+
# this parameter. This can be an azure region or global
|
134
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
135
|
+
# will be added to the HTTP request.
|
136
|
+
#
|
137
|
+
# @return [Array] operation results.
|
138
|
+
#
|
139
|
+
def get_catalog(subscription_id, reserved_resource_type, location:nil, custom_headers:nil)
|
140
|
+
response = get_catalog_async(subscription_id, reserved_resource_type, location:location, custom_headers:custom_headers).value!
|
141
|
+
response.body unless response.nil?
|
142
|
+
end
|
143
|
+
|
144
|
+
#
|
145
|
+
# Get the regions and skus that are available for RI purchase for the specified
|
146
|
+
# Azure subscription.
|
147
|
+
#
|
148
|
+
# @param subscription_id [String] Id of the subscription
|
149
|
+
# @param reserved_resource_type [String] The type of the resource for which the
|
150
|
+
# skus should be provided.
|
151
|
+
# @param location [String] Filters the skus based on the location specified in
|
152
|
+
# this parameter. This can be an azure region or global
|
153
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
154
|
+
# will be added to the HTTP request.
|
155
|
+
#
|
156
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
157
|
+
#
|
158
|
+
def get_catalog_with_http_info(subscription_id, reserved_resource_type, location:nil, custom_headers:nil)
|
159
|
+
get_catalog_async(subscription_id, reserved_resource_type, location:location, custom_headers:custom_headers).value!
|
160
|
+
end
|
161
|
+
|
162
|
+
#
|
163
|
+
# Get the regions and skus that are available for RI purchase for the specified
|
164
|
+
# Azure subscription.
|
165
|
+
#
|
166
|
+
# @param subscription_id [String] Id of the subscription
|
167
|
+
# @param reserved_resource_type [String] The type of the resource for which the
|
168
|
+
# skus should be provided.
|
169
|
+
# @param location [String] Filters the skus based on the location specified in
|
170
|
+
# this parameter. This can be an azure region or global
|
171
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
172
|
+
# to the HTTP request.
|
173
|
+
#
|
174
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
175
|
+
#
|
176
|
+
def get_catalog_async(subscription_id, reserved_resource_type, location:nil, custom_headers:nil)
|
177
|
+
fail ArgumentError, 'api_version is nil' if api_version.nil?
|
178
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
179
|
+
fail ArgumentError, 'reserved_resource_type is nil' if reserved_resource_type.nil?
|
180
|
+
|
181
|
+
|
182
|
+
request_headers = {}
|
183
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
184
|
+
|
185
|
+
# Set Headers
|
186
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
187
|
+
request_headers['accept-language'] = accept_language unless accept_language.nil?
|
188
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs'
|
189
|
+
|
190
|
+
request_url = @base_url || self.base_url
|
191
|
+
|
192
|
+
options = {
|
193
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
194
|
+
path_params: {'subscriptionId' => subscription_id},
|
195
|
+
query_params: {'api-version' => api_version,'reservedResourceType' => reserved_resource_type,'location' => location},
|
196
|
+
headers: request_headers.merge(custom_headers || {}),
|
197
|
+
base_url: request_url
|
198
|
+
}
|
199
|
+
promise = self.make_request_async(:get, path_template, options)
|
200
|
+
|
201
|
+
promise = promise.then do |result|
|
202
|
+
http_response = result.response
|
203
|
+
status_code = http_response.status
|
204
|
+
response_content = http_response.body
|
205
|
+
unless status_code == 200
|
206
|
+
error_model = JSON.load(response_content)
|
207
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
208
|
+
end
|
209
|
+
|
210
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
211
|
+
# Deserialize Response
|
212
|
+
if status_code == 200
|
213
|
+
begin
|
214
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
215
|
+
result_mapper = {
|
216
|
+
client_side_validation: true,
|
217
|
+
required: false,
|
218
|
+
serialized_name: 'parsed_response',
|
219
|
+
type: {
|
220
|
+
name: 'Sequence',
|
221
|
+
element: {
|
222
|
+
client_side_validation: true,
|
223
|
+
required: false,
|
224
|
+
serialized_name: 'CatalogElementType',
|
225
|
+
type: {
|
226
|
+
name: 'Composite',
|
227
|
+
class_name: 'Catalog'
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
}
|
232
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
233
|
+
rescue Exception => e
|
234
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
result
|
239
|
+
end
|
240
|
+
|
241
|
+
promise.execute
|
242
|
+
end
|
243
|
+
|
244
|
+
#
|
245
|
+
# Get list of applicable `Reservation`s.
|
246
|
+
#
|
247
|
+
# Get applicable `Reservation`s that are applied to this subscription.
|
248
|
+
#
|
249
|
+
# @param subscription_id [String] Id of the subscription
|
250
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
251
|
+
# will be added to the HTTP request.
|
252
|
+
#
|
253
|
+
# @return [AppliedReservations] operation results.
|
254
|
+
#
|
255
|
+
def get_applied_reservation_list(subscription_id, custom_headers:nil)
|
256
|
+
response = get_applied_reservation_list_async(subscription_id, custom_headers:custom_headers).value!
|
257
|
+
response.body unless response.nil?
|
258
|
+
end
|
259
|
+
|
260
|
+
#
|
261
|
+
# Get list of applicable `Reservation`s.
|
262
|
+
#
|
263
|
+
# Get applicable `Reservation`s that are applied to this subscription.
|
264
|
+
#
|
265
|
+
# @param subscription_id [String] Id of the subscription
|
266
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
267
|
+
# will be added to the HTTP request.
|
268
|
+
#
|
269
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
270
|
+
#
|
271
|
+
def get_applied_reservation_list_with_http_info(subscription_id, custom_headers:nil)
|
272
|
+
get_applied_reservation_list_async(subscription_id, custom_headers:custom_headers).value!
|
273
|
+
end
|
274
|
+
|
275
|
+
#
|
276
|
+
# Get list of applicable `Reservation`s.
|
277
|
+
#
|
278
|
+
# Get applicable `Reservation`s that are applied to this subscription.
|
279
|
+
#
|
280
|
+
# @param subscription_id [String] Id of the subscription
|
281
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
282
|
+
# to the HTTP request.
|
283
|
+
#
|
284
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
285
|
+
#
|
286
|
+
def get_applied_reservation_list_async(subscription_id, custom_headers:nil)
|
287
|
+
fail ArgumentError, 'api_version is nil' if api_version.nil?
|
288
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
289
|
+
|
290
|
+
|
291
|
+
request_headers = {}
|
292
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
293
|
+
|
294
|
+
# Set Headers
|
295
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
296
|
+
request_headers['accept-language'] = accept_language unless accept_language.nil?
|
297
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations'
|
298
|
+
|
299
|
+
request_url = @base_url || self.base_url
|
300
|
+
|
301
|
+
options = {
|
302
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
303
|
+
path_params: {'subscriptionId' => subscription_id},
|
304
|
+
query_params: {'api-version' => api_version},
|
305
|
+
headers: request_headers.merge(custom_headers || {}),
|
306
|
+
base_url: request_url
|
307
|
+
}
|
308
|
+
promise = self.make_request_async(:get, path_template, options)
|
309
|
+
|
310
|
+
promise = promise.then do |result|
|
311
|
+
http_response = result.response
|
312
|
+
status_code = http_response.status
|
313
|
+
response_content = http_response.body
|
314
|
+
unless status_code == 200
|
315
|
+
error_model = JSON.load(response_content)
|
316
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
317
|
+
end
|
318
|
+
|
319
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
320
|
+
# Deserialize Response
|
321
|
+
if status_code == 200
|
322
|
+
begin
|
323
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
324
|
+
result_mapper = Azure::Reservations::Mgmt::V2018_06_01_preview::Models::AppliedReservations.mapper()
|
325
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
326
|
+
rescue Exception => e
|
327
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
result
|
332
|
+
end
|
333
|
+
|
334
|
+
promise.execute
|
335
|
+
end
|
336
|
+
|
337
|
+
|
338
|
+
private
|
339
|
+
#
|
340
|
+
# Adds telemetry information.
|
341
|
+
#
|
342
|
+
def add_telemetry
|
343
|
+
sdk_information = 'azure_mgmt_reservations'
|
344
|
+
sdk_information = "#{sdk_information}/0.17.0"
|
345
|
+
add_user_agent_information(sdk_information)
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|