azure_mgmt_reservations 0.20.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 +232 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/reservation.rb +1125 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/reservation_order.rb +338 -0
- data/lib/2017-11-01/generated/azure_mgmt_reservations/reservations_management_client.rb +339 -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 +232 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservation.rb +1125 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservation_order.rb +338 -0
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +352 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations.rb +76 -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 +130 -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 +171 -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 +111 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/patch_properties_renew_properties.rb +48 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/payment_detail.rb +118 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/payment_status.rb +18 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/price.rb +59 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/properties.rb +48 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/purchase_request.rb +183 -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/renew_properties_response.rb +76 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/renew_properties_response_billing_currency_total.rb +59 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/renew_properties_response_pricing_currency_total.rb +60 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_billing_plan.rb +16 -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_billing_plan_information.rb +91 -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 +207 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_properties.rb +290 -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 +22 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/scope_properties.rb +58 -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/models/subscription_scope_properties.rb +56 -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 +232 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservation.rb +1266 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservation_order.rb +607 -0
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +355 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations.rb +54 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/auto_quota_increase.rb +223 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/actions.rb +47 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/aqi_settings.rb +46 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/auto_quota_increase_detail.rb +119 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/create_generic_quota_request_parameters.rb +55 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/current_quota_limit.rb +71 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/current_quota_limit_base.rb +47 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/email_action.rb +46 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/email_actions.rb +55 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/exception_response.rb +47 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/phone_action.rb +57 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_limits.rb +99 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_limits_response.rb +68 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_properties.rb +120 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_details.rb +128 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_details_list.rb +99 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_one_resource_submit_response.rb +121 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_properties.rb +92 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_submit_response.rb +83 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_submit_response201.rb +96 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/resource_name.rb +59 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/service_error.rb +78 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/service_error_detail.rb +59 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/sub_request.rb +118 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/support_request_action.rb +142 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/module_definition.rb +9 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quota.rb +805 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quota_request_status.rb +397 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +136 -0
- data/lib/azure_mgmt_reservations.rb +9 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/modules/reservations_profile_module.rb +359 -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 +269 -0
@@ -0,0 +1,338 @@
|
|
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
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
99
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
100
|
+
# Deserialize Response
|
101
|
+
if status_code == 200
|
102
|
+
begin
|
103
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
104
|
+
result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationOrderList.mapper()
|
105
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
106
|
+
rescue Exception => e
|
107
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
result
|
112
|
+
end
|
113
|
+
|
114
|
+
promise.execute
|
115
|
+
end
|
116
|
+
|
117
|
+
#
|
118
|
+
# Get a specific `ReservationOrder`.
|
119
|
+
#
|
120
|
+
# Get the details of the `ReservationOrder`.
|
121
|
+
#
|
122
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
123
|
+
#
|
124
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
125
|
+
# will be added to the HTTP request.
|
126
|
+
#
|
127
|
+
# @return [ReservationOrderResponse] operation results.
|
128
|
+
#
|
129
|
+
def get(reservation_order_id, custom_headers:nil)
|
130
|
+
response = get_async(reservation_order_id, custom_headers:custom_headers).value!
|
131
|
+
response.body unless response.nil?
|
132
|
+
end
|
133
|
+
|
134
|
+
#
|
135
|
+
# Get a specific `ReservationOrder`.
|
136
|
+
#
|
137
|
+
# Get the details of the `ReservationOrder`.
|
138
|
+
#
|
139
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
140
|
+
#
|
141
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
142
|
+
# will be added to the HTTP request.
|
143
|
+
#
|
144
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
145
|
+
#
|
146
|
+
def get_with_http_info(reservation_order_id, custom_headers:nil)
|
147
|
+
get_async(reservation_order_id, custom_headers:custom_headers).value!
|
148
|
+
end
|
149
|
+
|
150
|
+
#
|
151
|
+
# Get a specific `ReservationOrder`.
|
152
|
+
#
|
153
|
+
# Get the details of the `ReservationOrder`.
|
154
|
+
#
|
155
|
+
# @param reservation_order_id [String] Order Id of the reservation
|
156
|
+
#
|
157
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
158
|
+
# to the HTTP request.
|
159
|
+
#
|
160
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
161
|
+
#
|
162
|
+
def get_async(reservation_order_id, custom_headers:nil)
|
163
|
+
fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
|
164
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
165
|
+
|
166
|
+
|
167
|
+
request_headers = {}
|
168
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
169
|
+
|
170
|
+
# Set Headers
|
171
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
172
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
173
|
+
path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'
|
174
|
+
|
175
|
+
request_url = @base_url || @client.base_url
|
176
|
+
|
177
|
+
options = {
|
178
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
179
|
+
path_params: {'reservationOrderId' => reservation_order_id},
|
180
|
+
query_params: {'api-version' => @client.api_version},
|
181
|
+
headers: request_headers.merge(custom_headers || {}),
|
182
|
+
base_url: request_url
|
183
|
+
}
|
184
|
+
promise = @client.make_request_async(:get, path_template, options)
|
185
|
+
|
186
|
+
promise = promise.then do |result|
|
187
|
+
http_response = result.response
|
188
|
+
status_code = http_response.status
|
189
|
+
response_content = http_response.body
|
190
|
+
unless status_code == 200
|
191
|
+
error_model = JSON.load(response_content)
|
192
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
193
|
+
end
|
194
|
+
|
195
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
196
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
197
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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 = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationOrderResponse.mapper()
|
203
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
204
|
+
rescue Exception => e
|
205
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
result
|
210
|
+
end
|
211
|
+
|
212
|
+
promise.execute
|
213
|
+
end
|
214
|
+
|
215
|
+
#
|
216
|
+
# Get all `ReservationOrder`s.
|
217
|
+
#
|
218
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
219
|
+
# current tenant.
|
220
|
+
#
|
221
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
222
|
+
# to List operation.
|
223
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
224
|
+
# will be added to the HTTP request.
|
225
|
+
#
|
226
|
+
# @return [ReservationOrderList] operation results.
|
227
|
+
#
|
228
|
+
def list_next(next_page_link, custom_headers:nil)
|
229
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
230
|
+
response.body unless response.nil?
|
231
|
+
end
|
232
|
+
|
233
|
+
#
|
234
|
+
# Get all `ReservationOrder`s.
|
235
|
+
#
|
236
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
237
|
+
# current tenant.
|
238
|
+
#
|
239
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
240
|
+
# to List operation.
|
241
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
242
|
+
# will be added to the HTTP request.
|
243
|
+
#
|
244
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
245
|
+
#
|
246
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
247
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
248
|
+
end
|
249
|
+
|
250
|
+
#
|
251
|
+
# Get all `ReservationOrder`s.
|
252
|
+
#
|
253
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
254
|
+
# current tenant.
|
255
|
+
#
|
256
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
257
|
+
# to List operation.
|
258
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
259
|
+
# to the HTTP request.
|
260
|
+
#
|
261
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
262
|
+
#
|
263
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
264
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
265
|
+
|
266
|
+
|
267
|
+
request_headers = {}
|
268
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
269
|
+
|
270
|
+
# Set Headers
|
271
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
272
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
273
|
+
path_template = '{nextLink}'
|
274
|
+
|
275
|
+
request_url = @base_url || @client.base_url
|
276
|
+
|
277
|
+
options = {
|
278
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
279
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
280
|
+
headers: request_headers.merge(custom_headers || {}),
|
281
|
+
base_url: request_url
|
282
|
+
}
|
283
|
+
promise = @client.make_request_async(:get, path_template, options)
|
284
|
+
|
285
|
+
promise = promise.then do |result|
|
286
|
+
http_response = result.response
|
287
|
+
status_code = http_response.status
|
288
|
+
response_content = http_response.body
|
289
|
+
unless status_code == 200
|
290
|
+
error_model = JSON.load(response_content)
|
291
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
292
|
+
end
|
293
|
+
|
294
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
295
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
296
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
297
|
+
# Deserialize Response
|
298
|
+
if status_code == 200
|
299
|
+
begin
|
300
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
301
|
+
result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationOrderList.mapper()
|
302
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
303
|
+
rescue Exception => e
|
304
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
result
|
309
|
+
end
|
310
|
+
|
311
|
+
promise.execute
|
312
|
+
end
|
313
|
+
|
314
|
+
#
|
315
|
+
# Get all `ReservationOrder`s.
|
316
|
+
#
|
317
|
+
# List of all the `ReservationOrder`s that the user has access to in the
|
318
|
+
# current tenant.
|
319
|
+
#
|
320
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
321
|
+
# will be added to the HTTP request.
|
322
|
+
#
|
323
|
+
# @return [ReservationOrderList] which provide lazy access to pages of the
|
324
|
+
# response.
|
325
|
+
#
|
326
|
+
def list_as_lazy(custom_headers:nil)
|
327
|
+
response = list_async(custom_headers:custom_headers).value!
|
328
|
+
unless response.nil?
|
329
|
+
page = response.body
|
330
|
+
page.next_method = Proc.new do |next_page_link|
|
331
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
332
|
+
end
|
333
|
+
page
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
end
|
338
|
+
end
|
@@ -0,0 +1,339 @@
|
|
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
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
199
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
200
|
+
# Deserialize Response
|
201
|
+
if status_code == 200
|
202
|
+
begin
|
203
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
204
|
+
result_mapper = {
|
205
|
+
client_side_validation: true,
|
206
|
+
required: false,
|
207
|
+
serialized_name: 'parsed_response',
|
208
|
+
type: {
|
209
|
+
name: 'Sequence',
|
210
|
+
element: {
|
211
|
+
client_side_validation: true,
|
212
|
+
required: false,
|
213
|
+
serialized_name: 'CatalogElementType',
|
214
|
+
type: {
|
215
|
+
name: 'Composite',
|
216
|
+
class_name: 'Catalog'
|
217
|
+
}
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
221
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
222
|
+
rescue Exception => e
|
223
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
result
|
228
|
+
end
|
229
|
+
|
230
|
+
promise.execute
|
231
|
+
end
|
232
|
+
|
233
|
+
#
|
234
|
+
# Get list of applicable `Reservation`s.
|
235
|
+
#
|
236
|
+
# Get applicable `Reservation`s that are applied to this subscription.
|
237
|
+
#
|
238
|
+
# @param subscription_id [String] Id of the subscription
|
239
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
240
|
+
# will be added to the HTTP request.
|
241
|
+
#
|
242
|
+
# @return [AppliedReservations] operation results.
|
243
|
+
#
|
244
|
+
def get_applied_reservation_list(subscription_id, custom_headers:nil)
|
245
|
+
response = get_applied_reservation_list_async(subscription_id, custom_headers:custom_headers).value!
|
246
|
+
response.body unless response.nil?
|
247
|
+
end
|
248
|
+
|
249
|
+
#
|
250
|
+
# Get list of applicable `Reservation`s.
|
251
|
+
#
|
252
|
+
# Get applicable `Reservation`s that are applied to this subscription.
|
253
|
+
#
|
254
|
+
# @param subscription_id [String] Id of the subscription
|
255
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
256
|
+
# will be added to the HTTP request.
|
257
|
+
#
|
258
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
259
|
+
#
|
260
|
+
def get_applied_reservation_list_with_http_info(subscription_id, custom_headers:nil)
|
261
|
+
get_applied_reservation_list_async(subscription_id, custom_headers:custom_headers).value!
|
262
|
+
end
|
263
|
+
|
264
|
+
#
|
265
|
+
# Get list of applicable `Reservation`s.
|
266
|
+
#
|
267
|
+
# Get applicable `Reservation`s that are applied to this subscription.
|
268
|
+
#
|
269
|
+
# @param subscription_id [String] Id of the subscription
|
270
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
271
|
+
# to the HTTP request.
|
272
|
+
#
|
273
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
274
|
+
#
|
275
|
+
def get_applied_reservation_list_async(subscription_id, custom_headers:nil)
|
276
|
+
fail ArgumentError, 'api_version is nil' if api_version.nil?
|
277
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
278
|
+
|
279
|
+
|
280
|
+
request_headers = {}
|
281
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
282
|
+
|
283
|
+
# Set Headers
|
284
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
285
|
+
request_headers['accept-language'] = accept_language unless accept_language.nil?
|
286
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations'
|
287
|
+
|
288
|
+
request_url = @base_url || self.base_url
|
289
|
+
|
290
|
+
options = {
|
291
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
292
|
+
path_params: {'subscriptionId' => subscription_id},
|
293
|
+
query_params: {'api-version' => api_version},
|
294
|
+
headers: request_headers.merge(custom_headers || {}),
|
295
|
+
base_url: request_url
|
296
|
+
}
|
297
|
+
promise = self.make_request_async(:get, path_template, options)
|
298
|
+
|
299
|
+
promise = promise.then do |result|
|
300
|
+
http_response = result.response
|
301
|
+
status_code = http_response.status
|
302
|
+
response_content = http_response.body
|
303
|
+
unless status_code == 200
|
304
|
+
error_model = JSON.load(response_content)
|
305
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
306
|
+
end
|
307
|
+
|
308
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
309
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
310
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
311
|
+
# Deserialize Response
|
312
|
+
if status_code == 200
|
313
|
+
begin
|
314
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
315
|
+
result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::AppliedReservations.mapper()
|
316
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
317
|
+
rescue Exception => e
|
318
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
result
|
323
|
+
end
|
324
|
+
|
325
|
+
promise.execute
|
326
|
+
end
|
327
|
+
|
328
|
+
|
329
|
+
private
|
330
|
+
#
|
331
|
+
# Adds telemetry information.
|
332
|
+
#
|
333
|
+
def add_telemetry
|
334
|
+
sdk_information = 'azure_mgmt_reservations'
|
335
|
+
sdk_information = "#{sdk_information}/0.20.0"
|
336
|
+
add_user_agent_information(sdk_information)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|