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,592 @@
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 UsageDetailsByDepartment
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the UsageDetailsByDepartment 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 departmentId 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 department_id [String] Department 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(department_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
54
+ first_page = list_as_lazy(department_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 departmentId 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 department_id [String] Department 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(department_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
87
+ list_async(department_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 departmentId 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 department_id [String] Department 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(department_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
119
+ fail ArgumentError, 'department_id is nil' if department_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/departments/{departmentId}/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: {'departmentId' => department_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 departmentId for a scope by billing period.
177
+ # Usage details are available via this API only for May 1, 2014 or later.
178
+ #
179
+ # @param department_id [String] Department ID
180
+ # @param billing_period_name [String] Billing Period Name.
181
+ # @param expand [String] May be used to expand the
182
+ # properties/additionalProperties or properties/meterDetails within a list of
183
+ # usage details. By default, these fields are not included when listing usage
184
+ # details.
185
+ # @param filter [String] May be used to filter usageDetails by
186
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
187
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
188
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
189
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
190
+ # where key and value is separated by a colon (:).
191
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
192
+ # returned a partial result. If a previous response contains a nextLink
193
+ # element, the value of the nextLink element will include a skiptoken parameter
194
+ # that specifies a starting point to use for subsequent calls.
195
+ # @param top [Integer] May be used to limit the number of results to the most
196
+ # recent N usageDetails.
197
+ # @param query_options [QueryOptions] Additional parameters for the operation
198
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
199
+ # will be added to the HTTP request.
200
+ #
201
+ # @return [Array<UsageDetail>] operation results.
202
+ #
203
+ def list_by_billing_period(department_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
204
+ first_page = list_by_billing_period_as_lazy(department_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
205
+ first_page.get_all_items
206
+ end
207
+
208
+ #
209
+ # Lists the usage details based on departmentId for a scope by billing period.
210
+ # Usage details are available via this API only for May 1, 2014 or later.
211
+ #
212
+ # @param department_id [String] Department ID
213
+ # @param billing_period_name [String] Billing Period Name.
214
+ # @param expand [String] May be used to expand the
215
+ # properties/additionalProperties or properties/meterDetails within a list of
216
+ # usage details. By default, these fields are not included when listing usage
217
+ # details.
218
+ # @param filter [String] May be used to filter usageDetails by
219
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
220
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
221
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
222
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
223
+ # where key and value is separated by a colon (:).
224
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
225
+ # returned a partial result. If a previous response contains a nextLink
226
+ # element, the value of the nextLink element will include a skiptoken parameter
227
+ # that specifies a starting point to use for subsequent calls.
228
+ # @param top [Integer] May be used to limit the number of results to the most
229
+ # recent N usageDetails.
230
+ # @param query_options [QueryOptions] Additional parameters for the operation
231
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
232
+ # will be added to the HTTP request.
233
+ #
234
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
235
+ #
236
+ def list_by_billing_period_with_http_info(department_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
237
+ list_by_billing_period_async(department_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
238
+ end
239
+
240
+ #
241
+ # Lists the usage details based on departmentId for a scope by billing period.
242
+ # Usage details are available via this API only for May 1, 2014 or later.
243
+ #
244
+ # @param department_id [String] Department ID
245
+ # @param billing_period_name [String] Billing Period Name.
246
+ # @param expand [String] May be used to expand the
247
+ # properties/additionalProperties or properties/meterDetails within a list of
248
+ # usage details. By default, these fields are not included when listing usage
249
+ # details.
250
+ # @param filter [String] May be used to filter usageDetails by
251
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
252
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
253
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
254
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
255
+ # where key and value is separated by a colon (:).
256
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
257
+ # returned a partial result. If a previous response contains a nextLink
258
+ # element, the value of the nextLink element will include a skiptoken parameter
259
+ # that specifies a starting point to use for subsequent calls.
260
+ # @param top [Integer] May be used to limit the number of results to the most
261
+ # recent N usageDetails.
262
+ # @param query_options [QueryOptions] Additional parameters for the operation
263
+ # @param [Hash{String => String}] A hash of custom headers that will be added
264
+ # to the HTTP request.
265
+ #
266
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
267
+ #
268
+ def list_by_billing_period_async(department_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
269
+ fail ArgumentError, 'department_id is nil' if department_id.nil?
270
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
271
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
272
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
273
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
274
+
275
+ apply = nil
276
+ unless query_options.nil?
277
+ apply = query_options.Apply
278
+ end
279
+
280
+ request_headers = {}
281
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
282
+
283
+ # Set Headers
284
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
285
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
286
+ path_template = 'providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'
287
+
288
+ request_url = @base_url || @client.base_url
289
+
290
+ options = {
291
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
292
+ path_params: {'departmentId' => department_id,'billingPeriodName' => billing_period_name},
293
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
294
+ headers: request_headers.merge(custom_headers || {}),
295
+ base_url: request_url
296
+ }
297
+ promise = @client.make_request_async(:get, path_template, options)
298
+
299
+ promise = promise.then do |result|
300
+ http_response = result.response
301
+ status_code = http_response.status
302
+ response_content = http_response.body
303
+ unless status_code == 200
304
+ error_model = JSON.load(response_content)
305
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
306
+ end
307
+
308
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
309
+ # Deserialize Response
310
+ if status_code == 200
311
+ begin
312
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
313
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::UsageDetailsListResult.mapper()
314
+ result.body = @client.deserialize(result_mapper, parsed_response)
315
+ rescue Exception => e
316
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
317
+ end
318
+ end
319
+
320
+ result
321
+ end
322
+
323
+ promise.execute
324
+ end
325
+
326
+ #
327
+ # Lists the usage details by departmentId for a scope by current billing
328
+ # period. Usage details are available via this API only for May 1, 2014 or
329
+ # later.
330
+ #
331
+ # @param next_page_link [String] The NextLink from the previous successful call
332
+ # to List operation.
333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
334
+ # will be added to the HTTP request.
335
+ #
336
+ # @return [UsageDetailsListResult] operation results.
337
+ #
338
+ def list_next(next_page_link, custom_headers:nil)
339
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
340
+ response.body unless response.nil?
341
+ end
342
+
343
+ #
344
+ # Lists the usage details by departmentId for a scope by current billing
345
+ # period. Usage details are available via this API only for May 1, 2014 or
346
+ # later.
347
+ #
348
+ # @param next_page_link [String] The NextLink from the previous successful call
349
+ # to List operation.
350
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
351
+ # will be added to the HTTP request.
352
+ #
353
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
354
+ #
355
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
356
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
357
+ end
358
+
359
+ #
360
+ # Lists the usage details by departmentId for a scope by current billing
361
+ # period. Usage details are available via this API only for May 1, 2014 or
362
+ # later.
363
+ #
364
+ # @param next_page_link [String] The NextLink from the previous successful call
365
+ # to List operation.
366
+ # @param [Hash{String => String}] A hash of custom headers that will be added
367
+ # to the HTTP request.
368
+ #
369
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
370
+ #
371
+ def list_next_async(next_page_link, custom_headers:nil)
372
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
373
+
374
+
375
+ request_headers = {}
376
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
377
+
378
+ # Set Headers
379
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
380
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
381
+ path_template = '{nextLink}'
382
+
383
+ request_url = @base_url || @client.base_url
384
+
385
+ options = {
386
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
387
+ skip_encoding_path_params: {'nextLink' => next_page_link},
388
+ headers: request_headers.merge(custom_headers || {}),
389
+ base_url: request_url
390
+ }
391
+ promise = @client.make_request_async(:get, path_template, options)
392
+
393
+ promise = promise.then do |result|
394
+ http_response = result.response
395
+ status_code = http_response.status
396
+ response_content = http_response.body
397
+ unless status_code == 200
398
+ error_model = JSON.load(response_content)
399
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
400
+ end
401
+
402
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
403
+ # Deserialize Response
404
+ if status_code == 200
405
+ begin
406
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
407
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::UsageDetailsListResult.mapper()
408
+ result.body = @client.deserialize(result_mapper, parsed_response)
409
+ rescue Exception => e
410
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
411
+ end
412
+ end
413
+
414
+ result
415
+ end
416
+
417
+ promise.execute
418
+ end
419
+
420
+ #
421
+ # Lists the usage details based on departmentId for a scope by billing period.
422
+ # Usage details are available via this API only for May 1, 2014 or later.
423
+ #
424
+ # @param next_page_link [String] The NextLink from the previous successful call
425
+ # to List operation.
426
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
427
+ # will be added to the HTTP request.
428
+ #
429
+ # @return [UsageDetailsListResult] operation results.
430
+ #
431
+ def list_by_billing_period_next(next_page_link, custom_headers:nil)
432
+ response = list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
433
+ response.body unless response.nil?
434
+ end
435
+
436
+ #
437
+ # Lists the usage details based on departmentId for a scope by billing period.
438
+ # Usage details are available via this API only for May 1, 2014 or later.
439
+ #
440
+ # @param next_page_link [String] The NextLink from the previous successful call
441
+ # to List operation.
442
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
443
+ # will be added to the HTTP request.
444
+ #
445
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
446
+ #
447
+ def list_by_billing_period_next_with_http_info(next_page_link, custom_headers:nil)
448
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
449
+ end
450
+
451
+ #
452
+ # Lists the usage details based on departmentId for a scope by billing period.
453
+ # Usage details are available via this API only for May 1, 2014 or later.
454
+ #
455
+ # @param next_page_link [String] The NextLink from the previous successful call
456
+ # to List operation.
457
+ # @param [Hash{String => String}] A hash of custom headers that will be added
458
+ # to the HTTP request.
459
+ #
460
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
461
+ #
462
+ def list_by_billing_period_next_async(next_page_link, custom_headers:nil)
463
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
464
+
465
+
466
+ request_headers = {}
467
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
468
+
469
+ # Set Headers
470
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
471
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
472
+ path_template = '{nextLink}'
473
+
474
+ request_url = @base_url || @client.base_url
475
+
476
+ options = {
477
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
478
+ skip_encoding_path_params: {'nextLink' => next_page_link},
479
+ headers: request_headers.merge(custom_headers || {}),
480
+ base_url: request_url
481
+ }
482
+ promise = @client.make_request_async(:get, path_template, options)
483
+
484
+ promise = promise.then do |result|
485
+ http_response = result.response
486
+ status_code = http_response.status
487
+ response_content = http_response.body
488
+ unless status_code == 200
489
+ error_model = JSON.load(response_content)
490
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
491
+ end
492
+
493
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
494
+ # Deserialize Response
495
+ if status_code == 200
496
+ begin
497
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
498
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::UsageDetailsListResult.mapper()
499
+ result.body = @client.deserialize(result_mapper, parsed_response)
500
+ rescue Exception => e
501
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
502
+ end
503
+ end
504
+
505
+ result
506
+ end
507
+
508
+ promise.execute
509
+ end
510
+
511
+ #
512
+ # Lists the usage details by departmentId for a scope by current billing
513
+ # period. Usage details are available via this API only for May 1, 2014 or
514
+ # later.
515
+ #
516
+ # @param department_id [String] Department ID
517
+ # @param expand [String] May be used to expand the
518
+ # properties/additionalProperties or properties/meterDetails within a list of
519
+ # usage details. By default, these fields are not included when listing usage
520
+ # details.
521
+ # @param filter [String] May be used to filter usageDetails by
522
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
523
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
524
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
525
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
526
+ # string where key and value is separated by a colon (:).
527
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
528
+ # returned a partial result. If a previous response contains a nextLink
529
+ # element, the value of the nextLink element will include a skiptoken parameter
530
+ # that specifies a starting point to use for subsequent calls.
531
+ # @param top [Integer] May be used to limit the number of results to the most
532
+ # recent N usageDetails.
533
+ # @param query_options [QueryOptions] Additional parameters for the operation
534
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
535
+ # will be added to the HTTP request.
536
+ #
537
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
538
+ # response.
539
+ #
540
+ def list_as_lazy(department_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
541
+ response = list_async(department_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
542
+ unless response.nil?
543
+ page = response.body
544
+ page.next_method = Proc.new do |next_page_link|
545
+ list_next_async(next_page_link, custom_headers:custom_headers)
546
+ end
547
+ page
548
+ end
549
+ end
550
+
551
+ #
552
+ # Lists the usage details based on departmentId for a scope by billing period.
553
+ # Usage details are available via this API only for May 1, 2014 or later.
554
+ #
555
+ # @param department_id [String] Department ID
556
+ # @param billing_period_name [String] Billing Period Name.
557
+ # @param expand [String] May be used to expand the
558
+ # properties/additionalProperties or properties/meterDetails within a list of
559
+ # usage details. By default, these fields are not included when listing usage
560
+ # details.
561
+ # @param filter [String] May be used to filter usageDetails by
562
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
563
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
564
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
565
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
566
+ # where key and value is separated by a colon (:).
567
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
568
+ # returned a partial result. If a previous response contains a nextLink
569
+ # element, the value of the nextLink element will include a skiptoken parameter
570
+ # that specifies a starting point to use for subsequent calls.
571
+ # @param top [Integer] May be used to limit the number of results to the most
572
+ # recent N usageDetails.
573
+ # @param query_options [QueryOptions] Additional parameters for the operation
574
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
575
+ # will be added to the HTTP request.
576
+ #
577
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
578
+ # response.
579
+ #
580
+ def list_by_billing_period_as_lazy(department_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
581
+ response = list_by_billing_period_async(department_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
582
+ unless response.nil?
583
+ page = response.body
584
+ page.next_method = Proc.new do |next_page_link|
585
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers)
586
+ end
587
+ page
588
+ end
589
+ end
590
+
591
+ end
592
+ end