azure_mgmt_consumption 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  3. data/lib/2017-11-30/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  4. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  5. data/lib/2018-01-31/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  6. data/lib/2018-01-31/generated/azure_mgmt_consumption/price_sheet.rb +28 -12
  7. data/lib/2018-03-31/generated/azure_mgmt_consumption.rb +84 -0
  8. data/lib/2018-03-31/generated/azure_mgmt_consumption/budgets.rb +993 -0
  9. data/lib/2018-03-31/generated/azure_mgmt_consumption/consumption_management_client.rb +289 -0
  10. data/lib/2018-03-31/generated/azure_mgmt_consumption/cost_tags_operations.rb +233 -0
  11. data/lib/2018-03-31/generated/azure_mgmt_consumption/get_balances_by_billing_account.rb +120 -0
  12. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces.rb +528 -0
  13. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_billing_account.rb +536 -0
  14. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_department.rb +536 -0
  15. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_enrollment_accounts.rb +536 -0
  16. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/balance.rb +281 -0
  17. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/balance_properties_adjustment_details_item.rb +60 -0
  18. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/balance_properties_new_purchases_details_item.rb +60 -0
  19. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/billing_frequency.rb +17 -0
  20. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/budget.rb +171 -0
  21. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
  22. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/budgets_list_result.rb +101 -0
  23. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/category_type.rb +16 -0
  24. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/cost_tag.rb +46 -0
  25. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/cost_tags.rb +90 -0
  26. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
  27. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
  28. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  29. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  30. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/filters.rb +134 -0
  31. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/marketplace.rb +375 -0
  32. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb +101 -0
  33. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/meter_details.rb +122 -0
  34. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/notification.rb +139 -0
  35. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  36. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  37. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  38. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
  39. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +134 -0
  40. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  41. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
  42. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/query_options.rb +45 -0
  43. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_details.rb +187 -0
  44. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +100 -0
  45. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_recommendations.rb +224 -0
  46. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_recommendations_list_result.rb +101 -0
  47. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_summaries.rb +205 -0
  48. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +101 -0
  49. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  50. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/resource_attributes.rb +59 -0
  51. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/tag.rb +46 -0
  52. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/tags.rb +90 -0
  53. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
  54. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/usage_detail.rb +355 -0
  55. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  56. data/lib/2018-03-31/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  57. data/lib/2018-03-31/generated/azure_mgmt_consumption/operations.rb +216 -0
  58. data/lib/2018-03-31/generated/azure_mgmt_consumption/price_sheet.rb +262 -0
  59. data/lib/2018-03-31/generated/azure_mgmt_consumption/reservation_recommendations_operations.rb +226 -0
  60. data/lib/2018-03-31/generated/azure_mgmt_consumption/reservations_details.rb +449 -0
  61. data/lib/2018-03-31/generated/azure_mgmt_consumption/reservations_summaries.rb +465 -0
  62. data/lib/2018-03-31/generated/azure_mgmt_consumption/tags_operations.rb +113 -0
  63. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details.rb +577 -0
  64. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details_by_billing_account.rb +599 -0
  65. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details_by_department.rb +592 -0
  66. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details_by_enrollment_account.rb +599 -0
  67. data/lib/2018-05-31/generated/azure_mgmt_consumption.rb +49 -0
  68. data/lib/2018-05-31/generated/azure_mgmt_consumption/consumption_management_client.rb +144 -0
  69. data/lib/2018-05-31/generated/azure_mgmt_consumption/forecasts.rb +122 -0
  70. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/bound.rb +16 -0
  71. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/charge_type.rb +16 -0
  72. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  73. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  74. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/forecast.rb +163 -0
  75. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/forecast_properties_confidence_levels_item.rb +72 -0
  76. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/forecasts_list_result.rb +56 -0
  77. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/grain.rb +17 -0
  78. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/meter_details.rb +122 -0
  79. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  80. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  81. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  82. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +146 -0
  83. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  84. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/query_options.rb +45 -0
  85. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  86. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/usage_detail.rb +403 -0
  87. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  88. data/lib/2018-05-31/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  89. data/lib/2018-05-31/generated/azure_mgmt_consumption/operations.rb +216 -0
  90. data/lib/2018-05-31/generated/azure_mgmt_consumption/price_sheet.rb +262 -0
  91. data/lib/2018-05-31/generated/azure_mgmt_consumption/usage_details.rb +2289 -0
  92. data/lib/2018-06-30/generated/azure_mgmt_consumption.rb +85 -0
  93. data/lib/2018-06-30/generated/azure_mgmt_consumption/balances.rb +210 -0
  94. data/lib/2018-06-30/generated/azure_mgmt_consumption/budgets.rb +993 -0
  95. data/lib/2018-06-30/generated/azure_mgmt_consumption/consumption_management_client.rb +176 -0
  96. data/lib/2018-06-30/generated/azure_mgmt_consumption/cost_tags.rb +233 -0
  97. data/lib/2018-06-30/generated/azure_mgmt_consumption/forecasts.rb +122 -0
  98. data/lib/2018-06-30/generated/azure_mgmt_consumption/marketplaces.rb +2058 -0
  99. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/balance.rb +281 -0
  100. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/balance_properties_adjustment_details_item.rb +60 -0
  101. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/balance_properties_new_purchases_details_item.rb +60 -0
  102. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/billing_frequency.rb +17 -0
  103. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/bound.rb +16 -0
  104. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/budget.rb +171 -0
  105. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
  106. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/budgets_list_result.rb +101 -0
  107. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/category_type.rb +16 -0
  108. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/charge_type.rb +16 -0
  109. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/cost_tag.rb +90 -0
  110. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/cost_tag_properties.rb +46 -0
  111. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
  112. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
  113. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  114. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  115. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/filters.rb +134 -0
  116. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/forecast.rb +163 -0
  117. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/forecast_properties_confidence_levels_item.rb +72 -0
  118. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/forecasts_list_result.rb +56 -0
  119. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/grain.rb +17 -0
  120. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/marketplace.rb +375 -0
  121. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb +101 -0
  122. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/meter_details.rb +146 -0
  123. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/notification.rb +139 -0
  124. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  125. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  126. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  127. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
  128. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +146 -0
  129. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  130. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
  131. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/query_options.rb +45 -0
  132. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_detail.rb +187 -0
  133. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +100 -0
  134. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_recommendation.rb +224 -0
  135. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_recommendations_list_result.rb +101 -0
  136. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +100 -0
  137. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_summary.rb +205 -0
  138. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  139. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/resource_attributes.rb +59 -0
  140. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/tag.rb +46 -0
  141. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/tags_result.rb +90 -0
  142. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
  143. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/usage_detail.rb +415 -0
  144. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  145. data/lib/2018-06-30/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  146. data/lib/2018-06-30/generated/azure_mgmt_consumption/operations.rb +216 -0
  147. data/lib/2018-06-30/generated/azure_mgmt_consumption/price_sheet.rb +262 -0
  148. data/lib/2018-06-30/generated/azure_mgmt_consumption/reservation_recommendations.rb +226 -0
  149. data/lib/2018-06-30/generated/azure_mgmt_consumption/reservations_details.rb +449 -0
  150. data/lib/2018-06-30/generated/azure_mgmt_consumption/reservations_summaries.rb +465 -0
  151. data/lib/2018-06-30/generated/azure_mgmt_consumption/tags.rb +113 -0
  152. data/lib/2018-06-30/generated/azure_mgmt_consumption/usage_details.rb +2289 -0
  153. data/lib/azure_mgmt_consumption.rb +4 -1
  154. data/lib/profiles/latest/modules/consumption_profile_module.rb +160 -78
  155. data/lib/version.rb +1 -1
  156. metadata +150 -4
