azure_mgmt_consumption 0.15.2 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +4 -1
- data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/operations.rb +15 -13
- data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/usage_details.rb +15 -13
- data/lib/2017-11-30/generated/azure_mgmt_consumption.rb +12 -5
- data/lib/2017-11-30/generated/azure_mgmt_consumption/consumption_management_client.rb +12 -1
- data/lib/2017-11-30/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
- data/lib/2017-11-30/generated/azure_mgmt_consumption/models/reservation_details.rb +187 -0
- data/lib/2017-11-30/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +56 -0
- data/lib/2017-11-30/generated/azure_mgmt_consumption/models/reservation_summaries.rb +205 -0
- data/lib/2017-11-30/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +57 -0
- data/lib/2017-11-30/generated/azure_mgmt_consumption/operations.rb +15 -13
- data/lib/2017-11-30/generated/azure_mgmt_consumption/reservations_details.rb +129 -0
- data/lib/2017-11-30/generated/azure_mgmt_consumption/reservations_summaries.rb +135 -0
- data/lib/2017-11-30/generated/azure_mgmt_consumption/usage_details.rb +15 -13
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption.rb +42 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/budgets.rb +384 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +138 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/budget.rb +160 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/budgets_list_result.rb +57 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/notification.rb +115 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/operation.rb +59 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/module_definition.rb +9 -0
- data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/operations.rb +216 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption.rb +62 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/budgets.rb +993 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/consumption_management_client.rb +155 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/marketplaces.rb +521 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/budget.rb +171 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/budgets_list_result.rb +101 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/category_type.rb +16 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/filters.rb +106 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/marketplace.rb +375 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb +101 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/meter_details.rb +122 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/notification.rb +139 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/operation.rb +59 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +134 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/reservation_details.rb +187 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +100 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/reservation_summaries.rb +205 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +101 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/resource.rb +91 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/usage_detail.rb +355 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/module_definition.rb +9 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/operations.rb +216 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/price_sheet.rb +246 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/reservations_details.rb +449 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/reservations_summaries.rb +465 -0
- data/lib/2018-01-31/generated/azure_mgmt_consumption/usage_details.rb +553 -0
- data/lib/azure_mgmt_consumption.rb +2 -0
- data/lib/profiles/latest/consumption_latest_profile_client.rb +28 -9
- data/lib/profiles/latest/consumption_module_definition.rb +0 -1
- data/lib/profiles/latest/modules/consumption_profile_module.rb +153 -48
- data/lib/version.rb +1 -1
- metadata +65 -2
@@ -0,0 +1,101 @@
|
|
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::Consumption::Mgmt::V2018_01_31
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Result of listing usage details. It contains a list of available usage
|
10
|
+
# details in reverse chronological order by billing period.
|
11
|
+
#
|
12
|
+
class UsageDetailsListResult
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
include MsRest::JSONable
|
17
|
+
# @return [Array<UsageDetail>] The list of usage details.
|
18
|
+
attr_accessor :value
|
19
|
+
|
20
|
+
# @return [String] The link (url) to the next page of results.
|
21
|
+
attr_accessor :next_link
|
22
|
+
|
23
|
+
# return [Proc] with next page method call.
|
24
|
+
attr_accessor :next_method
|
25
|
+
|
26
|
+
#
|
27
|
+
# Gets the rest of the items for the request, enabling auto-pagination.
|
28
|
+
#
|
29
|
+
# @return [Array<UsageDetail>] operation results.
|
30
|
+
#
|
31
|
+
def get_all_items
|
32
|
+
items = @value
|
33
|
+
page = self
|
34
|
+
while page.next_link != nil do
|
35
|
+
page = page.get_next_page
|
36
|
+
items.concat(page.value)
|
37
|
+
end
|
38
|
+
items
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Gets the next page of results.
|
43
|
+
#
|
44
|
+
# @return [UsageDetailsListResult] with next page content.
|
45
|
+
#
|
46
|
+
def get_next_page
|
47
|
+
response = @next_method.call(@next_link).value! unless @next_method.nil?
|
48
|
+
unless response.nil?
|
49
|
+
@next_link = response.body.next_link
|
50
|
+
@value = response.body.value
|
51
|
+
self
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Mapper for UsageDetailsListResult class as Ruby Hash.
|
57
|
+
# This will be used for serialization/deserialization.
|
58
|
+
#
|
59
|
+
def self.mapper()
|
60
|
+
{
|
61
|
+
client_side_validation: true,
|
62
|
+
required: false,
|
63
|
+
serialized_name: 'UsageDetailsListResult',
|
64
|
+
type: {
|
65
|
+
name: 'Composite',
|
66
|
+
class_name: 'UsageDetailsListResult',
|
67
|
+
model_properties: {
|
68
|
+
value: {
|
69
|
+
client_side_validation: true,
|
70
|
+
required: false,
|
71
|
+
read_only: true,
|
72
|
+
serialized_name: 'value',
|
73
|
+
type: {
|
74
|
+
name: 'Sequence',
|
75
|
+
element: {
|
76
|
+
client_side_validation: true,
|
77
|
+
required: false,
|
78
|
+
serialized_name: 'UsageDetailElementType',
|
79
|
+
type: {
|
80
|
+
name: 'Composite',
|
81
|
+
class_name: 'UsageDetail'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
},
|
86
|
+
next_link: {
|
87
|
+
client_side_validation: true,
|
88
|
+
required: false,
|
89
|
+
read_only: true,
|
90
|
+
serialized_name: 'nextLink',
|
91
|
+
type: {
|
92
|
+
name: 'String'
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,9 @@
|
|
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 end
|
7
|
+
module Azure::Consumption end
|
8
|
+
module Azure::Consumption::Mgmt end
|
9
|
+
module Azure::Consumption::Mgmt::V2018_01_31 end
|
@@ -0,0 +1,216 @@
|
|
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::Consumption::Mgmt::V2018_01_31
|
7
|
+
#
|
8
|
+
# Consumption management client provides access to consumption resources for
|
9
|
+
# Azure Enterprise Subscriptions.
|
10
|
+
#
|
11
|
+
class Operations
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the Operations class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [ConsumptionManagementClient] reference to the ConsumptionManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Lists all of the available consumption REST API operations.
|
27
|
+
#
|
28
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
29
|
+
# will be added to the HTTP request.
|
30
|
+
#
|
31
|
+
# @return [Array<Operation>] operation results.
|
32
|
+
#
|
33
|
+
def list(custom_headers:nil)
|
34
|
+
first_page = list_as_lazy(custom_headers:custom_headers)
|
35
|
+
first_page.get_all_items
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Lists all of the available consumption REST API operations.
|
40
|
+
#
|
41
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
42
|
+
# will be added to the HTTP request.
|
43
|
+
#
|
44
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
45
|
+
#
|
46
|
+
def list_with_http_info(custom_headers:nil)
|
47
|
+
list_async(custom_headers:custom_headers).value!
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# Lists all of the available consumption REST API operations.
|
52
|
+
#
|
53
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
54
|
+
# to the HTTP request.
|
55
|
+
#
|
56
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
57
|
+
#
|
58
|
+
def list_async(custom_headers:nil)
|
59
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
60
|
+
|
61
|
+
|
62
|
+
request_headers = {}
|
63
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
64
|
+
|
65
|
+
# Set Headers
|
66
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
67
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
68
|
+
path_template = 'providers/Microsoft.Consumption/operations'
|
69
|
+
|
70
|
+
request_url = @base_url || @client.base_url
|
71
|
+
|
72
|
+
options = {
|
73
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
74
|
+
query_params: {'api-version' => @client.api_version},
|
75
|
+
headers: request_headers.merge(custom_headers || {}),
|
76
|
+
base_url: request_url
|
77
|
+
}
|
78
|
+
promise = @client.make_request_async(:get, path_template, options)
|
79
|
+
|
80
|
+
promise = promise.then do |result|
|
81
|
+
http_response = result.response
|
82
|
+
status_code = http_response.status
|
83
|
+
response_content = http_response.body
|
84
|
+
unless status_code == 200
|
85
|
+
error_model = JSON.load(response_content)
|
86
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
87
|
+
end
|
88
|
+
|
89
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
90
|
+
# Deserialize Response
|
91
|
+
if status_code == 200
|
92
|
+
begin
|
93
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
94
|
+
result_mapper = Azure::Consumption::Mgmt::V2018_01_31::Models::OperationListResult.mapper()
|
95
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
96
|
+
rescue Exception => e
|
97
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
result
|
102
|
+
end
|
103
|
+
|
104
|
+
promise.execute
|
105
|
+
end
|
106
|
+
|
107
|
+
#
|
108
|
+
# Lists all of the available consumption REST API operations.
|
109
|
+
#
|
110
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
111
|
+
# to List operation.
|
112
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
113
|
+
# will be added to the HTTP request.
|
114
|
+
#
|
115
|
+
# @return [OperationListResult] operation results.
|
116
|
+
#
|
117
|
+
def list_next(next_page_link, custom_headers:nil)
|
118
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
119
|
+
response.body unless response.nil?
|
120
|
+
end
|
121
|
+
|
122
|
+
#
|
123
|
+
# Lists all of the available consumption REST API operations.
|
124
|
+
#
|
125
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
126
|
+
# to List operation.
|
127
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
128
|
+
# will be added to the HTTP request.
|
129
|
+
#
|
130
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
131
|
+
#
|
132
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
133
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
134
|
+
end
|
135
|
+
|
136
|
+
#
|
137
|
+
# Lists all of the available consumption REST API operations.
|
138
|
+
#
|
139
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
140
|
+
# to List operation.
|
141
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
142
|
+
# to the HTTP request.
|
143
|
+
#
|
144
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
145
|
+
#
|
146
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
147
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
148
|
+
|
149
|
+
|
150
|
+
request_headers = {}
|
151
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
152
|
+
|
153
|
+
# Set Headers
|
154
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
155
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
156
|
+
path_template = '{nextLink}'
|
157
|
+
|
158
|
+
request_url = @base_url || @client.base_url
|
159
|
+
|
160
|
+
options = {
|
161
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
162
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
163
|
+
headers: request_headers.merge(custom_headers || {}),
|
164
|
+
base_url: request_url
|
165
|
+
}
|
166
|
+
promise = @client.make_request_async(:get, path_template, options)
|
167
|
+
|
168
|
+
promise = promise.then do |result|
|
169
|
+
http_response = result.response
|
170
|
+
status_code = http_response.status
|
171
|
+
response_content = http_response.body
|
172
|
+
unless status_code == 200
|
173
|
+
error_model = JSON.load(response_content)
|
174
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
175
|
+
end
|
176
|
+
|
177
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
178
|
+
# Deserialize Response
|
179
|
+
if status_code == 200
|
180
|
+
begin
|
181
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
182
|
+
result_mapper = Azure::Consumption::Mgmt::V2018_01_31::Models::OperationListResult.mapper()
|
183
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
184
|
+
rescue Exception => e
|
185
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
result
|
190
|
+
end
|
191
|
+
|
192
|
+
promise.execute
|
193
|
+
end
|
194
|
+
|
195
|
+
#
|
196
|
+
# Lists all of the available consumption REST API operations.
|
197
|
+
#
|
198
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
199
|
+
# will be added to the HTTP request.
|
200
|
+
#
|
201
|
+
# @return [OperationListResult] which provide lazy access to pages of the
|
202
|
+
# response.
|
203
|
+
#
|
204
|
+
def list_as_lazy(custom_headers:nil)
|
205
|
+
response = list_async(custom_headers:custom_headers).value!
|
206
|
+
unless response.nil?
|
207
|
+
page = response.body
|
208
|
+
page.next_method = Proc.new do |next_page_link|
|
209
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
210
|
+
end
|
211
|
+
page
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
end
|
@@ -0,0 +1,246 @@
|
|
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::Consumption::Mgmt::V2018_01_31
|
7
|
+
#
|
8
|
+
# Consumption management client provides access to consumption resources for
|
9
|
+
# Azure Enterprise Subscriptions.
|
10
|
+
#
|
11
|
+
class PriceSheet
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the PriceSheet class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [ConsumptionManagementClient] reference to the ConsumptionManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Gets the price sheet for a scope by subscriptionId. Price sheet is available
|
27
|
+
# via this API only for May 1, 2014 or later.
|
28
|
+
#
|
29
|
+
# @param expand [String] May be used to expand the properties/meterDetails
|
30
|
+
# within a price sheet. By default, these fields are not included when
|
31
|
+
# returning price sheet.
|
32
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
33
|
+
# returned a partial result. If a previous response contains a nextLink
|
34
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
35
|
+
# that specifies a starting point to use for subsequent calls.
|
36
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
37
|
+
# will be added to the HTTP request.
|
38
|
+
#
|
39
|
+
# @return [PriceSheetResult] operation results.
|
40
|
+
#
|
41
|
+
def get(expand:nil, skiptoken:nil, custom_headers:nil)
|
42
|
+
response = get_async(expand:expand, skiptoken:skiptoken, custom_headers:custom_headers).value!
|
43
|
+
response.body unless response.nil?
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Gets the price sheet for a scope by subscriptionId. Price sheet is available
|
48
|
+
# via this API only for May 1, 2014 or later.
|
49
|
+
#
|
50
|
+
# @param expand [String] May be used to expand the properties/meterDetails
|
51
|
+
# within a price sheet. By default, these fields are not included when
|
52
|
+
# returning price sheet.
|
53
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
54
|
+
# returned a partial result. If a previous response contains a nextLink
|
55
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
56
|
+
# that specifies a starting point to use for subsequent calls.
|
57
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
58
|
+
# will be added to the HTTP request.
|
59
|
+
#
|
60
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
61
|
+
#
|
62
|
+
def get_with_http_info(expand:nil, skiptoken:nil, custom_headers:nil)
|
63
|
+
get_async(expand:expand, skiptoken:skiptoken, custom_headers:custom_headers).value!
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Gets the price sheet for a scope by subscriptionId. Price sheet is available
|
68
|
+
# via this API only for May 1, 2014 or later.
|
69
|
+
#
|
70
|
+
# @param expand [String] May be used to expand the properties/meterDetails
|
71
|
+
# within a price sheet. By default, these fields are not included when
|
72
|
+
# returning price sheet.
|
73
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
74
|
+
# returned a partial result. If a previous response contains a nextLink
|
75
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
76
|
+
# that specifies a starting point to use for subsequent calls.
|
77
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
78
|
+
# to the HTTP request.
|
79
|
+
#
|
80
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
81
|
+
#
|
82
|
+
def get_async(expand:nil, skiptoken:nil, custom_headers:nil)
|
83
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
84
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
85
|
+
|
86
|
+
|
87
|
+
request_headers = {}
|
88
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
89
|
+
|
90
|
+
# Set Headers
|
91
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
92
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
93
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default'
|
94
|
+
|
95
|
+
request_url = @base_url || @client.base_url
|
96
|
+
|
97
|
+
options = {
|
98
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
99
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
100
|
+
query_params: {'$expand' => expand,'$skiptoken' => skiptoken,'api-version' => @client.api_version},
|
101
|
+
headers: request_headers.merge(custom_headers || {}),
|
102
|
+
base_url: request_url
|
103
|
+
}
|
104
|
+
promise = @client.make_request_async(:get, path_template, options)
|
105
|
+
|
106
|
+
promise = promise.then do |result|
|
107
|
+
http_response = result.response
|
108
|
+
status_code = http_response.status
|
109
|
+
response_content = http_response.body
|
110
|
+
unless status_code == 200
|
111
|
+
error_model = JSON.load(response_content)
|
112
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
113
|
+
end
|
114
|
+
|
115
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
116
|
+
# Deserialize Response
|
117
|
+
if status_code == 200
|
118
|
+
begin
|
119
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
120
|
+
result_mapper = Azure::Consumption::Mgmt::V2018_01_31::Models::PriceSheetResult.mapper()
|
121
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
122
|
+
rescue Exception => e
|
123
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
result
|
128
|
+
end
|
129
|
+
|
130
|
+
promise.execute
|
131
|
+
end
|
132
|
+
|
133
|
+
#
|
134
|
+
# Get the price sheet for a scope by subscriptionId and billing period. Price
|
135
|
+
# sheet is available via this API only for May 1, 2014 or later.
|
136
|
+
#
|
137
|
+
# @param billing_period_name [String] Billing Period Name.
|
138
|
+
# @param expand [String] May be used to expand the properties/meterDetails
|
139
|
+
# within a price sheet. By default, these fields are not included when
|
140
|
+
# returning price sheet.
|
141
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
142
|
+
# returned a partial result. If a previous response contains a nextLink
|
143
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
144
|
+
# that specifies a starting point to use for subsequent calls.
|
145
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
146
|
+
# will be added to the HTTP request.
|
147
|
+
#
|
148
|
+
# @return [PriceSheetResult] operation results.
|
149
|
+
#
|
150
|
+
def get_by_billing_period(billing_period_name, expand:nil, skiptoken:nil, custom_headers:nil)
|
151
|
+
response = get_by_billing_period_async(billing_period_name, expand:expand, skiptoken:skiptoken, custom_headers:custom_headers).value!
|
152
|
+
response.body unless response.nil?
|
153
|
+
end
|
154
|
+
|
155
|
+
#
|
156
|
+
# Get the price sheet for a scope by subscriptionId and billing period. Price
|
157
|
+
# sheet is available via this API only for May 1, 2014 or later.
|
158
|
+
#
|
159
|
+
# @param billing_period_name [String] Billing Period Name.
|
160
|
+
# @param expand [String] May be used to expand the properties/meterDetails
|
161
|
+
# within a price sheet. By default, these fields are not included when
|
162
|
+
# returning price sheet.
|
163
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
164
|
+
# returned a partial result. If a previous response contains a nextLink
|
165
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
166
|
+
# that specifies a starting point to use for subsequent calls.
|
167
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
168
|
+
# will be added to the HTTP request.
|
169
|
+
#
|
170
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
171
|
+
#
|
172
|
+
def get_by_billing_period_with_http_info(billing_period_name, expand:nil, skiptoken:nil, custom_headers:nil)
|
173
|
+
get_by_billing_period_async(billing_period_name, expand:expand, skiptoken:skiptoken, custom_headers:custom_headers).value!
|
174
|
+
end
|
175
|
+
|
176
|
+
#
|
177
|
+
# Get the price sheet for a scope by subscriptionId and billing period. Price
|
178
|
+
# sheet is available via this API only for May 1, 2014 or later.
|
179
|
+
#
|
180
|
+
# @param billing_period_name [String] Billing Period Name.
|
181
|
+
# @param expand [String] May be used to expand the properties/meterDetails
|
182
|
+
# within a price sheet. By default, these fields are not included when
|
183
|
+
# returning price sheet.
|
184
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
185
|
+
# returned a partial result. If a previous response contains a nextLink
|
186
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
187
|
+
# that specifies a starting point to use for subsequent calls.
|
188
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
189
|
+
# to the HTTP request.
|
190
|
+
#
|
191
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
192
|
+
#
|
193
|
+
def get_by_billing_period_async(billing_period_name, expand:nil, skiptoken:nil, custom_headers:nil)
|
194
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
195
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
196
|
+
fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
|
197
|
+
|
198
|
+
|
199
|
+
request_headers = {}
|
200
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
201
|
+
|
202
|
+
# Set Headers
|
203
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
204
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
205
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/pricesheets/default'
|
206
|
+
|
207
|
+
request_url = @base_url || @client.base_url
|
208
|
+
|
209
|
+
options = {
|
210
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
211
|
+
path_params: {'subscriptionId' => @client.subscription_id,'billingPeriodName' => billing_period_name},
|
212
|
+
query_params: {'$expand' => expand,'$skiptoken' => skiptoken,'api-version' => @client.api_version},
|
213
|
+
headers: request_headers.merge(custom_headers || {}),
|
214
|
+
base_url: request_url
|
215
|
+
}
|
216
|
+
promise = @client.make_request_async(:get, path_template, options)
|
217
|
+
|
218
|
+
promise = promise.then do |result|
|
219
|
+
http_response = result.response
|
220
|
+
status_code = http_response.status
|
221
|
+
response_content = http_response.body
|
222
|
+
unless status_code == 200
|
223
|
+
error_model = JSON.load(response_content)
|
224
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
225
|
+
end
|
226
|
+
|
227
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
228
|
+
# Deserialize Response
|
229
|
+
if status_code == 200
|
230
|
+
begin
|
231
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
232
|
+
result_mapper = Azure::Consumption::Mgmt::V2018_01_31::Models::PriceSheetResult.mapper()
|
233
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
234
|
+
rescue Exception => e
|
235
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
result
|
240
|
+
end
|
241
|
+
|
242
|
+
promise.execute
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
246
|
+
end
|