azure_mgmt_consumption 0.15.1 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +1 -3
  3. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/models/error_details.rb +4 -0
  4. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/models/error_response.rb +2 -0
  5. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/models/meter_details.rb +8 -0
  6. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/models/operation.rb +3 -0
  7. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/models/operation_display.rb +4 -0
  8. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/models/operation_list_result.rb +4 -0
  9. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/models/resource.rb +6 -0
  10. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/models/usage_detail.rb +22 -0
  11. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +4 -0
  12. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/usage_details.rb +2 -0
  13. data/lib/2017-11-30/generated/azure_mgmt_consumption.rb +38 -0
  14. data/lib/2017-11-30/generated/azure_mgmt_consumption/consumption_management_client.rb +132 -0
  15. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  16. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  17. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/meter_details.rb +122 -0
  18. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  19. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  20. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  21. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  22. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/usage_detail.rb +355 -0
  23. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  24. data/lib/{2017-04-24-preview/generated/azure_mgmt_consumption/version.rb → 2017-11-30/generated/azure_mgmt_consumption/module_definition.rb} +4 -3
  25. data/lib/2017-11-30/generated/azure_mgmt_consumption/operations.rb +214 -0
  26. data/lib/2017-11-30/generated/azure_mgmt_consumption/usage_details.rb +301 -0
  27. data/lib/azure_mgmt_consumption.rb +1 -0
  28. data/lib/profiles/latest/consumption_latest_profile_client.rb +1 -3
  29. data/lib/profiles/latest/modules/consumption_profile_module.rb +21 -21
  30. data/lib/version.rb +1 -1
  31. metadata +24 -8
  32. data/lib/profiles/common/configurable.rb +0 -86
  33. data/lib/profiles/common/default.rb +0 -57
