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