azure_mgmt_commerce 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,192 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Commerce
7
+ module Models
8
+ #
9
+ # Describes the usageAggregation.
10
+ #
11
+ class UsageAggregation
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Unique Id for the usage aggregate.
16
+ attr_accessor :id
17
+
18
+ # @return [String] Name of the usage aggregate.
19
+ attr_accessor :name
20
+
21
+ # @return [String] Type of the resource being returned.
22
+ attr_accessor :type
23
+
24
+ # @return The subscription identifier for the Azure user.
25
+ attr_accessor :subscription_id
26
+
27
+ # @return [String] Unique ID for the resource that was consumed (aka
28
+ # ResourceID).
29
+ attr_accessor :meter_id
30
+
31
+ # @return [DateTime] UTC start time for the usage bucket to which this
32
+ # usage aggregate belongs.
33
+ attr_accessor :usage_start_time
34
+
35
+ # @return [DateTime] UTC end time for the usage bucket to which this
36
+ # usage aggregate belongs.
37
+ attr_accessor :usage_end_time
38
+
39
+ # @return The amount of the resource consumption that occurred in this
40
+ # time frame.
41
+ attr_accessor :quantity
42
+
43
+ # @return [String] The unit in which the usage for this resource is
44
+ # being counted, e.g. Hours, GB.
45
+ attr_accessor :unit
46
+
47
+ # @return [String] Friendly name of the resource being consumed.
48
+ attr_accessor :meter_name
49
+
50
+ # @return [String] Category of the consumed resource.
51
+ attr_accessor :meter_category
52
+
53
+ # @return [String] Sub-category of the consumed resource.
54
+ attr_accessor :meter_sub_category
55
+
56
+ # @return [String] Region of the meterId used for billing purposes
57
+ attr_accessor :meter_region
58
+
59
+ # @return [InfoField] Key-value pairs of instance details (legacy
60
+ # format).
61
+ attr_accessor :info_fields
62
+
63
+ # @return [String] Key-value pairs of instance details represented as a
64
+ # string.
65
+ attr_accessor :instance_data
66
+
67
+
68
+ #
69
+ # Mapper for UsageAggregation class as Ruby Hash.
70
+ # This will be used for serialization/deserialization.
71
+ #
72
+ def self.mapper()
73
+ {
74
+ required: false,
75
+ serialized_name: 'UsageAggregation',
76
+ type: {
77
+ name: 'Composite',
78
+ class_name: 'UsageAggregation',
79
+ model_properties: {
80
+ id: {
81
+ required: false,
82
+ serialized_name: 'id',
83
+ type: {
84
+ name: 'String'
85
+ }
86
+ },
87
+ name: {
88
+ required: false,
89
+ serialized_name: 'name',
90
+ type: {
91
+ name: 'String'
92
+ }
93
+ },
94
+ type: {
95
+ required: false,
96
+ serialized_name: 'type',
97
+ type: {
98
+ name: 'String'
99
+ }
100
+ },
101
+ subscription_id: {
102
+ required: false,
103
+ serialized_name: 'properties.subscriptionId',
104
+ type: {
105
+ name: 'String'
106
+ }
107
+ },
108
+ meter_id: {
109
+ required: false,
110
+ serialized_name: 'properties.meterId',
111
+ type: {
112
+ name: 'String'
113
+ }
114
+ },
115
+ usage_start_time: {
116
+ required: false,
117
+ serialized_name: 'properties.usageStartTime',
118
+ type: {
119
+ name: 'DateTime'
120
+ }
121
+ },
122
+ usage_end_time: {
123
+ required: false,
124
+ serialized_name: 'properties.usageEndTime',
125
+ type: {
126
+ name: 'DateTime'
127
+ }
128
+ },
129
+ quantity: {
130
+ required: false,
131
+ serialized_name: 'properties.quantity',
132
+ type: {
133
+ name: 'Object'
134
+ }
135
+ },
136
+ unit: {
137
+ required: false,
138
+ serialized_name: 'properties.unit',
139
+ type: {
140
+ name: 'String'
141
+ }
142
+ },
143
+ meter_name: {
144
+ required: false,
145
+ serialized_name: 'properties.meterName',
146
+ type: {
147
+ name: 'String'
148
+ }
149
+ },
150
+ meter_category: {
151
+ required: false,
152
+ serialized_name: 'properties.meterCategory',
153
+ type: {
154
+ name: 'String'
155
+ }
156
+ },
157
+ meter_sub_category: {
158
+ required: false,
159
+ serialized_name: 'properties.meterSubCategory',
160
+ type: {
161
+ name: 'String'
162
+ }
163
+ },
164
+ meter_region: {
165
+ required: false,
166
+ serialized_name: 'properties.meterRegion',
167
+ type: {
168
+ name: 'String'
169
+ }
170
+ },
171
+ info_fields: {
172
+ required: false,
173
+ serialized_name: 'properties.infoFields',
174
+ type: {
175
+ name: 'Composite',
176
+ class_name: 'InfoField'
177
+ }
178
+ },
179
+ instance_data: {
180
+ required: false,
181
+ serialized_name: 'properties.instanceData',
182
+ type: {
183
+ name: 'String'
184
+ }
185
+ }
186
+ }
187
+ }
188
+ }
189
+ end
190
+ end
191
+ end
192
+ end
@@ -0,0 +1,94 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Commerce
7
+ module Models
8
+ #
9
+ # The Get UsageAggregates operation response.
10
+ #
11
+ class UsageAggregationListResult
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<UsageAggregation>] Gets or sets details for the
16
+ # requested aggregation.
17
+ attr_accessor :value
18
+
19
+ # @return [String] Gets or sets the link to the next set of results.
20
+ attr_accessor :next_link
21
+
22
+ # return [Proc] with next page method call.
23
+ attr_accessor :next_method
24
+
25
+ #
26
+ # Gets the rest of the items for the request, enabling auto-pagination.
27
+ #
28
+ # @return [Array<UsageAggregation>] operation results.
29
+ #
30
+ def get_all_items
31
+ items = @value
32
+ page = self
33
+ while page.next_link != nil do
34
+ page = page.get_next_page
35
+ items.concat(page.value)
36
+ end
37
+ items
38
+ end
39
+
40
+ #
41
+ # Gets the next page of results.
42
+ #
43
+ # @return [UsageAggregationListResult] with next page content.
44
+ #
45
+ def get_next_page
46
+ response = @next_method.call(@next_link).value! unless @next_method.nil?
47
+ unless response.nil?
48
+ @next_link = response.body.next_link
49
+ @value = response.body.value
50
+ self
51
+ end
52
+ end
53
+
54
+ #
55
+ # Mapper for UsageAggregationListResult class as Ruby Hash.
56
+ # This will be used for serialization/deserialization.
57
+ #
58
+ def self.mapper()
59
+ {
60
+ required: false,
61
+ serialized_name: 'UsageAggregationListResult',
62
+ type: {
63
+ name: 'Composite',
64
+ class_name: 'UsageAggregationListResult',
65
+ model_properties: {
66
+ value: {
67
+ required: false,
68
+ serialized_name: 'value',
69
+ type: {
70
+ name: 'Sequence',
71
+ element: {
72
+ required: false,
73
+ serialized_name: 'UsageAggregationElementType',
74
+ type: {
75
+ name: 'Composite',
76
+ class_name: 'UsageAggregation'
77
+ }
78
+ }
79
+ }
80
+ },
81
+ next_link: {
82
+ required: false,
83
+ serialized_name: 'nextLink',
84
+ type: {
85
+ name: 'String'
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure end
7
+ module Azure::ARM end
8
+ module Azure::ARM::Commerce end
@@ -0,0 +1,148 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Commerce
7
+ #
8
+ # RateCard
9
+ #
10
+ class RateCard
11
+ include Azure::ARM::Commerce::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the RateCard class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the UsageManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Enables you to query for the resource/meter metadata and related prices used
27
+ # in a given subscription by Offer ID, Currency, Locale and Region. The
28
+ # metadata associated with the billing meters, including but not limited to
29
+ # service names, types, resources, units of measure, and regions, is subject
30
+ # to change at any time and without notice. If you intend to use this billing
31
+ # data in an automated fashion, please use the billing meter GUID to uniquely
32
+ # identify each billable item. If the billing meter GUID is scheduled to
33
+ # change due to a new billing model, you will be notified in advance of the
34
+ # change.
35
+ #
36
+ # @param filter [String] The filter to apply on the operation. It ONLY
37
+ # supports the 'eq' and 'and' logical operators at this time. All the 4 query
38
+ # parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required
39
+ # to be a part of the $filter.
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [ResourceRateCardInfo] operation results.
44
+ #
45
+ def get(filter = nil, custom_headers = nil)
46
+ response = get_async(filter, custom_headers).value!
47
+ response.body unless response.nil?
48
+ end
49
+
50
+ #
51
+ # Enables you to query for the resource/meter metadata and related prices used
52
+ # in a given subscription by Offer ID, Currency, Locale and Region. The
53
+ # metadata associated with the billing meters, including but not limited to
54
+ # service names, types, resources, units of measure, and regions, is subject
55
+ # to change at any time and without notice. If you intend to use this billing
56
+ # data in an automated fashion, please use the billing meter GUID to uniquely
57
+ # identify each billable item. If the billing meter GUID is scheduled to
58
+ # change due to a new billing model, you will be notified in advance of the
59
+ # change.
60
+ #
61
+ # @param filter [String] The filter to apply on the operation. It ONLY
62
+ # supports the 'eq' and 'and' logical operators at this time. All the 4 query
63
+ # parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required
64
+ # to be a part of the $filter.
65
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
66
+ # will be added to the HTTP request.
67
+ #
68
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
69
+ #
70
+ def get_with_http_info(filter = nil, custom_headers = nil)
71
+ get_async(filter, custom_headers).value!
72
+ end
73
+
74
+ #
75
+ # Enables you to query for the resource/meter metadata and related prices used
76
+ # in a given subscription by Offer ID, Currency, Locale and Region. The
77
+ # metadata associated with the billing meters, including but not limited to
78
+ # service names, types, resources, units of measure, and regions, is subject
79
+ # to change at any time and without notice. If you intend to use this billing
80
+ # data in an automated fashion, please use the billing meter GUID to uniquely
81
+ # identify each billable item. If the billing meter GUID is scheduled to
82
+ # change due to a new billing model, you will be notified in advance of the
83
+ # change.
84
+ #
85
+ # @param filter [String] The filter to apply on the operation. It ONLY
86
+ # supports the 'eq' and 'and' logical operators at this time. All the 4 query
87
+ # parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required
88
+ # to be a part of the $filter.
89
+ # @param [Hash{String => String}] A hash of custom headers that will be added
90
+ # to the HTTP request.
91
+ #
92
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
93
+ #
94
+ def get_async(filter = nil, custom_headers = nil)
95
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
96
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
97
+
98
+
99
+ request_headers = {}
100
+
101
+ # Set Headers
102
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
103
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
104
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard'
105
+ options = {
106
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
107
+ path_params: {'subscriptionId' => @client.subscription_id},
108
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
109
+ headers: request_headers.merge(custom_headers || {})
110
+ }
111
+
112
+ request_url = @base_url || @client.base_url
113
+
114
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
115
+ promise = request.run_promise do |req|
116
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
117
+ end
118
+
119
+ promise = promise.then do |http_response|
120
+ status_code = http_response.status
121
+ response_content = http_response.body
122
+ unless status_code == 200
123
+ error_model = JSON.load(response_content)
124
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
125
+ end
126
+
127
+ # Create Result
128
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
129
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
130
+ # Deserialize Response
131
+ if status_code == 200
132
+ begin
133
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
134
+ result_mapper = ResourceRateCardInfo.mapper()
135
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
136
+ rescue Exception => e
137
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
138
+ end
139
+ end
140
+
141
+ result
142
+ end
143
+
144
+ promise.execute
145
+ end
146
+
147
+ end
148
+ end
@@ -0,0 +1,268 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Commerce
7
+ #
8
+ # UsageAggregates
9
+ #
10
+ class UsageAggregates
11
+ include Azure::ARM::Commerce::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the UsageAggregates class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the UsageManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Query aggregated Azure subscription consumption data for a date range.
27
+ #
28
+ # @param reportedstart_time [DateTime] The start of the time range to retrieve
29
+ # data for.
30
+ # @param reported_end_time [DateTime] The end of the time range to retrieve
31
+ # data for.
32
+ # @param show_details [Boolean] When set to true (default), the aggregates are
33
+ # broken down into the instance metadata which is more granular.
34
+ # @param aggregation_granularity [AggregationGranularity] Value is either
35
+ # daily (default) or hourly to tell the API how to return the results grouped
36
+ # by day or hour. Possible values include: 'Daily', 'Hourly'
37
+ # @param continuation_token [String] Retrieved from previous calls, this is
38
+ # the bookmark used for progress when the responses are paged.
39
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
40
+ # will be added to the HTTP request.
41
+ #
42
+ # @return [UsageAggregationListResult] which provide lazy access to pages of
43
+ # the response.
44
+ #
45
+ def list_as_lazy(reportedstart_time, reported_end_time, show_details = nil, aggregation_granularity = nil, continuation_token = nil, custom_headers = nil)
46
+ response = list_async(reportedstart_time, reported_end_time, show_details, aggregation_granularity, continuation_token, custom_headers).value!
47
+ unless response.nil?
48
+ page = response.body
49
+ page.next_method = Proc.new do |next_link|
50
+ list_next_async(next_link, custom_headers)
51
+ end
52
+ page
53
+ end
54
+ end
55
+
56
+ #
57
+ # Query aggregated Azure subscription consumption data for a date range.
58
+ #
59
+ # @param reportedstart_time [DateTime] The start of the time range to retrieve
60
+ # data for.
61
+ # @param reported_end_time [DateTime] The end of the time range to retrieve
62
+ # data for.
63
+ # @param show_details [Boolean] When set to true (default), the aggregates are
64
+ # broken down into the instance metadata which is more granular.
65
+ # @param aggregation_granularity [AggregationGranularity] Value is either
66
+ # daily (default) or hourly to tell the API how to return the results grouped
67
+ # by day or hour. Possible values include: 'Daily', 'Hourly'
68
+ # @param continuation_token [String] Retrieved from previous calls, this is
69
+ # the bookmark used for progress when the responses are paged.
70
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
71
+ # will be added to the HTTP request.
72
+ #
73
+ # @return [Array<UsageAggregation>] operation results.
74
+ #
75
+ def list(reportedstart_time, reported_end_time, show_details = nil, aggregation_granularity = nil, continuation_token = nil, custom_headers = nil)
76
+ first_page = list_as_lazy(reportedstart_time, reported_end_time, show_details, aggregation_granularity, continuation_token, custom_headers)
77
+ first_page.get_all_items
78
+ end
79
+
80
+ #
81
+ # Query aggregated Azure subscription consumption data for a date range.
82
+ #
83
+ # @param reportedstart_time [DateTime] The start of the time range to retrieve
84
+ # data for.
85
+ # @param reported_end_time [DateTime] The end of the time range to retrieve
86
+ # data for.
87
+ # @param show_details [Boolean] When set to true (default), the aggregates are
88
+ # broken down into the instance metadata which is more granular.
89
+ # @param aggregation_granularity [AggregationGranularity] Value is either
90
+ # daily (default) or hourly to tell the API how to return the results grouped
91
+ # by day or hour. Possible values include: 'Daily', 'Hourly'
92
+ # @param continuation_token [String] Retrieved from previous calls, this is
93
+ # the bookmark used for progress when the responses are paged.
94
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
95
+ # will be added to the HTTP request.
96
+ #
97
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
98
+ #
99
+ def list_with_http_info(reportedstart_time, reported_end_time, show_details = nil, aggregation_granularity = nil, continuation_token = nil, custom_headers = nil)
100
+ list_async(reportedstart_time, reported_end_time, show_details, aggregation_granularity, continuation_token, custom_headers).value!
101
+ end
102
+
103
+ #
104
+ # Query aggregated Azure subscription consumption data for a date range.
105
+ #
106
+ # @param reportedstart_time [DateTime] The start of the time range to retrieve
107
+ # data for.
108
+ # @param reported_end_time [DateTime] The end of the time range to retrieve
109
+ # data for.
110
+ # @param show_details [Boolean] When set to true (default), the aggregates are
111
+ # broken down into the instance metadata which is more granular.
112
+ # @param aggregation_granularity [AggregationGranularity] Value is either
113
+ # daily (default) or hourly to tell the API how to return the results grouped
114
+ # by day or hour. Possible values include: 'Daily', 'Hourly'
115
+ # @param continuation_token [String] Retrieved from previous calls, this is
116
+ # the bookmark used for progress when the responses are paged.
117
+ # @param [Hash{String => String}] A hash of custom headers that will be added
118
+ # to the HTTP request.
119
+ #
120
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
121
+ #
122
+ def list_async(reportedstart_time, reported_end_time, show_details = nil, aggregation_granularity = nil, continuation_token = nil, custom_headers = nil)
123
+ fail ArgumentError, 'reportedstart_time is nil' if reportedstart_time.nil?
124
+ fail ArgumentError, 'reported_end_time is nil' if reported_end_time.nil?
125
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
126
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
127
+
128
+
129
+ request_headers = {}
130
+
131
+ # Set Headers
132
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
133
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
134
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates'
135
+ options = {
136
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
137
+ path_params: {'subscriptionId' => @client.subscription_id},
138
+ query_params: {'reportedstartTime' => reportedstart_time,'reportedEndTime' => reported_end_time,'showDetails' => show_details,'aggregationGranularity' => aggregation_granularity,'continuationToken' => continuation_token,'api-version' => @client.api_version},
139
+ headers: request_headers.merge(custom_headers || {})
140
+ }
141
+
142
+ request_url = @base_url || @client.base_url
143
+
144
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
145
+ promise = request.run_promise do |req|
146
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
147
+ end
148
+
149
+ promise = promise.then do |http_response|
150
+ status_code = http_response.status
151
+ response_content = http_response.body
152
+ unless status_code == 200
153
+ error_model = JSON.load(response_content)
154
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
155
+ end
156
+
157
+ # Create Result
158
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
159
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
160
+ # Deserialize Response
161
+ if status_code == 200
162
+ begin
163
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
164
+ result_mapper = UsageAggregationListResult.mapper()
165
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
166
+ rescue Exception => e
167
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
168
+ end
169
+ end
170
+
171
+ result
172
+ end
173
+
174
+ promise.execute
175
+ end
176
+
177
+ #
178
+ # Query aggregated Azure subscription consumption data for a date range.
179
+ #
180
+ # @param next_page_link [String] The NextLink from the previous successful
181
+ # call to List operation.
182
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
183
+ # will be added to the HTTP request.
184
+ #
185
+ # @return [UsageAggregationListResult] operation results.
186
+ #
187
+ def list_next(next_page_link, custom_headers = nil)
188
+ response = list_next_async(next_page_link, custom_headers).value!
189
+ response.body unless response.nil?
190
+ end
191
+
192
+ #
193
+ # Query aggregated Azure subscription consumption data for a date range.
194
+ #
195
+ # @param next_page_link [String] The NextLink from the previous successful
196
+ # call to List operation.
197
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
198
+ # will be added to the HTTP request.
199
+ #
200
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
201
+ #
202
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
203
+ list_next_async(next_page_link, custom_headers).value!
204
+ end
205
+
206
+ #
207
+ # Query aggregated Azure subscription consumption data for a date range.
208
+ #
209
+ # @param next_page_link [String] The NextLink from the previous successful
210
+ # call to List operation.
211
+ # @param [Hash{String => String}] A hash of custom headers that will be added
212
+ # to the HTTP request.
213
+ #
214
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
215
+ #
216
+ def list_next_async(next_page_link, custom_headers = nil)
217
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
218
+
219
+
220
+ request_headers = {}
221
+
222
+ # Set Headers
223
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
224
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
225
+ path_template = '{nextLink}'
226
+ options = {
227
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
228
+ skip_encoding_path_params: {'nextLink' => next_page_link},
229
+ headers: request_headers.merge(custom_headers || {})
230
+ }
231
+
232
+ request_url = @base_url || @client.base_url
233
+
234
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
235
+ promise = request.run_promise do |req|
236
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
237
+ end
238
+
239
+ promise = promise.then do |http_response|
240
+ status_code = http_response.status
241
+ response_content = http_response.body
242
+ unless status_code == 200
243
+ error_model = JSON.load(response_content)
244
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
245
+ end
246
+
247
+ # Create Result
248
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
249
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
250
+ # Deserialize Response
251
+ if status_code == 200
252
+ begin
253
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
254
+ result_mapper = UsageAggregationListResult.mapper()
255
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
256
+ rescue Exception => e
257
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
258
+ end
259
+ end
260
+
261
+ result
262
+ end
263
+
264
+ promise.execute
265
+ end
266
+
267
+ end
268
+ end