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