@@ -0,0 +1,599 @@
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_03_31
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class UsageDetailsByEnrollmentAccount
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the UsageDetailsByEnrollmentAccount 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 by enrollmentAccountId for a scope by current billing
27
+ # period. Usage details are available via this API only for May 1, 2014 or
28
+ # later.
29
+ #
30
+ # @param enrollment_account_id [String] EnrollmentAccount ID
31
+ # @param expand [String] May be used to expand the
32
+ # properties/additionalProperties or properties/meterDetails within a list of
33
+ # usage details. By default, these fields are not included when listing usage
34
+ # details.
35
+ # @param filter [String] May be used to filter usageDetails by
36
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
37
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
38
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
39
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
40
+ # string where key and value is separated by a colon (:).
41
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
42
+ # returned a partial result. If a previous response contains a nextLink
43
+ # element, the value of the nextLink element will include a skiptoken parameter
44
+ # that specifies a starting point to use for subsequent calls.
45
+ # @param top [Integer] May be used to limit the number of results to the most
46
+ # recent N usageDetails.
47
+ # @param query_options [QueryOptions] Additional parameters for the operation
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(enrollment_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
54
+ first_page = list_as_lazy(enrollment_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
55
+ first_page.get_all_items
56
+ end
57
+
58
+ #
59
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
60
+ # period. Usage details are available via this API only for May 1, 2014 or
61
+ # later.
62
+ #
63
+ # @param enrollment_account_id [String] EnrollmentAccount ID
64
+ # @param expand [String] May be used to expand the
65
+ # properties/additionalProperties or properties/meterDetails within a list of
66
+ # usage details. By default, these fields are not included when listing usage
67
+ # details.
68
+ # @param filter [String] May be used to filter usageDetails by
69
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
70
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
71
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
72
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
73
+ # string where key and value is separated by a colon (:).
74
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
75
+ # returned a partial result. If a previous response contains a nextLink
76
+ # element, the value of the nextLink element will include a skiptoken parameter
77
+ # that specifies a starting point to use for subsequent calls.
78
+ # @param top [Integer] May be used to limit the number of results to the most
79
+ # recent N usageDetails.
80
+ # @param query_options [QueryOptions] Additional parameters for the operation
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(enrollment_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
87
+ list_async(enrollment_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
88
+ end
89
+
90
+ #
91
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
92
+ # period. Usage details are available via this API only for May 1, 2014 or
93
+ # later.
94
+ #
95
+ # @param enrollment_account_id [String] EnrollmentAccount ID
96
+ # @param expand [String] May be used to expand the
97
+ # properties/additionalProperties or properties/meterDetails within a list of
98
+ # usage details. By default, these fields are not included when listing usage
99
+ # details.
100
+ # @param filter [String] May be used to filter usageDetails by
101
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
102
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
103
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
104
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
105
+ # string where key and value is separated by a colon (:).
106
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
107
+ # returned a partial result. If a previous response contains a nextLink
108
+ # element, the value of the nextLink element will include a skiptoken parameter
109
+ # that specifies a starting point to use for subsequent calls.
110
+ # @param top [Integer] May be used to limit the number of results to the most
111
+ # recent N usageDetails.
112
+ # @param query_options [QueryOptions] Additional parameters for the operation
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(enrollment_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
119
+ fail ArgumentError, 'enrollment_account_id is nil' if enrollment_account_id.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
+ apply = nil
125
+ unless query_options.nil?
126
+ apply = query_options.Apply
127
+ end
128
+
129
+ request_headers = {}
130
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
131
+
132
+ # Set Headers
133
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
134
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
135
+ path_template = 'providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/usageDetails'
136
+
137
+ request_url = @base_url || @client.base_url
138
+
139
+ options = {
140
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
141
+ path_params: {'enrollmentAccountId' => enrollment_account_id},
142
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
143
+ headers: request_headers.merge(custom_headers || {}),
144
+ base_url: request_url
145
+ }
146
+ promise = @client.make_request_async(:get, path_template, options)
147
+
148
+ promise = promise.then do |result|
149
+ http_response = result.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(result.request, http_response, error_model)
155
+ end
156
+
157
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
158
+ # Deserialize Response
159
+ if status_code == 200
160
+ begin
161
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
162
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::UsageDetailsListResult.mapper()
163
+ result.body = @client.deserialize(result_mapper, parsed_response)
164
+ rescue Exception => e
165
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
166
+ end
167
+ end
168
+
169
+ result
170
+ end
171
+
172
+ promise.execute
173
+ end
174
+
175
+ #
176
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
177
+ # period. Usage details are available via this API only for May 1, 2014 or
178
+ # later.
179
+ #
180
+ # @param enrollment_account_id [String] EnrollmentAccount ID
181
+ # @param billing_period_name [String] Billing Period Name.
182
+ # @param expand [String] May be used to expand the
183
+ # properties/additionalProperties or properties/meterDetails within a list of
184
+ # usage details. By default, these fields are not included when listing usage
185
+ # details.
186
+ # @param filter [String] May be used to filter usageDetails by
187
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
188
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
189
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
190
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
191
+ # where key and value is separated by a colon (:).
192
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
193
+ # returned a partial result. If a previous response contains a nextLink
194
+ # element, the value of the nextLink element will include a skiptoken parameter
195
+ # that specifies a starting point to use for subsequent calls.
196
+ # @param top [Integer] May be used to limit the number of results to the most
197
+ # recent N usageDetails.
198
+ # @param query_options [QueryOptions] Additional parameters for the operation
199
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
200
+ # will be added to the HTTP request.
201
+ #
202
+ # @return [Array<UsageDetail>] operation results.
203
+ #
204
+ def list_by_billing_period(enrollment_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
205
+ first_page = list_by_billing_period_as_lazy(enrollment_account_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
206
+ first_page.get_all_items
207
+ end
208
+
209
+ #
210
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
211
+ # period. Usage details are available via this API only for May 1, 2014 or
212
+ # later.
213
+ #
214
+ # @param enrollment_account_id [String] EnrollmentAccount ID
215
+ # @param billing_period_name [String] Billing Period Name.
216
+ # @param expand [String] May be used to expand the
217
+ # properties/additionalProperties or properties/meterDetails within a list of
218
+ # usage details. By default, these fields are not included when listing usage
219
+ # details.
220
+ # @param filter [String] May be used to filter usageDetails by
221
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
222
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
223
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
224
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
225
+ # where key and value is separated by a colon (:).
226
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
227
+ # returned a partial result. If a previous response contains a nextLink
228
+ # element, the value of the nextLink element will include a skiptoken parameter
229
+ # that specifies a starting point to use for subsequent calls.
230
+ # @param top [Integer] May be used to limit the number of results to the most
231
+ # recent N usageDetails.
232
+ # @param query_options [QueryOptions] Additional parameters for the operation
233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
234
+ # will be added to the HTTP request.
235
+ #
236
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
237
+ #
238
+ def list_by_billing_period_with_http_info(enrollment_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
239
+ list_by_billing_period_async(enrollment_account_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
240
+ end
241
+
242
+ #
243
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
244
+ # period. Usage details are available via this API only for May 1, 2014 or
245
+ # later.
246
+ #
247
+ # @param enrollment_account_id [String] EnrollmentAccount ID
248
+ # @param billing_period_name [String] Billing Period Name.
249
+ # @param expand [String] May be used to expand the
250
+ # properties/additionalProperties or properties/meterDetails within a list of
251
+ # usage details. By default, these fields are not included when listing usage
252
+ # details.
253
+ # @param filter [String] May be used to filter usageDetails by
254
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
255
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
256
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
257
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
258
+ # where key and value is separated by a colon (:).
259
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
260
+ # returned a partial result. If a previous response contains a nextLink
261
+ # element, the value of the nextLink element will include a skiptoken parameter
262
+ # that specifies a starting point to use for subsequent calls.
263
+ # @param top [Integer] May be used to limit the number of results to the most
264
+ # recent N usageDetails.
265
+ # @param query_options [QueryOptions] Additional parameters for the operation
266
+ # @param [Hash{String => String}] A hash of custom headers that will be added
267
+ # to the HTTP request.
268
+ #
269
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
270
+ #
271
+ def list_by_billing_period_async(enrollment_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
272
+ fail ArgumentError, 'enrollment_account_id is nil' if enrollment_account_id.nil?
273
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
274
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
275
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
276
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
277
+
278
+ apply = nil
279
+ unless query_options.nil?
280
+ apply = query_options.Apply
281
+ end
282
+
283
+ request_headers = {}
284
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
285
+
286
+ # Set Headers
287
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
288
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
289
+ path_template = 'providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'
290
+
291
+ request_url = @base_url || @client.base_url
292
+
293
+ options = {
294
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
295
+ path_params: {'enrollmentAccountId' => enrollment_account_id,'billingPeriodName' => billing_period_name},
296
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
297
+ headers: request_headers.merge(custom_headers || {}),
298
+ base_url: request_url
299
+ }
300
+ promise = @client.make_request_async(:get, path_template, options)
301
+
302
+ promise = promise.then do |result|
303
+ http_response = result.response
304
+ status_code = http_response.status
305
+ response_content = http_response.body
306
+ unless status_code == 200
307
+ error_model = JSON.load(response_content)
308
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
309
+ end
310
+
311
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
312
+ # Deserialize Response
313
+ if status_code == 200
314
+ begin
315
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
316
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::UsageDetailsListResult.mapper()
317
+ result.body = @client.deserialize(result_mapper, parsed_response)
318
+ rescue Exception => e
319
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
320
+ end
321
+ end
322
+
323
+ result
324
+ end
325
+
326
+ promise.execute
327
+ end
328
+
329
+ #
330
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
331
+ # period. Usage details are available via this API only for May 1, 2014 or
332
+ # later.
333
+ #
334
+ # @param next_page_link [String] The NextLink from the previous successful call
335
+ # to List operation.
336
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
337
+ # will be added to the HTTP request.
338
+ #
339
+ # @return [UsageDetailsListResult] operation results.
340
+ #
341
+ def list_next(next_page_link, custom_headers:nil)
342
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
343
+ response.body unless response.nil?
344
+ end
345
+
346
+ #
347
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
348
+ # period. Usage details are available via this API only for May 1, 2014 or
349
+ # later.
350
+ #
351
+ # @param next_page_link [String] The NextLink from the previous successful call
352
+ # to List operation.
353
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
354
+ # will be added to the HTTP request.
355
+ #
356
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
357
+ #
358
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
359
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
360
+ end
361
+
362
+ #
363
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
364
+ # period. Usage details are available via this API only for May 1, 2014 or
365
+ # later.
366
+ #
367
+ # @param next_page_link [String] The NextLink from the previous successful call
368
+ # to List operation.
369
+ # @param [Hash{String => String}] A hash of custom headers that will be added
370
+ # to the HTTP request.
371
+ #
372
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
373
+ #
374
+ def list_next_async(next_page_link, custom_headers:nil)
375
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
376
+
377
+
378
+ request_headers = {}
379
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
380
+
381
+ # Set Headers
382
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
383
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
384
+ path_template = '{nextLink}'
385
+
386
+ request_url = @base_url || @client.base_url
387
+
388
+ options = {
389
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
390
+ skip_encoding_path_params: {'nextLink' => next_page_link},
391
+ headers: request_headers.merge(custom_headers || {}),
392
+ base_url: request_url
393
+ }
394
+ promise = @client.make_request_async(:get, path_template, options)
395
+
396
+ promise = promise.then do |result|
397
+ http_response = result.response
398
+ status_code = http_response.status
399
+ response_content = http_response.body
400
+ unless status_code == 200
401
+ error_model = JSON.load(response_content)
402
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
403
+ end
404
+
405
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
406
+ # Deserialize Response
407
+ if status_code == 200
408
+ begin
409
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
410
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::UsageDetailsListResult.mapper()
411
+ result.body = @client.deserialize(result_mapper, parsed_response)
412
+ rescue Exception => e
413
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
414
+ end
415
+ end
416
+
417
+ result
418
+ end
419
+
420
+ promise.execute
421
+ end
422
+
423
+ #
424
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
425
+ # period. Usage details are available via this API only for May 1, 2014 or
426
+ # later.
427
+ #
428
+ # @param next_page_link [String] The NextLink from the previous successful call
429
+ # to List operation.
430
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
431
+ # will be added to the HTTP request.
432
+ #
433
+ # @return [UsageDetailsListResult] operation results.
434
+ #
435
+ def list_by_billing_period_next(next_page_link, custom_headers:nil)
436
+ response = list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
437
+ response.body unless response.nil?
438
+ end
439
+
440
+ #
441
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
442
+ # period. Usage details are available via this API only for May 1, 2014 or
443
+ # later.
444
+ #
445
+ # @param next_page_link [String] The NextLink from the previous successful call
446
+ # to List operation.
447
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
448
+ # will be added to the HTTP request.
449
+ #
450
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
451
+ #
452
+ def list_by_billing_period_next_with_http_info(next_page_link, custom_headers:nil)
453
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
454
+ end
455
+
456
+ #
457
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
458
+ # period. Usage details are available via this API only for May 1, 2014 or
459
+ # later.
460
+ #
461
+ # @param next_page_link [String] The NextLink from the previous successful call
462
+ # to List operation.
463
+ # @param [Hash{String => String}] A hash of custom headers that will be added
464
+ # to the HTTP request.
465
+ #
466
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
467
+ #
468
+ def list_by_billing_period_next_async(next_page_link, custom_headers:nil)
469
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
470
+
471
+
472
+ request_headers = {}
473
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
474
+
475
+ # Set Headers
476
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
477
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
478
+ path_template = '{nextLink}'
479
+
480
+ request_url = @base_url || @client.base_url
481
+
482
+ options = {
483
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
484
+ skip_encoding_path_params: {'nextLink' => next_page_link},
485
+ headers: request_headers.merge(custom_headers || {}),
486
+ base_url: request_url
487
+ }
488
+ promise = @client.make_request_async(:get, path_template, options)
489
+
490
+ promise = promise.then do |result|
491
+ http_response = result.response
492
+ status_code = http_response.status
493
+ response_content = http_response.body
494
+ unless status_code == 200
495
+ error_model = JSON.load(response_content)
496
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
497
+ end
498
+
499
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
500
+ # Deserialize Response
501
+ if status_code == 200
502
+ begin
503
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
504
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::UsageDetailsListResult.mapper()
505
+ result.body = @client.deserialize(result_mapper, parsed_response)
506
+ rescue Exception => e
507
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
508
+ end
509
+ end
510
+
511
+ result
512
+ end
513
+
514
+ promise.execute
515
+ end
516
+
517
+ #
518
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
519
+ # period. Usage details are available via this API only for May 1, 2014 or
520
+ # later.
521
+ #
522
+ # @param enrollment_account_id [String] EnrollmentAccount ID
523
+ # @param expand [String] May be used to expand the
524
+ # properties/additionalProperties or properties/meterDetails within a list of
525
+ # usage details. By default, these fields are not included when listing usage
526
+ # details.
527
+ # @param filter [String] May be used to filter usageDetails by
528
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
529
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
530
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
531
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
532
+ # string where key and value is separated by a colon (:).
533
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
534
+ # returned a partial result. If a previous response contains a nextLink
535
+ # element, the value of the nextLink element will include a skiptoken parameter
536
+ # that specifies a starting point to use for subsequent calls.
537
+ # @param top [Integer] May be used to limit the number of results to the most
538
+ # recent N usageDetails.
539
+ # @param query_options [QueryOptions] Additional parameters for the operation
540
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
541
+ # will be added to the HTTP request.
542
+ #
543
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
544
+ # response.
545
+ #
546
+ def list_as_lazy(enrollment_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
547
+ response = list_async(enrollment_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
548
+ unless response.nil?
549
+ page = response.body
550
+ page.next_method = Proc.new do |next_page_link|
551
+ list_next_async(next_page_link, custom_headers:custom_headers)
552
+ end
553
+ page
554
+ end
555
+ end
556
+
557
+ #
558
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
559
+ # period. Usage details are available via this API only for May 1, 2014 or
560
+ # later.
561
+ #
562
+ # @param enrollment_account_id [String] EnrollmentAccount ID
563
+ # @param billing_period_name [String] Billing Period Name.
564
+ # @param expand [String] May be used to expand the
565
+ # properties/additionalProperties or properties/meterDetails within a list of
566
+ # usage details. By default, these fields are not included when listing usage
567
+ # details.
568
+ # @param filter [String] May be used to filter usageDetails by
569
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
570
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
571
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
572
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
573
+ # where key and value is separated by a colon (:).
574
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
575
+ # returned a partial result. If a previous response contains a nextLink
576
+ # element, the value of the nextLink element will include a skiptoken parameter
577
+ # that specifies a starting point to use for subsequent calls.
578
+ # @param top [Integer] May be used to limit the number of results to the most
579
+ # recent N usageDetails.
580
+ # @param query_options [QueryOptions] Additional parameters for the operation
581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
582
+ # will be added to the HTTP request.
583
+ #
584
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
585
+ # response.
586
+ #
587
+ def list_by_billing_period_as_lazy(enrollment_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
588
+ response = list_by_billing_period_async(enrollment_account_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
589
+ unless response.nil?
590
+ page = response.body
591
+ page.next_method = Proc.new do |next_page_link|
592
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers)
593
+ end
594
+ page
595
+ end
596
+ end
597
+
598
+ end
599
+ end