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,1072 @@
|
|
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::V2019_04_01_preview
|
7
|
+
#
|
8
|
+
# This API describe Azure Reservation
|
9
|
+
#
|
10
|
+
class Reservation
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Reservation 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
|
+
# Split the `Reservation`.
|
26
|
+
#
|
27
|
+
# Split a `Reservation` into two `Reservation`s with specified quantity
|
28
|
+
# distribution.
|
29
|
+
#
|
30
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
31
|
+
# @param body [SplitRequest] Information needed to Split a reservation item
|
32
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
33
|
+
# will be added to the HTTP request.
|
34
|
+
#
|
35
|
+
# @return [Array] operation results.
|
36
|
+
#
|
37
|
+
def split(reservation_order_id, body, custom_headers:nil)
|
38
|
+
response = split_async(reservation_order_id, body, custom_headers:custom_headers).value!
|
39
|
+
response.body unless response.nil?
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
44
|
+
# @param body [SplitRequest] Information needed to Split a reservation item
|
45
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
46
|
+
# will be added to the HTTP request.
|
47
|
+
#
|
48
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
49
|
+
# response.
|
50
|
+
#
|
51
|
+
def split_async(reservation_order_id, body, custom_headers:nil)
|
52
|
+
# Send request
|
53
|
+
promise = begin_split_async(reservation_order_id, body, custom_headers:custom_headers)
|
54
|
+
|
55
|
+
promise = promise.then do |response|
|
56
|
+
# Defining deserialization method.
|
57
|
+
deserialize_method = lambda do |parsed_response|
|
58
|
+
result_mapper = {
|
59
|
+
client_side_validation: true,
|
60
|
+
required: false,
|
61
|
+
serialized_name: 'parsed_response',
|
62
|
+
type: {
|
63
|
+
name: 'Sequence',
|
64
|
+
element: {
|
65
|
+
client_side_validation: true,
|
66
|
+
required: false,
|
67
|
+
serialized_name: 'ReservationResponseElementType',
|
68
|
+
type: {
|
69
|
+
name: 'Composite',
|
70
|
+
class_name: 'ReservationResponse'
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Waiting for response.
|
79
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
80
|
+
end
|
81
|
+
|
82
|
+
promise
|
83
|
+
end
|
84
|
+
|
85
|
+
#
|
86
|
+
# Merges two `Reservation`s.
|
87
|
+
#
|
88
|
+
# Merge the specified `Reservation`s into a new `Reservation`. The two
|
89
|
+
# `Reservation`s being merged must have same properties.
|
90
|
+
#
|
91
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
92
|
+
# @param body [MergeRequest] Information needed for commercial request for a
|
93
|
+
# reservation
|
94
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
95
|
+
# will be added to the HTTP request.
|
96
|
+
#
|
97
|
+
# @return [Array] operation results.
|
98
|
+
#
|
99
|
+
def merge(reservation_order_id, body, custom_headers:nil)
|
100
|
+
response = merge_async(reservation_order_id, body, custom_headers:custom_headers).value!
|
101
|
+
response.body unless response.nil?
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
106
|
+
# @param body [MergeRequest] Information needed for commercial request for a
|
107
|
+
# reservation
|
108
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
109
|
+
# will be added to the HTTP request.
|
110
|
+
#
|
111
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
112
|
+
# response.
|
113
|
+
#
|
114
|
+
def merge_async(reservation_order_id, body, custom_headers:nil)
|
115
|
+
# Send request
|
116
|
+
promise = begin_merge_async(reservation_order_id, body, custom_headers:custom_headers)
|
117
|
+
|
118
|
+
promise = promise.then do |response|
|
119
|
+
# Defining deserialization method.
|
120
|
+
deserialize_method = lambda do |parsed_response|
|
121
|
+
result_mapper = {
|
122
|
+
client_side_validation: true,
|
123
|
+
required: false,
|
124
|
+
serialized_name: 'parsed_response',
|
125
|
+
type: {
|
126
|
+
name: 'Sequence',
|
127
|
+
element: {
|
128
|
+
client_side_validation: true,
|
129
|
+
required: false,
|
130
|
+
serialized_name: 'ReservationResponseElementType',
|
131
|
+
type: {
|
132
|
+
name: 'Composite',
|
133
|
+
class_name: 'ReservationResponse'
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Waiting for response.
|
142
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
143
|
+
end
|
144
|
+
|
145
|
+
promise
|
146
|
+
end
|
147
|
+
|
148
|
+
#
|
149
|
+
# Get `Reservation`s in a given reservation Order
|
150
|
+
#
|
151
|
+
# List `Reservation`s within a single `ReservationOrder`.
|
152
|
+
#
|
153
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
154
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
155
|
+
# will be added to the HTTP request.
|
156
|
+
#
|
157
|
+
# @return [Array<ReservationResponse>] operation results.
|
158
|
+
#
|
159
|
+
def list(reservation_order_id, custom_headers:nil)
|
160
|
+
first_page = list_as_lazy(reservation_order_id, custom_headers:custom_headers)
|
161
|
+
first_page.get_all_items
|
162
|
+
end
|
163
|
+
|
164
|
+
#
|
165
|
+
# Get `Reservation`s in a given reservation Order
|
166
|
+
#
|
167
|
+
# List `Reservation`s within a single `ReservationOrder`.
|
168
|
+
#
|
169
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
170
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
171
|
+
# will be added to the HTTP request.
|
172
|
+
#
|
173
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
174
|
+
#
|
175
|
+
def list_with_http_info(reservation_order_id, custom_headers:nil)
|
176
|
+
list_async(reservation_order_id, custom_headers:custom_headers).value!
|
177
|
+
end
|
178
|
+
|
179
|
+
#
|
180
|
+
# Get `Reservation`s in a given reservation Order
|
181
|
+
#
|
182
|
+
# List `Reservation`s within a single `ReservationOrder`.
|
183
|
+
#
|
184
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
185
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
186
|
+
# to the HTTP request.
|
187
|
+
#
|
188
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
189
|
+
#
|
190
|
+
def list_async(reservation_order_id, custom_headers:nil)
|
191
|
+
fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
|
192
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
193
|
+
|
194
|
+
|
195
|
+
request_headers = {}
|
196
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
197
|
+
|
198
|
+
# Set Headers
|
199
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
200
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
201
|
+
path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations'
|
202
|
+
|
203
|
+
request_url = @base_url || @client.base_url
|
204
|
+
|
205
|
+
options = {
|
206
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
207
|
+
path_params: {'reservationOrderId' => reservation_order_id},
|
208
|
+
query_params: {'api-version' => @client.api_version},
|
209
|
+
headers: request_headers.merge(custom_headers || {}),
|
210
|
+
base_url: request_url
|
211
|
+
}
|
212
|
+
promise = @client.make_request_async(:get, path_template, options)
|
213
|
+
|
214
|
+
promise = promise.then do |result|
|
215
|
+
http_response = result.response
|
216
|
+
status_code = http_response.status
|
217
|
+
response_content = http_response.body
|
218
|
+
unless status_code == 200
|
219
|
+
error_model = JSON.load(response_content)
|
220
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
221
|
+
end
|
222
|
+
|
223
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
224
|
+
# Deserialize Response
|
225
|
+
if status_code == 200
|
226
|
+
begin
|
227
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
228
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::ReservationList.mapper()
|
229
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
230
|
+
rescue Exception => e
|
231
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
result
|
236
|
+
end
|
237
|
+
|
238
|
+
promise.execute
|
239
|
+
end
|
240
|
+
|
241
|
+
#
|
242
|
+
# Get `Reservation` details.
|
243
|
+
#
|
244
|
+
# Get specific `Reservation` details.
|
245
|
+
#
|
246
|
+
# @param reservation_id [String] Id of the Reservation Item
|
247
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
248
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
249
|
+
# will be added to the HTTP request.
|
250
|
+
#
|
251
|
+
# @return [ReservationResponse] operation results.
|
252
|
+
#
|
253
|
+
def get(reservation_id, reservation_order_id, custom_headers:nil)
|
254
|
+
response = get_async(reservation_id, reservation_order_id, custom_headers:custom_headers).value!
|
255
|
+
response.body unless response.nil?
|
256
|
+
end
|
257
|
+
|
258
|
+
#
|
259
|
+
# Get `Reservation` details.
|
260
|
+
#
|
261
|
+
# Get specific `Reservation` details.
|
262
|
+
#
|
263
|
+
# @param reservation_id [String] Id of the Reservation Item
|
264
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
265
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
266
|
+
# will be added to the HTTP request.
|
267
|
+
#
|
268
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
269
|
+
#
|
270
|
+
def get_with_http_info(reservation_id, reservation_order_id, custom_headers:nil)
|
271
|
+
get_async(reservation_id, reservation_order_id, custom_headers:custom_headers).value!
|
272
|
+
end
|
273
|
+
|
274
|
+
#
|
275
|
+
# Get `Reservation` details.
|
276
|
+
#
|
277
|
+
# Get specific `Reservation` details.
|
278
|
+
#
|
279
|
+
# @param reservation_id [String] Id of the Reservation Item
|
280
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
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_async(reservation_id, reservation_order_id, custom_headers:nil)
|
287
|
+
fail ArgumentError, 'reservation_id is nil' if reservation_id.nil?
|
288
|
+
fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
|
289
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
290
|
+
|
291
|
+
|
292
|
+
request_headers = {}
|
293
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
294
|
+
|
295
|
+
# Set Headers
|
296
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
297
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
298
|
+
path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'
|
299
|
+
|
300
|
+
request_url = @base_url || @client.base_url
|
301
|
+
|
302
|
+
options = {
|
303
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
304
|
+
path_params: {'reservationId' => reservation_id,'reservationOrderId' => reservation_order_id},
|
305
|
+
query_params: {'api-version' => @client.api_version},
|
306
|
+
headers: request_headers.merge(custom_headers || {}),
|
307
|
+
base_url: request_url
|
308
|
+
}
|
309
|
+
promise = @client.make_request_async(:get, path_template, options)
|
310
|
+
|
311
|
+
promise = promise.then do |result|
|
312
|
+
http_response = result.response
|
313
|
+
status_code = http_response.status
|
314
|
+
response_content = http_response.body
|
315
|
+
unless status_code == 200
|
316
|
+
error_model = JSON.load(response_content)
|
317
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
318
|
+
end
|
319
|
+
|
320
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
321
|
+
# Deserialize Response
|
322
|
+
if status_code == 200
|
323
|
+
begin
|
324
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
325
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::ReservationResponse.mapper()
|
326
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
327
|
+
rescue Exception => e
|
328
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
result
|
333
|
+
end
|
334
|
+
|
335
|
+
promise.execute
|
336
|
+
end
|
337
|
+
|
338
|
+
#
|
339
|
+
# Updates a `Reservation`.
|
340
|
+
#
|
341
|
+
# Updates the applied scopes of the `Reservation`.
|
342
|
+
#
|
343
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
344
|
+
# @param reservation_id [String] Id of the Reservation Item
|
345
|
+
# @param parameters [Patch] Information needed to patch a reservation item
|
346
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
347
|
+
# will be added to the HTTP request.
|
348
|
+
#
|
349
|
+
# @return [ReservationResponse] operation results.
|
350
|
+
#
|
351
|
+
def update(reservation_order_id, reservation_id, parameters, custom_headers:nil)
|
352
|
+
response = update_async(reservation_order_id, reservation_id, parameters, custom_headers:custom_headers).value!
|
353
|
+
response.body unless response.nil?
|
354
|
+
end
|
355
|
+
|
356
|
+
#
|
357
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
358
|
+
# @param reservation_id [String] Id of the Reservation Item
|
359
|
+
# @param parameters [Patch] Information needed to patch a reservation item
|
360
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
361
|
+
# will be added to the HTTP request.
|
362
|
+
#
|
363
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
364
|
+
# response.
|
365
|
+
#
|
366
|
+
def update_async(reservation_order_id, reservation_id, parameters, custom_headers:nil)
|
367
|
+
# Send request
|
368
|
+
promise = begin_update_async(reservation_order_id, reservation_id, parameters, custom_headers:custom_headers)
|
369
|
+
|
370
|
+
promise = promise.then do |response|
|
371
|
+
# Defining deserialization method.
|
372
|
+
deserialize_method = lambda do |parsed_response|
|
373
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::ReservationResponse.mapper()
|
374
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
375
|
+
end
|
376
|
+
|
377
|
+
# Waiting for response.
|
378
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
379
|
+
end
|
380
|
+
|
381
|
+
promise
|
382
|
+
end
|
383
|
+
|
384
|
+
#
|
385
|
+
# Get `Reservation` revisions.
|
386
|
+
#
|
387
|
+
# List of all the revisions for the `Reservation`.
|
388
|
+
#
|
389
|
+
# @param reservation_id [String] Id of the Reservation Item
|
390
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
391
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
392
|
+
# will be added to the HTTP request.
|
393
|
+
#
|
394
|
+
# @return [Array<ReservationResponse>] operation results.
|
395
|
+
#
|
396
|
+
def list_revisions(reservation_id, reservation_order_id, custom_headers:nil)
|
397
|
+
first_page = list_revisions_as_lazy(reservation_id, reservation_order_id, custom_headers:custom_headers)
|
398
|
+
first_page.get_all_items
|
399
|
+
end
|
400
|
+
|
401
|
+
#
|
402
|
+
# Get `Reservation` revisions.
|
403
|
+
#
|
404
|
+
# List of all the revisions for the `Reservation`.
|
405
|
+
#
|
406
|
+
# @param reservation_id [String] Id of the Reservation Item
|
407
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
408
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
409
|
+
# will be added to the HTTP request.
|
410
|
+
#
|
411
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
412
|
+
#
|
413
|
+
def list_revisions_with_http_info(reservation_id, reservation_order_id, custom_headers:nil)
|
414
|
+
list_revisions_async(reservation_id, reservation_order_id, custom_headers:custom_headers).value!
|
415
|
+
end
|
416
|
+
|
417
|
+
#
|
418
|
+
# Get `Reservation` revisions.
|
419
|
+
#
|
420
|
+
# List of all the revisions for the `Reservation`.
|
421
|
+
#
|
422
|
+
# @param reservation_id [String] Id of the Reservation Item
|
423
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
424
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
425
|
+
# to the HTTP request.
|
426
|
+
#
|
427
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
428
|
+
#
|
429
|
+
def list_revisions_async(reservation_id, reservation_order_id, custom_headers:nil)
|
430
|
+
fail ArgumentError, 'reservation_id is nil' if reservation_id.nil?
|
431
|
+
fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
|
432
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
433
|
+
|
434
|
+
|
435
|
+
request_headers = {}
|
436
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
437
|
+
|
438
|
+
# Set Headers
|
439
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
440
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
441
|
+
path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions'
|
442
|
+
|
443
|
+
request_url = @base_url || @client.base_url
|
444
|
+
|
445
|
+
options = {
|
446
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
447
|
+
path_params: {'reservationId' => reservation_id,'reservationOrderId' => reservation_order_id},
|
448
|
+
query_params: {'api-version' => @client.api_version},
|
449
|
+
headers: request_headers.merge(custom_headers || {}),
|
450
|
+
base_url: request_url
|
451
|
+
}
|
452
|
+
promise = @client.make_request_async(:get, path_template, options)
|
453
|
+
|
454
|
+
promise = promise.then do |result|
|
455
|
+
http_response = result.response
|
456
|
+
status_code = http_response.status
|
457
|
+
response_content = http_response.body
|
458
|
+
unless status_code == 200
|
459
|
+
error_model = JSON.load(response_content)
|
460
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
461
|
+
end
|
462
|
+
|
463
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
464
|
+
# Deserialize Response
|
465
|
+
if status_code == 200
|
466
|
+
begin
|
467
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
468
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::ReservationList.mapper()
|
469
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
470
|
+
rescue Exception => e
|
471
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
475
|
+
result
|
476
|
+
end
|
477
|
+
|
478
|
+
promise.execute
|
479
|
+
end
|
480
|
+
|
481
|
+
#
|
482
|
+
# Split the `Reservation`.
|
483
|
+
#
|
484
|
+
# Split a `Reservation` into two `Reservation`s with specified quantity
|
485
|
+
# distribution.
|
486
|
+
#
|
487
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
488
|
+
# @param body [SplitRequest] Information needed to Split a reservation item
|
489
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
490
|
+
# will be added to the HTTP request.
|
491
|
+
#
|
492
|
+
# @return [Array] operation results.
|
493
|
+
#
|
494
|
+
def begin_split(reservation_order_id, body, custom_headers:nil)
|
495
|
+
response = begin_split_async(reservation_order_id, body, custom_headers:custom_headers).value!
|
496
|
+
response.body unless response.nil?
|
497
|
+
end
|
498
|
+
|
499
|
+
#
|
500
|
+
# Split the `Reservation`.
|
501
|
+
#
|
502
|
+
# Split a `Reservation` into two `Reservation`s with specified quantity
|
503
|
+
# distribution.
|
504
|
+
#
|
505
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
506
|
+
# @param body [SplitRequest] Information needed to Split a reservation item
|
507
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
508
|
+
# will be added to the HTTP request.
|
509
|
+
#
|
510
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
511
|
+
#
|
512
|
+
def begin_split_with_http_info(reservation_order_id, body, custom_headers:nil)
|
513
|
+
begin_split_async(reservation_order_id, body, custom_headers:custom_headers).value!
|
514
|
+
end
|
515
|
+
|
516
|
+
#
|
517
|
+
# Split the `Reservation`.
|
518
|
+
#
|
519
|
+
# Split a `Reservation` into two `Reservation`s with specified quantity
|
520
|
+
# distribution.
|
521
|
+
#
|
522
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
523
|
+
# @param body [SplitRequest] Information needed to Split a reservation item
|
524
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
525
|
+
# to the HTTP request.
|
526
|
+
#
|
527
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
528
|
+
#
|
529
|
+
def begin_split_async(reservation_order_id, body, custom_headers:nil)
|
530
|
+
fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
|
531
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
532
|
+
fail ArgumentError, 'body is nil' if body.nil?
|
533
|
+
|
534
|
+
|
535
|
+
request_headers = {}
|
536
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
537
|
+
|
538
|
+
# Set Headers
|
539
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
540
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
541
|
+
|
542
|
+
# Serialize Request
|
543
|
+
request_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::SplitRequest.mapper()
|
544
|
+
request_content = @client.serialize(request_mapper, body)
|
545
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
546
|
+
|
547
|
+
path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split'
|
548
|
+
|
549
|
+
request_url = @base_url || @client.base_url
|
550
|
+
|
551
|
+
options = {
|
552
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
553
|
+
path_params: {'reservationOrderId' => reservation_order_id},
|
554
|
+
query_params: {'api-version' => @client.api_version},
|
555
|
+
body: request_content,
|
556
|
+
headers: request_headers.merge(custom_headers || {}),
|
557
|
+
base_url: request_url
|
558
|
+
}
|
559
|
+
promise = @client.make_request_async(:post, path_template, options)
|
560
|
+
|
561
|
+
promise = promise.then do |result|
|
562
|
+
http_response = result.response
|
563
|
+
status_code = http_response.status
|
564
|
+
response_content = http_response.body
|
565
|
+
unless status_code == 200 || status_code == 202
|
566
|
+
error_model = JSON.load(response_content)
|
567
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
568
|
+
end
|
569
|
+
|
570
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
571
|
+
# Deserialize Response
|
572
|
+
if status_code == 200
|
573
|
+
begin
|
574
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
575
|
+
result_mapper = {
|
576
|
+
client_side_validation: true,
|
577
|
+
required: false,
|
578
|
+
serialized_name: 'parsed_response',
|
579
|
+
type: {
|
580
|
+
name: 'Sequence',
|
581
|
+
element: {
|
582
|
+
client_side_validation: true,
|
583
|
+
required: false,
|
584
|
+
serialized_name: 'ReservationResponseElementType',
|
585
|
+
type: {
|
586
|
+
name: 'Composite',
|
587
|
+
class_name: 'ReservationResponse'
|
588
|
+
}
|
589
|
+
}
|
590
|
+
}
|
591
|
+
}
|
592
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
593
|
+
rescue Exception => e
|
594
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
595
|
+
end
|
596
|
+
end
|
597
|
+
|
598
|
+
result
|
599
|
+
end
|
600
|
+
|
601
|
+
promise.execute
|
602
|
+
end
|
603
|
+
|
604
|
+
#
|
605
|
+
# Merges two `Reservation`s.
|
606
|
+
#
|
607
|
+
# Merge the specified `Reservation`s into a new `Reservation`. The two
|
608
|
+
# `Reservation`s being merged must have same properties.
|
609
|
+
#
|
610
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
611
|
+
# @param body [MergeRequest] Information needed for commercial request for a
|
612
|
+
# reservation
|
613
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
614
|
+
# will be added to the HTTP request.
|
615
|
+
#
|
616
|
+
# @return [Array] operation results.
|
617
|
+
#
|
618
|
+
def begin_merge(reservation_order_id, body, custom_headers:nil)
|
619
|
+
response = begin_merge_async(reservation_order_id, body, custom_headers:custom_headers).value!
|
620
|
+
response.body unless response.nil?
|
621
|
+
end
|
622
|
+
|
623
|
+
#
|
624
|
+
# Merges two `Reservation`s.
|
625
|
+
#
|
626
|
+
# Merge the specified `Reservation`s into a new `Reservation`. The two
|
627
|
+
# `Reservation`s being merged must have same properties.
|
628
|
+
#
|
629
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
630
|
+
# @param body [MergeRequest] Information needed for commercial request for a
|
631
|
+
# reservation
|
632
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
633
|
+
# will be added to the HTTP request.
|
634
|
+
#
|
635
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
636
|
+
#
|
637
|
+
def begin_merge_with_http_info(reservation_order_id, body, custom_headers:nil)
|
638
|
+
begin_merge_async(reservation_order_id, body, custom_headers:custom_headers).value!
|
639
|
+
end
|
640
|
+
|
641
|
+
#
|
642
|
+
# Merges two `Reservation`s.
|
643
|
+
#
|
644
|
+
# Merge the specified `Reservation`s into a new `Reservation`. The two
|
645
|
+
# `Reservation`s being merged must have same properties.
|
646
|
+
#
|
647
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
648
|
+
# @param body [MergeRequest] Information needed for commercial request for a
|
649
|
+
# reservation
|
650
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
651
|
+
# to the HTTP request.
|
652
|
+
#
|
653
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
654
|
+
#
|
655
|
+
def begin_merge_async(reservation_order_id, body, custom_headers:nil)
|
656
|
+
fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
|
657
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
658
|
+
fail ArgumentError, 'body is nil' if body.nil?
|
659
|
+
|
660
|
+
|
661
|
+
request_headers = {}
|
662
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
663
|
+
|
664
|
+
# Set Headers
|
665
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
666
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
667
|
+
|
668
|
+
# Serialize Request
|
669
|
+
request_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::MergeRequest.mapper()
|
670
|
+
request_content = @client.serialize(request_mapper, body)
|
671
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
672
|
+
|
673
|
+
path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge'
|
674
|
+
|
675
|
+
request_url = @base_url || @client.base_url
|
676
|
+
|
677
|
+
options = {
|
678
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
679
|
+
path_params: {'reservationOrderId' => reservation_order_id},
|
680
|
+
query_params: {'api-version' => @client.api_version},
|
681
|
+
body: request_content,
|
682
|
+
headers: request_headers.merge(custom_headers || {}),
|
683
|
+
base_url: request_url
|
684
|
+
}
|
685
|
+
promise = @client.make_request_async(:post, path_template, options)
|
686
|
+
|
687
|
+
promise = promise.then do |result|
|
688
|
+
http_response = result.response
|
689
|
+
status_code = http_response.status
|
690
|
+
response_content = http_response.body
|
691
|
+
unless status_code == 200 || status_code == 202
|
692
|
+
error_model = JSON.load(response_content)
|
693
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
694
|
+
end
|
695
|
+
|
696
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
697
|
+
# Deserialize Response
|
698
|
+
if status_code == 200
|
699
|
+
begin
|
700
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
701
|
+
result_mapper = {
|
702
|
+
client_side_validation: true,
|
703
|
+
required: false,
|
704
|
+
serialized_name: 'parsed_response',
|
705
|
+
type: {
|
706
|
+
name: 'Sequence',
|
707
|
+
element: {
|
708
|
+
client_side_validation: true,
|
709
|
+
required: false,
|
710
|
+
serialized_name: 'ReservationResponseElementType',
|
711
|
+
type: {
|
712
|
+
name: 'Composite',
|
713
|
+
class_name: 'ReservationResponse'
|
714
|
+
}
|
715
|
+
}
|
716
|
+
}
|
717
|
+
}
|
718
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
719
|
+
rescue Exception => e
|
720
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
721
|
+
end
|
722
|
+
end
|
723
|
+
|
724
|
+
result
|
725
|
+
end
|
726
|
+
|
727
|
+
promise.execute
|
728
|
+
end
|
729
|
+
|
730
|
+
#
|
731
|
+
# Updates a `Reservation`.
|
732
|
+
#
|
733
|
+
# Updates the applied scopes of the `Reservation`.
|
734
|
+
#
|
735
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
736
|
+
# @param reservation_id [String] Id of the Reservation Item
|
737
|
+
# @param parameters [Patch] Information needed to patch a reservation item
|
738
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
739
|
+
# will be added to the HTTP request.
|
740
|
+
#
|
741
|
+
# @return [ReservationResponse] operation results.
|
742
|
+
#
|
743
|
+
def begin_update(reservation_order_id, reservation_id, parameters, custom_headers:nil)
|
744
|
+
response = begin_update_async(reservation_order_id, reservation_id, parameters, custom_headers:custom_headers).value!
|
745
|
+
response.body unless response.nil?
|
746
|
+
end
|
747
|
+
|
748
|
+
#
|
749
|
+
# Updates a `Reservation`.
|
750
|
+
#
|
751
|
+
# Updates the applied scopes of the `Reservation`.
|
752
|
+
#
|
753
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
754
|
+
# @param reservation_id [String] Id of the Reservation Item
|
755
|
+
# @param parameters [Patch] Information needed to patch a reservation item
|
756
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
757
|
+
# will be added to the HTTP request.
|
758
|
+
#
|
759
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
760
|
+
#
|
761
|
+
def begin_update_with_http_info(reservation_order_id, reservation_id, parameters, custom_headers:nil)
|
762
|
+
begin_update_async(reservation_order_id, reservation_id, parameters, custom_headers:custom_headers).value!
|
763
|
+
end
|
764
|
+
|
765
|
+
#
|
766
|
+
# Updates a `Reservation`.
|
767
|
+
#
|
768
|
+
# Updates the applied scopes of the `Reservation`.
|
769
|
+
#
|
770
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
771
|
+
# @param reservation_id [String] Id of the Reservation Item
|
772
|
+
# @param parameters [Patch] Information needed to patch a reservation item
|
773
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
774
|
+
# to the HTTP request.
|
775
|
+
#
|
776
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
777
|
+
#
|
778
|
+
def begin_update_async(reservation_order_id, reservation_id, parameters, custom_headers:nil)
|
779
|
+
fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
|
780
|
+
fail ArgumentError, 'reservation_id is nil' if reservation_id.nil?
|
781
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
782
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
783
|
+
|
784
|
+
|
785
|
+
request_headers = {}
|
786
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
787
|
+
|
788
|
+
# Set Headers
|
789
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
790
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
791
|
+
|
792
|
+
# Serialize Request
|
793
|
+
request_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::Patch.mapper()
|
794
|
+
request_content = @client.serialize(request_mapper, parameters)
|
795
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
796
|
+
|
797
|
+
path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'
|
798
|
+
|
799
|
+
request_url = @base_url || @client.base_url
|
800
|
+
|
801
|
+
options = {
|
802
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
803
|
+
path_params: {'reservationOrderId' => reservation_order_id,'reservationId' => reservation_id},
|
804
|
+
query_params: {'api-version' => @client.api_version},
|
805
|
+
body: request_content,
|
806
|
+
headers: request_headers.merge(custom_headers || {}),
|
807
|
+
base_url: request_url
|
808
|
+
}
|
809
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
810
|
+
|
811
|
+
promise = promise.then do |result|
|
812
|
+
http_response = result.response
|
813
|
+
status_code = http_response.status
|
814
|
+
response_content = http_response.body
|
815
|
+
unless status_code == 200 || status_code == 202
|
816
|
+
error_model = JSON.load(response_content)
|
817
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
818
|
+
end
|
819
|
+
|
820
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
821
|
+
# Deserialize Response
|
822
|
+
if status_code == 200
|
823
|
+
begin
|
824
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
825
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::ReservationResponse.mapper()
|
826
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
827
|
+
rescue Exception => e
|
828
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
829
|
+
end
|
830
|
+
end
|
831
|
+
|
832
|
+
result
|
833
|
+
end
|
834
|
+
|
835
|
+
promise.execute
|
836
|
+
end
|
837
|
+
|
838
|
+
#
|
839
|
+
# Get `Reservation`s in a given reservation Order
|
840
|
+
#
|
841
|
+
# List `Reservation`s within a single `ReservationOrder`.
|
842
|
+
#
|
843
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
844
|
+
# to List operation.
|
845
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
846
|
+
# will be added to the HTTP request.
|
847
|
+
#
|
848
|
+
# @return [ReservationList] operation results.
|
849
|
+
#
|
850
|
+
def list_next(next_page_link, custom_headers:nil)
|
851
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
852
|
+
response.body unless response.nil?
|
853
|
+
end
|
854
|
+
|
855
|
+
#
|
856
|
+
# Get `Reservation`s in a given reservation Order
|
857
|
+
#
|
858
|
+
# List `Reservation`s within a single `ReservationOrder`.
|
859
|
+
#
|
860
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
861
|
+
# to List operation.
|
862
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
863
|
+
# will be added to the HTTP request.
|
864
|
+
#
|
865
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
866
|
+
#
|
867
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
868
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
869
|
+
end
|
870
|
+
|
871
|
+
#
|
872
|
+
# Get `Reservation`s in a given reservation Order
|
873
|
+
#
|
874
|
+
# List `Reservation`s within a single `ReservationOrder`.
|
875
|
+
#
|
876
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
877
|
+
# to List operation.
|
878
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
879
|
+
# to the HTTP request.
|
880
|
+
#
|
881
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
882
|
+
#
|
883
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
884
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
885
|
+
|
886
|
+
|
887
|
+
request_headers = {}
|
888
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
889
|
+
|
890
|
+
# Set Headers
|
891
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
892
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
893
|
+
path_template = '{nextLink}'
|
894
|
+
|
895
|
+
request_url = @base_url || @client.base_url
|
896
|
+
|
897
|
+
options = {
|
898
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
899
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
900
|
+
headers: request_headers.merge(custom_headers || {}),
|
901
|
+
base_url: request_url
|
902
|
+
}
|
903
|
+
promise = @client.make_request_async(:get, path_template, options)
|
904
|
+
|
905
|
+
promise = promise.then do |result|
|
906
|
+
http_response = result.response
|
907
|
+
status_code = http_response.status
|
908
|
+
response_content = http_response.body
|
909
|
+
unless status_code == 200
|
910
|
+
error_model = JSON.load(response_content)
|
911
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
912
|
+
end
|
913
|
+
|
914
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
915
|
+
# Deserialize Response
|
916
|
+
if status_code == 200
|
917
|
+
begin
|
918
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
919
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::ReservationList.mapper()
|
920
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
921
|
+
rescue Exception => e
|
922
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
923
|
+
end
|
924
|
+
end
|
925
|
+
|
926
|
+
result
|
927
|
+
end
|
928
|
+
|
929
|
+
promise.execute
|
930
|
+
end
|
931
|
+
|
932
|
+
#
|
933
|
+
# Get `Reservation` revisions.
|
934
|
+
#
|
935
|
+
# List of all the revisions for the `Reservation`.
|
936
|
+
#
|
937
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
938
|
+
# to List operation.
|
939
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
940
|
+
# will be added to the HTTP request.
|
941
|
+
#
|
942
|
+
# @return [ReservationList] operation results.
|
943
|
+
#
|
944
|
+
def list_revisions_next(next_page_link, custom_headers:nil)
|
945
|
+
response = list_revisions_next_async(next_page_link, custom_headers:custom_headers).value!
|
946
|
+
response.body unless response.nil?
|
947
|
+
end
|
948
|
+
|
949
|
+
#
|
950
|
+
# Get `Reservation` revisions.
|
951
|
+
#
|
952
|
+
# List of all the revisions for the `Reservation`.
|
953
|
+
#
|
954
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
955
|
+
# to List operation.
|
956
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
957
|
+
# will be added to the HTTP request.
|
958
|
+
#
|
959
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
960
|
+
#
|
961
|
+
def list_revisions_next_with_http_info(next_page_link, custom_headers:nil)
|
962
|
+
list_revisions_next_async(next_page_link, custom_headers:custom_headers).value!
|
963
|
+
end
|
964
|
+
|
965
|
+
#
|
966
|
+
# Get `Reservation` revisions.
|
967
|
+
#
|
968
|
+
# List of all the revisions for the `Reservation`.
|
969
|
+
#
|
970
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
971
|
+
# to List operation.
|
972
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
973
|
+
# to the HTTP request.
|
974
|
+
#
|
975
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
976
|
+
#
|
977
|
+
def list_revisions_next_async(next_page_link, custom_headers:nil)
|
978
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
979
|
+
|
980
|
+
|
981
|
+
request_headers = {}
|
982
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
983
|
+
|
984
|
+
# Set Headers
|
985
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
986
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
987
|
+
path_template = '{nextLink}'
|
988
|
+
|
989
|
+
request_url = @base_url || @client.base_url
|
990
|
+
|
991
|
+
options = {
|
992
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
993
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
994
|
+
headers: request_headers.merge(custom_headers || {}),
|
995
|
+
base_url: request_url
|
996
|
+
}
|
997
|
+
promise = @client.make_request_async(:get, path_template, options)
|
998
|
+
|
999
|
+
promise = promise.then do |result|
|
1000
|
+
http_response = result.response
|
1001
|
+
status_code = http_response.status
|
1002
|
+
response_content = http_response.body
|
1003
|
+
unless status_code == 200
|
1004
|
+
error_model = JSON.load(response_content)
|
1005
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1009
|
+
# Deserialize Response
|
1010
|
+
if status_code == 200
|
1011
|
+
begin
|
1012
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1013
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_04_01_preview::Models::ReservationList.mapper()
|
1014
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1015
|
+
rescue Exception => e
|
1016
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1017
|
+
end
|
1018
|
+
end
|
1019
|
+
|
1020
|
+
result
|
1021
|
+
end
|
1022
|
+
|
1023
|
+
promise.execute
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
#
|
1027
|
+
# Get `Reservation`s in a given reservation Order
|
1028
|
+
#
|
1029
|
+
# List `Reservation`s within a single `ReservationOrder`.
|
1030
|
+
#
|
1031
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
1032
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1033
|
+
# will be added to the HTTP request.
|
1034
|
+
#
|
1035
|
+
# @return [ReservationList] which provide lazy access to pages of the response.
|
1036
|
+
#
|
1037
|
+
def list_as_lazy(reservation_order_id, custom_headers:nil)
|
1038
|
+
response = list_async(reservation_order_id, custom_headers:custom_headers).value!
|
1039
|
+
unless response.nil?
|
1040
|
+
page = response.body
|
1041
|
+
page.next_method = Proc.new do |next_page_link|
|
1042
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
1043
|
+
end
|
1044
|
+
page
|
1045
|
+
end
|
1046
|
+
end
|
1047
|
+
|
1048
|
+
#
|
1049
|
+
# Get `Reservation` revisions.
|
1050
|
+
#
|
1051
|
+
# List of all the revisions for the `Reservation`.
|
1052
|
+
#
|
1053
|
+
# @param reservation_id [String] Id of the Reservation Item
|
1054
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
1055
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1056
|
+
# will be added to the HTTP request.
|
1057
|
+
#
|
1058
|
+
# @return [ReservationList] which provide lazy access to pages of the response.
|
1059
|
+
#
|
1060
|
+
def list_revisions_as_lazy(reservation_id, reservation_order_id, custom_headers:nil)
|
1061
|
+
response = list_revisions_async(reservation_id, reservation_order_id, custom_headers:custom_headers).value!
|
1062
|
+
unless response.nil?
|
1063
|
+
page = response.body
|
1064
|
+
page.next_method = Proc.new do |next_page_link|
|
1065
|
+
list_revisions_next_async(next_page_link, custom_headers:custom_headers)
|
1066
|
+
end
|
1067
|
+
page
|
1068
|
+
end
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
end
|
1072
|
+
end
|