@@ -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::V2017_11_30
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
@@ -3,6 +3,7 @@
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
- module Azure::Consumption::Mgmt::V2017_04_24_preview
7
- VERSION = '0.15.1'
8
- end
6
+ module Azure end
7
+ module Azure::Consumption end
8
+ module Azure::Consumption::Mgmt end
9
+ module Azure::Consumption::Mgmt::V2017_11_30 end
@@ -0,0 +1,214 @@
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::V2017_11_30
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)
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).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
+
64
+ # Set Headers
65
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
+ path_template = 'providers/Microsoft.Consumption/operations'
68
+
69
+ request_url = @base_url || @client.base_url
70
+
71
+ options = {
72
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
73
+ query_params: {'api-version' => @client.api_version},
74
+ headers: request_headers.merge(custom_headers || {}),
75
+ base_url: request_url
76
+ }
77
+ promise = @client.make_request_async(:get, path_template, options)
78
+
79
+ promise = promise.then do |result|
80
+ http_response = result.response
81
+ status_code = http_response.status
82
+ response_content = http_response.body
83
+ unless status_code == 200
84
+ error_model = JSON.load(response_content)
85
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
+ end
87
+
88
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
+ # Deserialize Response
90
+ if status_code == 200
91
+ begin
92
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
93
+ result_mapper = Azure::Consumption::Mgmt::V2017_11_30::Models::OperationListResult.mapper()
94
+ result.body = @client.deserialize(result_mapper, parsed_response)
95
+ rescue Exception => e
96
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
97
+ end
98
+ end
99
+
100
+ result
101
+ end
102
+
103
+ promise.execute
104
+ end
105
+
106
+ #
107
+ # Lists all of the available consumption REST API operations.
108
+ #
109
+ # @param next_page_link [String] The NextLink from the previous successful call
110
+ # to List operation.
111
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
112
+ # will be added to the HTTP request.
113
+ #
114
+ # @return [OperationListResult] operation results.
115
+ #
116
+ def list_next(next_page_link, custom_headers = nil)
117
+ response = list_next_async(next_page_link, custom_headers).value!
118
+ response.body unless response.nil?
119
+ end
120
+
121
+ #
122
+ # Lists all of the available consumption REST API operations.
123
+ #
124
+ # @param next_page_link [String] The NextLink from the previous successful call
125
+ # to List operation.
126
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
127
+ # will be added to the HTTP request.
128
+ #
129
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
130
+ #
131
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
132
+ list_next_async(next_page_link, custom_headers).value!
133
+ end
134
+
135
+ #
136
+ # Lists all of the available consumption REST API operations.
137
+ #
138
+ # @param next_page_link [String] The NextLink from the previous successful call
139
+ # to List operation.
140
+ # @param [Hash{String => String}] A hash of custom headers that will be added
141
+ # to the HTTP request.
142
+ #
143
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
144
+ #
145
+ def list_next_async(next_page_link, custom_headers = nil)
146
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
147
+
148
+
149
+ request_headers = {}
150
+
151
+ # Set Headers
152
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
153
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
154
+ path_template = '{nextLink}'
155
+
156
+ request_url = @base_url || @client.base_url
157
+
158
+ options = {
159
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
160
+ skip_encoding_path_params: {'nextLink' => next_page_link},
161
+ headers: request_headers.merge(custom_headers || {}),
162
+ base_url: request_url
163
+ }
164
+ promise = @client.make_request_async(:get, path_template, options)
165
+
166
+ promise = promise.then do |result|
167
+ http_response = result.response
168
+ status_code = http_response.status
169
+ response_content = http_response.body
170
+ unless status_code == 200
171
+ error_model = JSON.load(response_content)
172
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
173
+ end
174
+
175
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
176
+ # Deserialize Response
177
+ if status_code == 200
178
+ begin
179
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
180
+ result_mapper = Azure::Consumption::Mgmt::V2017_11_30::Models::OperationListResult.mapper()
181
+ result.body = @client.deserialize(result_mapper, parsed_response)
182
+ rescue Exception => e
183
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
184
+ end
185
+ end
186
+
187
+ result
188
+ end
189
+
190
+ promise.execute
191
+ end
192
+
193
+ #
194
+ # Lists all of the available consumption REST API operations.
195
+ #
196
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
197
+ # will be added to the HTTP request.
198
+ #
199
+ # @return [OperationListResult] which provide lazy access to pages of the
200
+ # response.
201
+ #
202
+ def list_as_lazy(custom_headers = nil)
203
+ response = list_async(custom_headers).value!
204
+ unless response.nil?
205
+ page = response.body
206
+ page.next_method = Proc.new do |next_page_link|
207
+ list_next_async(next_page_link, custom_headers)
208
+ end
209
+ page
210
+ end
211
+ end
212
+
213
+ end
214
+ end
@@ -0,0 +1,301 @@
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::V2017_11_30
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class UsageDetails
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the UsageDetails 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 the usage details for a scope by billing period. Usage details are
27
+ # available via this API only for May 1, 2014 or later.
28
+ #
29
+ # @param scope [String] The scope of the usage details. The scope can be
30
+ # '/subscriptions/{subscriptionId}' for a subscription, or
31
+ # '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
32
+ # for a billing perdiod.
33
+ # @param expand [String] May be used to expand the
34
+ # properties/additionalProperties or properties/meterDetails within a list of
35
+ # usage details. By default, these fields are not included when listing usage
36
+ # details.
37
+ # @param filter [String] May be used to filter usageDetails by
38
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
39
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
40
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
41
+ # currently support 'ne', 'or', or 'not'.
42
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
43
+ # returned a partial result. If a previous response contains a nextLink
44
+ # element, the value of the nextLink element will include a skiptoken parameter
45
+ # that specifies a starting point to use for subsequent calls.
46
+ # @param top [Integer] May be used to limit the number of results to the most
47
+ # recent N usageDetails.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [Array<UsageDetail>] operation results.
52
+ #
53
+ def list(scope, expand = nil, filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
54
+ first_page = list_as_lazy(scope, expand, filter, skiptoken, top, custom_headers)
55
+ first_page.get_all_items
56
+ end
57
+
58
+ #
59
+ # Lists the usage details for a scope by billing period. Usage details are
60
+ # available via this API only for May 1, 2014 or later.
61
+ #
62
+ # @param scope [String] The scope of the usage details. The scope can be
63
+ # '/subscriptions/{subscriptionId}' for a subscription, or
64
+ # '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
65
+ # for a billing perdiod.
66
+ # @param expand [String] May be used to expand the
67
+ # properties/additionalProperties or properties/meterDetails within a list of
68
+ # usage details. By default, these fields are not included when listing usage
69
+ # details.
70
+ # @param filter [String] May be used to filter usageDetails by
71
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
72
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
73
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
74
+ # currently support 'ne', 'or', or 'not'.
75
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
76
+ # returned a partial result. If a previous response contains a nextLink
77
+ # element, the value of the nextLink element will include a skiptoken parameter
78
+ # that specifies a starting point to use for subsequent calls.
79
+ # @param top [Integer] May be used to limit the number of results to the most
80
+ # recent N usageDetails.
81
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
82
+ # will be added to the HTTP request.
83
+ #
84
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
85
+ #
86
+ def list_with_http_info(scope, expand = nil, filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
87
+ list_async(scope, expand, filter, skiptoken, top, custom_headers).value!
88
+ end
89
+
90
+ #
91
+ # Lists the usage details for a scope by billing period. Usage details are
92
+ # available via this API only for May 1, 2014 or later.
93
+ #
94
+ # @param scope [String] The scope of the usage details. The scope can be
95
+ # '/subscriptions/{subscriptionId}' for a subscription, or
96
+ # '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
97
+ # for a billing perdiod.
98
+ # @param expand [String] May be used to expand the
99
+ # properties/additionalProperties or properties/meterDetails within a list of
100
+ # usage details. By default, these fields are not included when listing usage
101
+ # details.
102
+ # @param filter [String] May be used to filter usageDetails by
103
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
104
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
105
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
106
+ # currently support 'ne', 'or', or 'not'.
107
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
108
+ # returned a partial result. If a previous response contains a nextLink
109
+ # element, the value of the nextLink element will include a skiptoken parameter
110
+ # that specifies a starting point to use for subsequent calls.
111
+ # @param top [Integer] May be used to limit the number of results to the most
112
+ # recent N usageDetails.
113
+ # @param [Hash{String => String}] A hash of custom headers that will be added
114
+ # to the HTTP request.
115
+ #
116
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
117
+ #
118
+ def list_async(scope, expand = nil, filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
119
+ fail ArgumentError, 'scope is nil' if scope.nil?
120
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
121
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
122
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
123
+
124
+
125
+ request_headers = {}
126
+
127
+ # Set Headers
128
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
129
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
130
+ path_template = '{scope}/providers/Microsoft.Consumption/usageDetails'
131
+
132
+ request_url = @base_url || @client.base_url
133
+
134
+ options = {
135
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
136
+ skip_encoding_path_params: {'scope' => scope},
137
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version},
138
+ headers: request_headers.merge(custom_headers || {}),
139
+ base_url: request_url
140
+ }
141
+ promise = @client.make_request_async(:get, path_template, options)
142
+
143
+ promise = promise.then do |result|
144
+ http_response = result.response
145
+ status_code = http_response.status
146
+ response_content = http_response.body
147
+ unless status_code == 200
148
+ error_model = JSON.load(response_content)
149
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
150
+ end
151
+
152
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
153
+ # Deserialize Response
154
+ if status_code == 200
155
+ begin
156
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
157
+ result_mapper = Azure::Consumption::Mgmt::V2017_11_30::Models::UsageDetailsListResult.mapper()
158
+ result.body = @client.deserialize(result_mapper, parsed_response)
159
+ rescue Exception => e
160
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
161
+ end
162
+ end
163
+
164
+ result
165
+ end
166
+
167
+ promise.execute
168
+ end
169
+
170
+ #
171
+ # Lists the usage details for a scope by billing period. Usage details are
172
+ # available via this API only for May 1, 2014 or later.
173
+ #
174
+ # @param next_page_link [String] The NextLink from the previous successful call
175
+ # to List operation.
176
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
177
+ # will be added to the HTTP request.
178
+ #
179
+ # @return [UsageDetailsListResult] operation results.
180
+ #
181
+ def list_next(next_page_link, custom_headers = nil)
182
+ response = list_next_async(next_page_link, custom_headers).value!
183
+ response.body unless response.nil?
184
+ end
185
+
186
+ #
187
+ # Lists the usage details for a scope by billing period. Usage details are
188
+ # available via this API only for May 1, 2014 or later.
189
+ #
190
+ # @param next_page_link [String] The NextLink from the previous successful call
191
+ # to List operation.
192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
193
+ # will be added to the HTTP request.
194
+ #
195
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
196
+ #
197
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
198
+ list_next_async(next_page_link, custom_headers).value!
199
+ end
200
+
201
+ #
202
+ # Lists the usage details for a scope by billing period. Usage details are
203
+ # available via this API only for May 1, 2014 or later.
204
+ #
205
+ # @param next_page_link [String] The NextLink from the previous successful call
206
+ # to List operation.
207
+ # @param [Hash{String => String}] A hash of custom headers that will be added
208
+ # to the HTTP request.
209
+ #
210
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
211
+ #
212
+ def list_next_async(next_page_link, custom_headers = nil)
213
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
214
+
215
+
216
+ request_headers = {}
217
+
218
+ # Set Headers
219
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
220
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
221
+ path_template = '{nextLink}'
222
+
223
+ request_url = @base_url || @client.base_url
224
+
225
+ options = {
226
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
227
+ skip_encoding_path_params: {'nextLink' => next_page_link},
228
+ headers: request_headers.merge(custom_headers || {}),
229
+ base_url: request_url
230
+ }
231
+ promise = @client.make_request_async(:get, path_template, options)
232
+
233
+ promise = promise.then do |result|
234
+ http_response = result.response
235
+ status_code = http_response.status
236
+ response_content = http_response.body
237
+ unless status_code == 200
238
+ error_model = JSON.load(response_content)
239
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
240
+ end
241
+
242
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
243
+ # Deserialize Response
244
+ if status_code == 200
245
+ begin
246
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
247
+ result_mapper = Azure::Consumption::Mgmt::V2017_11_30::Models::UsageDetailsListResult.mapper()
248
+ result.body = @client.deserialize(result_mapper, parsed_response)
249
+ rescue Exception => e
250
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
251
+ end
252
+ end
253
+
254
+ result
255
+ end
256
+
257
+ promise.execute
258
+ end
259
+
260
+ #
261
+ # Lists the usage details for a scope by billing period. Usage details are
262
+ # available via this API only for May 1, 2014 or later.
263
+ #
264
+ # @param scope [String] The scope of the usage details. The scope can be
265
+ # '/subscriptions/{subscriptionId}' for a subscription, or
266
+ # '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
267
+ # for a billing perdiod.
268
+ # @param expand [String] May be used to expand the
269
+ # properties/additionalProperties or properties/meterDetails within a list of
270
+ # usage details. By default, these fields are not included when listing usage
271
+ # details.
272
+ # @param filter [String] May be used to filter usageDetails by
273
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
274
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
275
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
276
+ # currently support 'ne', 'or', or 'not'.
277
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
278
+ # returned a partial result. If a previous response contains a nextLink
279
+ # element, the value of the nextLink element will include a skiptoken parameter
280
+ # that specifies a starting point to use for subsequent calls.
281
+ # @param top [Integer] May be used to limit the number of results to the most
282
+ # recent N usageDetails.
283
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
284
+ # will be added to the HTTP request.
285
+ #
286
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
287
+ # response.
288
+ #
289
+ def list_as_lazy(scope, expand = nil, filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
290
+ response = list_async(scope, expand, filter, skiptoken, top, custom_headers).value!
291
+ unless response.nil?
292
+ page = response.body
293
+ page.next_method = Proc.new do |next_page_link|
294
+ list_next_async(next_page_link, custom_headers)
295
+ end
296
+ page
297
+ end
298
+ end
299
+
300
+ end
301
+ end