azure_mgmt_reservations 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/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::V2017_11_01
|
|
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::V2017_11_01::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::V2017_11_01::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::V2017_11_01::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
|
|
@@ -0,0 +1,335 @@
|
|
|
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::V2017_11_01
|
|
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 = '2017-11-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 custom_headers [Hash{String => String}] A hash of custom headers that
|
|
131
|
+
# will be added to the HTTP request.
|
|
132
|
+
#
|
|
133
|
+
# @return [Array] operation results.
|
|
134
|
+
#
|
|
135
|
+
def get_catalog(subscription_id, custom_headers:nil)
|
|
136
|
+
response = get_catalog_async(subscription_id, custom_headers:custom_headers).value!
|
|
137
|
+
response.body unless response.nil?
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
#
|
|
141
|
+
# Get the regions and skus that are available for RI purchase for the specified
|
|
142
|
+
# Azure subscription.
|
|
143
|
+
#
|
|
144
|
+
# @param subscription_id [String] Id of the subscription
|
|
145
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
146
|
+
# will be added to the HTTP request.
|
|
147
|
+
#
|
|
148
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
149
|
+
#
|
|
150
|
+
def get_catalog_with_http_info(subscription_id, custom_headers:nil)
|
|
151
|
+
get_catalog_async(subscription_id, custom_headers:custom_headers).value!
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
#
|
|
155
|
+
# Get the regions and skus that are available for RI purchase for the specified
|
|
156
|
+
# Azure subscription.
|
|
157
|
+
#
|
|
158
|
+
# @param subscription_id [String] Id of the subscription
|
|
159
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
160
|
+
# to the HTTP request.
|
|
161
|
+
#
|
|
162
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
163
|
+
#
|
|
164
|
+
def get_catalog_async(subscription_id, custom_headers:nil)
|
|
165
|
+
fail ArgumentError, 'api_version is nil' if api_version.nil?
|
|
166
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
request_headers = {}
|
|
170
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
171
|
+
|
|
172
|
+
# Set Headers
|
|
173
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
174
|
+
request_headers['accept-language'] = accept_language unless accept_language.nil?
|
|
175
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs'
|
|
176
|
+
|
|
177
|
+
request_url = @base_url || self.base_url
|
|
178
|
+
|
|
179
|
+
options = {
|
|
180
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
181
|
+
path_params: {'subscriptionId' => subscription_id},
|
|
182
|
+
query_params: {'api-version' => api_version},
|
|
183
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
184
|
+
base_url: request_url
|
|
185
|
+
}
|
|
186
|
+
promise = self.make_request_async(:get, path_template, options)
|
|
187
|
+
|
|
188
|
+
promise = promise.then do |result|
|
|
189
|
+
http_response = result.response
|
|
190
|
+
status_code = http_response.status
|
|
191
|
+
response_content = http_response.body
|
|
192
|
+
unless status_code == 200
|
|
193
|
+
error_model = JSON.load(response_content)
|
|
194
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
198
|
+
# Deserialize Response
|
|
199
|
+
if status_code == 200
|
|
200
|
+
begin
|
|
201
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
202
|
+
result_mapper = {
|
|
203
|
+
client_side_validation: true,
|
|
204
|
+
required: false,
|
|
205
|
+
serialized_name: 'parsed_response',
|
|
206
|
+
type: {
|
|
207
|
+
name: 'Sequence',
|
|
208
|
+
element: {
|
|
209
|
+
client_side_validation: true,
|
|
210
|
+
required: false,
|
|
211
|
+
serialized_name: 'CatalogElementType',
|
|
212
|
+
type: {
|
|
213
|
+
name: 'Composite',
|
|
214
|
+
class_name: 'Catalog'
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
|
220
|
+
rescue Exception => e
|
|
221
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
result
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
promise.execute
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
#
|
|
232
|
+
# Get list of applicable `Reservation`s.
|
|
233
|
+
#
|
|
234
|
+
# Get applicable `Reservation`s that are applied to this subscription.
|
|
235
|
+
#
|
|
236
|
+
# @param subscription_id [String] Id of the subscription
|
|
237
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
238
|
+
# will be added to the HTTP request.
|
|
239
|
+
#
|
|
240
|
+
# @return [AppliedReservations] operation results.
|
|
241
|
+
#
|
|
242
|
+
def get_applied_reservation_list(subscription_id, custom_headers:nil)
|
|
243
|
+
response = get_applied_reservation_list_async(subscription_id, custom_headers:custom_headers).value!
|
|
244
|
+
response.body unless response.nil?
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
#
|
|
248
|
+
# Get list of applicable `Reservation`s.
|
|
249
|
+
#
|
|
250
|
+
# Get applicable `Reservation`s that are applied to this subscription.
|
|
251
|
+
#
|
|
252
|
+
# @param subscription_id [String] Id of the subscription
|
|
253
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
254
|
+
# will be added to the HTTP request.
|
|
255
|
+
#
|
|
256
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
257
|
+
#
|
|
258
|
+
def get_applied_reservation_list_with_http_info(subscription_id, custom_headers:nil)
|
|
259
|
+
get_applied_reservation_list_async(subscription_id, custom_headers:custom_headers).value!
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
#
|
|
263
|
+
# Get list of applicable `Reservation`s.
|
|
264
|
+
#
|
|
265
|
+
# Get applicable `Reservation`s that are applied to this subscription.
|
|
266
|
+
#
|
|
267
|
+
# @param subscription_id [String] Id of the subscription
|
|
268
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
269
|
+
# to the HTTP request.
|
|
270
|
+
#
|
|
271
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
272
|
+
#
|
|
273
|
+
def get_applied_reservation_list_async(subscription_id, custom_headers:nil)
|
|
274
|
+
fail ArgumentError, 'api_version is nil' if api_version.nil?
|
|
275
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
request_headers = {}
|
|
279
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
280
|
+
|
|
281
|
+
# Set Headers
|
|
282
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
283
|
+
request_headers['accept-language'] = accept_language unless accept_language.nil?
|
|
284
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations'
|
|
285
|
+
|
|
286
|
+
request_url = @base_url || self.base_url
|
|
287
|
+
|
|
288
|
+
options = {
|
|
289
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
290
|
+
path_params: {'subscriptionId' => subscription_id},
|
|
291
|
+
query_params: {'api-version' => api_version},
|
|
292
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
293
|
+
base_url: request_url
|
|
294
|
+
}
|
|
295
|
+
promise = self.make_request_async(:get, path_template, options)
|
|
296
|
+
|
|
297
|
+
promise = promise.then do |result|
|
|
298
|
+
http_response = result.response
|
|
299
|
+
status_code = http_response.status
|
|
300
|
+
response_content = http_response.body
|
|
301
|
+
unless status_code == 200
|
|
302
|
+
error_model = JSON.load(response_content)
|
|
303
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
307
|
+
# Deserialize Response
|
|
308
|
+
if status_code == 200
|
|
309
|
+
begin
|
|
310
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
311
|
+
result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::AppliedReservations.mapper()
|
|
312
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
|
313
|
+
rescue Exception => e
|
|
314
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
result
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
promise.execute
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
private
|
|
326
|
+
#
|
|
327
|
+
# Adds telemetry information.
|
|
328
|
+
#
|
|
329
|
+
def add_telemetry
|
|
330
|
+
sdk_information = 'azure_mgmt_reservations'
|
|
331
|
+
sdk_information = "#{sdk_information}/0.17.0"
|
|
332
|
+
add_user_agent_information(sdk_information)
|
|
333
|
+
end
|
|
334
|
+
end
|
|
335
|
+
end
|