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,85 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-06-30/generated/azure_mgmt_consumption/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Consumption::Mgmt::V2018_06_30
23
+ autoload :UsageDetails, '2018-06-30/generated/azure_mgmt_consumption/usage_details.rb'
24
+ autoload :Marketplaces, '2018-06-30/generated/azure_mgmt_consumption/marketplaces.rb'
25
+ autoload :Balances, '2018-06-30/generated/azure_mgmt_consumption/balances.rb'
26
+ autoload :ReservationsSummaries, '2018-06-30/generated/azure_mgmt_consumption/reservations_summaries.rb'
27
+ autoload :ReservationsDetails, '2018-06-30/generated/azure_mgmt_consumption/reservations_details.rb'
28
+ autoload :ReservationRecommendations, '2018-06-30/generated/azure_mgmt_consumption/reservation_recommendations.rb'
29
+ autoload :Budgets, '2018-06-30/generated/azure_mgmt_consumption/budgets.rb'
30
+ autoload :PriceSheet, '2018-06-30/generated/azure_mgmt_consumption/price_sheet.rb'
31
+ autoload :CostTags, '2018-06-30/generated/azure_mgmt_consumption/cost_tags.rb'
32
+ autoload :Tags, '2018-06-30/generated/azure_mgmt_consumption/tags.rb'
33
+ autoload :Forecasts, '2018-06-30/generated/azure_mgmt_consumption/forecasts.rb'
34
+ autoload :Operations, '2018-06-30/generated/azure_mgmt_consumption/operations.rb'
35
+ autoload :ConsumptionManagementClient, '2018-06-30/generated/azure_mgmt_consumption/consumption_management_client.rb'
36
+
37
+ module Models
38
+ autoload :Notification, '2018-06-30/generated/azure_mgmt_consumption/models/notification.rb'
39
+ autoload :MeterDetails, '2018-06-30/generated/azure_mgmt_consumption/models/meter_details.rb'
40
+ autoload :CurrentSpend, '2018-06-30/generated/azure_mgmt_consumption/models/current_spend.rb'
41
+ autoload :UsageDetailsListResult, '2018-06-30/generated/azure_mgmt_consumption/models/usage_details_list_result.rb'
42
+ autoload :BudgetTimePeriod, '2018-06-30/generated/azure_mgmt_consumption/models/budget_time_period.rb'
43
+ autoload :MarketplacesListResult, '2018-06-30/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb'
44
+ autoload :Filters, '2018-06-30/generated/azure_mgmt_consumption/models/filters.rb'
45
+ autoload :BalancePropertiesAdjustmentDetailsItem, '2018-06-30/generated/azure_mgmt_consumption/models/balance_properties_adjustment_details_item.rb'
46
+ autoload :ErrorResponse, '2018-06-30/generated/azure_mgmt_consumption/models/error_response.rb'
47
+ autoload :OperationListResult, '2018-06-30/generated/azure_mgmt_consumption/models/operation_list_result.rb'
48
+ autoload :ErrorDetails, '2018-06-30/generated/azure_mgmt_consumption/models/error_details.rb'
49
+ autoload :Operation, '2018-06-30/generated/azure_mgmt_consumption/models/operation.rb'
50
+ autoload :ReservationRecommendation, '2018-06-30/generated/azure_mgmt_consumption/models/reservation_recommendation.rb'
51
+ autoload :BudgetsListResult, '2018-06-30/generated/azure_mgmt_consumption/models/budgets_list_result.rb'
52
+ autoload :Tag, '2018-06-30/generated/azure_mgmt_consumption/models/tag.rb'
53
+ autoload :CostTagProperties, '2018-06-30/generated/azure_mgmt_consumption/models/cost_tag_properties.rb'
54
+ autoload :BalancePropertiesNewPurchasesDetailsItem, '2018-06-30/generated/azure_mgmt_consumption/models/balance_properties_new_purchases_details_item.rb'
55
+ autoload :QueryOptions, '2018-06-30/generated/azure_mgmt_consumption/models/query_options.rb'
56
+ autoload :ReservationSummariesListResult, '2018-06-30/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb'
57
+ autoload :PriceSheetProperties, '2018-06-30/generated/azure_mgmt_consumption/models/price_sheet_properties.rb'
58
+ autoload :ReservationRecommendationsListResult, '2018-06-30/generated/azure_mgmt_consumption/models/reservation_recommendations_list_result.rb'
59
+ autoload :ProxyResource, '2018-06-30/generated/azure_mgmt_consumption/models/proxy_resource.rb'
60
+ autoload :Resource, '2018-06-30/generated/azure_mgmt_consumption/models/resource.rb'
61
+ autoload :ForecastPropertiesConfidenceLevelsItem, '2018-06-30/generated/azure_mgmt_consumption/models/forecast_properties_confidence_levels_item.rb'
62
+ autoload :OperationDisplay, '2018-06-30/generated/azure_mgmt_consumption/models/operation_display.rb'
63
+ autoload :ResourceAttributes, '2018-06-30/generated/azure_mgmt_consumption/models/resource_attributes.rb'
64
+ autoload :ReservationDetailsListResult, '2018-06-30/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb'
65
+ autoload :ForecastsListResult, '2018-06-30/generated/azure_mgmt_consumption/models/forecasts_list_result.rb'
66
+ autoload :UsageDetail, '2018-06-30/generated/azure_mgmt_consumption/models/usage_detail.rb'
67
+ autoload :Marketplace, '2018-06-30/generated/azure_mgmt_consumption/models/marketplace.rb'
68
+ autoload :Balance, '2018-06-30/generated/azure_mgmt_consumption/models/balance.rb'
69
+ autoload :ReservationSummary, '2018-06-30/generated/azure_mgmt_consumption/models/reservation_summary.rb'
70
+ autoload :ReservationDetail, '2018-06-30/generated/azure_mgmt_consumption/models/reservation_detail.rb'
71
+ autoload :TagsResult, '2018-06-30/generated/azure_mgmt_consumption/models/tags_result.rb'
72
+ autoload :Budget, '2018-06-30/generated/azure_mgmt_consumption/models/budget.rb'
73
+ autoload :CostTag, '2018-06-30/generated/azure_mgmt_consumption/models/cost_tag.rb'
74
+ autoload :PriceSheetResult, '2018-06-30/generated/azure_mgmt_consumption/models/price_sheet_result.rb'
75
+ autoload :Forecast, '2018-06-30/generated/azure_mgmt_consumption/models/forecast.rb'
76
+ autoload :BillingFrequency, '2018-06-30/generated/azure_mgmt_consumption/models/billing_frequency.rb'
77
+ autoload :CategoryType, '2018-06-30/generated/azure_mgmt_consumption/models/category_type.rb'
78
+ autoload :TimeGrainType, '2018-06-30/generated/azure_mgmt_consumption/models/time_grain_type.rb'
79
+ autoload :OperatorType, '2018-06-30/generated/azure_mgmt_consumption/models/operator_type.rb'
80
+ autoload :Grain, '2018-06-30/generated/azure_mgmt_consumption/models/grain.rb'
81
+ autoload :ChargeType, '2018-06-30/generated/azure_mgmt_consumption/models/charge_type.rb'
82
+ autoload :Bound, '2018-06-30/generated/azure_mgmt_consumption/models/bound.rb'
83
+ autoload :Datagrain, '2018-06-30/generated/azure_mgmt_consumption/models/datagrain.rb'
84
+ end
85
+ end
@@ -0,0 +1,210 @@
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_06_30
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class Balances
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Balances class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ConsumptionManagementClient] reference to the ConsumptionManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets the balances for a scope by billingAccountId. Balances are available via
27
+ # this API only for May 1, 2014 or later.
28
+ #
29
+ # @param billing_account_id [String] BillingAccount ID
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Balance] operation results.
34
+ #
35
+ def get_by_billing_account(billing_account_id, custom_headers:nil)
36
+ response = get_by_billing_account_async(billing_account_id, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Gets the balances for a scope by billingAccountId. Balances are available via
42
+ # this API only for May 1, 2014 or later.
43
+ #
44
+ # @param billing_account_id [String] BillingAccount ID
45
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
46
+ # will be added to the HTTP request.
47
+ #
48
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
49
+ #
50
+ def get_by_billing_account_with_http_info(billing_account_id, custom_headers:nil)
51
+ get_by_billing_account_async(billing_account_id, custom_headers:custom_headers).value!
52
+ end
53
+
54
+ #
55
+ # Gets the balances for a scope by billingAccountId. Balances are available via
56
+ # this API only for May 1, 2014 or later.
57
+ #
58
+ # @param billing_account_id [String] BillingAccount ID
59
+ # @param [Hash{String => String}] A hash of custom headers that will be added
60
+ # to the HTTP request.
61
+ #
62
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
63
+ #
64
+ def get_by_billing_account_async(billing_account_id, custom_headers:nil)
65
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
66
+ fail ArgumentError, 'billing_account_id is nil' if billing_account_id.nil?
67
+
68
+
69
+ request_headers = {}
70
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
71
+
72
+ # Set Headers
73
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
74
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
75
+ path_template = 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances'
76
+
77
+ request_url = @base_url || @client.base_url
78
+
79
+ options = {
80
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
81
+ path_params: {'billingAccountId' => billing_account_id},
82
+ query_params: {'api-version' => @client.api_version},
83
+ headers: request_headers.merge(custom_headers || {}),
84
+ base_url: request_url
85
+ }
86
+ promise = @client.make_request_async(:get, path_template, options)
87
+
88
+ promise = promise.then do |result|
89
+ http_response = result.response
90
+ status_code = http_response.status
91
+ response_content = http_response.body
92
+ unless status_code == 200
93
+ error_model = JSON.load(response_content)
94
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
95
+ end
96
+
97
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
98
+ # Deserialize Response
99
+ if status_code == 200
100
+ begin
101
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
102
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Balance.mapper()
103
+ result.body = @client.deserialize(result_mapper, parsed_response)
104
+ rescue Exception => e
105
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
106
+ end
107
+ end
108
+
109
+ result
110
+ end
111
+
112
+ promise.execute
113
+ end
114
+
115
+ #
116
+ # Gets the balances for a scope by billing period and billingAccountId.
117
+ # Balances are available via this API only for May 1, 2014 or later.
118
+ #
119
+ # @param billing_account_id [String] BillingAccount ID
120
+ # @param billing_period_name [String] Billing Period Name.
121
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
122
+ # will be added to the HTTP request.
123
+ #
124
+ # @return [Balance] operation results.
125
+ #
126
+ def get_for_billing_period_by_billing_account(billing_account_id, billing_period_name, custom_headers:nil)
127
+ response = get_for_billing_period_by_billing_account_async(billing_account_id, billing_period_name, custom_headers:custom_headers).value!
128
+ response.body unless response.nil?
129
+ end
130
+
131
+ #
132
+ # Gets the balances for a scope by billing period and billingAccountId.
133
+ # Balances are available via this API only for May 1, 2014 or later.
134
+ #
135
+ # @param billing_account_id [String] BillingAccount ID
136
+ # @param billing_period_name [String] Billing Period Name.
137
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
138
+ # will be added to the HTTP request.
139
+ #
140
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
141
+ #
142
+ def get_for_billing_period_by_billing_account_with_http_info(billing_account_id, billing_period_name, custom_headers:nil)
143
+ get_for_billing_period_by_billing_account_async(billing_account_id, billing_period_name, custom_headers:custom_headers).value!
144
+ end
145
+
146
+ #
147
+ # Gets the balances for a scope by billing period and billingAccountId.
148
+ # Balances are available via this API only for May 1, 2014 or later.
149
+ #
150
+ # @param billing_account_id [String] BillingAccount ID
151
+ # @param billing_period_name [String] Billing Period Name.
152
+ # @param [Hash{String => String}] A hash of custom headers that will be added
153
+ # to the HTTP request.
154
+ #
155
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
156
+ #
157
+ def get_for_billing_period_by_billing_account_async(billing_account_id, billing_period_name, custom_headers:nil)
158
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
159
+ fail ArgumentError, 'billing_account_id is nil' if billing_account_id.nil?
160
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
161
+
162
+
163
+ request_headers = {}
164
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
165
+
166
+ # Set Headers
167
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
168
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
169
+ path_template = 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/balances'
170
+
171
+ request_url = @base_url || @client.base_url
172
+
173
+ options = {
174
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
175
+ path_params: {'billingAccountId' => billing_account_id,'billingPeriodName' => billing_period_name},
176
+ query_params: {'api-version' => @client.api_version},
177
+ headers: request_headers.merge(custom_headers || {}),
178
+ base_url: request_url
179
+ }
180
+ promise = @client.make_request_async(:get, path_template, options)
181
+
182
+ promise = promise.then do |result|
183
+ http_response = result.response
184
+ status_code = http_response.status
185
+ response_content = http_response.body
186
+ unless status_code == 200
187
+ error_model = JSON.load(response_content)
188
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
189
+ end
190
+
191
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
192
+ # Deserialize Response
193
+ if status_code == 200
194
+ begin
195
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
196
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Balance.mapper()
197
+ result.body = @client.deserialize(result_mapper, parsed_response)
198
+ rescue Exception => e
199
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
200
+ end
201
+ end
202
+
203
+ result
204
+ end
205
+
206
+ promise.execute
207
+ end
208
+
209
+ end
210
+ end
@@ -0,0 +1,993 @@
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_06_30
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class Budgets
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Budgets 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 budgets for a subscription.
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<Budget>] operation results.
32
+ #
33
+ def list(custom_headers:nil)
34
+ first_page = list_as_lazy(custom_headers:custom_headers)
35
+ first_page.get_all_items
36
+ end
37
+
38
+ #
39
+ # Lists all budgets for a subscription.
40
+ #
41
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
42
+ # will be added to the HTTP request.
43
+ #
44
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
45
+ #
46
+ def list_with_http_info(custom_headers:nil)
47
+ list_async(custom_headers:custom_headers).value!
48
+ end
49
+
50
+ #
51
+ # Lists all budgets for a subscription.
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
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
61
+
62
+
63
+ request_headers = {}
64
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
65
+
66
+ # Set Headers
67
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
68
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
69
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets'
70
+
71
+ request_url = @base_url || @client.base_url
72
+
73
+ options = {
74
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
75
+ path_params: {'subscriptionId' => @client.subscription_id},
76
+ query_params: {'api-version' => @client.api_version},
77
+ headers: request_headers.merge(custom_headers || {}),
78
+ base_url: request_url
79
+ }
80
+ promise = @client.make_request_async(:get, path_template, options)
81
+
82
+ promise = promise.then do |result|
83
+ http_response = result.response
84
+ status_code = http_response.status
85
+ response_content = http_response.body
86
+ unless status_code == 200
87
+ error_model = JSON.load(response_content)
88
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
89
+ end
90
+
91
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
92
+ # Deserialize Response
93
+ if status_code == 200
94
+ begin
95
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
96
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::BudgetsListResult.mapper()
97
+ result.body = @client.deserialize(result_mapper, parsed_response)
98
+ rescue Exception => e
99
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
100
+ end
101
+ end
102
+
103
+ result
104
+ end
105
+
106
+ promise.execute
107
+ end
108
+
109
+ #
110
+ # Lists all budgets for a resource group under a subscription.
111
+ #
112
+ # @param resource_group_name [String] Azure Resource Group Name.
113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
114
+ # will be added to the HTTP request.
115
+ #
116
+ # @return [Array<Budget>] operation results.
117
+ #
118
+ def list_by_resource_group_name(resource_group_name, custom_headers:nil)
119
+ first_page = list_by_resource_group_name_as_lazy(resource_group_name, custom_headers:custom_headers)
120
+ first_page.get_all_items
121
+ end
122
+
123
+ #
124
+ # Lists all budgets for a resource group under a subscription.
125
+ #
126
+ # @param resource_group_name [String] Azure Resource Group Name.
127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
128
+ # will be added to the HTTP request.
129
+ #
130
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
131
+ #
132
+ def list_by_resource_group_name_with_http_info(resource_group_name, custom_headers:nil)
133
+ list_by_resource_group_name_async(resource_group_name, custom_headers:custom_headers).value!
134
+ end
135
+
136
+ #
137
+ # Lists all budgets for a resource group under a subscription.
138
+ #
139
+ # @param resource_group_name [String] Azure Resource Group Name.
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_by_resource_group_name_async(resource_group_name, custom_headers:nil)
146
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
147
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
148
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
149
+
150
+
151
+ request_headers = {}
152
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
153
+
154
+ # Set Headers
155
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
156
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
157
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets'
158
+
159
+ request_url = @base_url || @client.base_url
160
+
161
+ options = {
162
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
163
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
164
+ query_params: {'api-version' => @client.api_version},
165
+ headers: request_headers.merge(custom_headers || {}),
166
+ base_url: request_url
167
+ }
168
+ promise = @client.make_request_async(:get, path_template, options)
169
+
170
+ promise = promise.then do |result|
171
+ http_response = result.response
172
+ status_code = http_response.status
173
+ response_content = http_response.body
174
+ unless status_code == 200
175
+ error_model = JSON.load(response_content)
176
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
177
+ end
178
+
179
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
180
+ # Deserialize Response
181
+ if status_code == 200
182
+ begin
183
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
184
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::BudgetsListResult.mapper()
185
+ result.body = @client.deserialize(result_mapper, parsed_response)
186
+ rescue Exception => e
187
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
188
+ end
189
+ end
190
+
191
+ result
192
+ end
193
+
194
+ promise.execute
195
+ end
196
+
197
+ #
198
+ # Gets the budget for a subscription by budget name.
199
+ #
200
+ # @param budget_name [String] Budget Name.
201
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
202
+ # will be added to the HTTP request.
203
+ #
204
+ # @return [Budget] operation results.
205
+ #
206
+ def get(budget_name, custom_headers:nil)
207
+ response = get_async(budget_name, custom_headers:custom_headers).value!
208
+ response.body unless response.nil?
209
+ end
210
+
211
+ #
212
+ # Gets the budget for a subscription by budget name.
213
+ #
214
+ # @param budget_name [String] Budget Name.
215
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
216
+ # will be added to the HTTP request.
217
+ #
218
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
219
+ #
220
+ def get_with_http_info(budget_name, custom_headers:nil)
221
+ get_async(budget_name, custom_headers:custom_headers).value!
222
+ end
223
+
224
+ #
225
+ # Gets the budget for a subscription by budget name.
226
+ #
227
+ # @param budget_name [String] Budget Name.
228
+ # @param [Hash{String => String}] A hash of custom headers that will be added
229
+ # to the HTTP request.
230
+ #
231
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
232
+ #
233
+ def get_async(budget_name, custom_headers:nil)
234
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
235
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
236
+ fail ArgumentError, 'budget_name is nil' if budget_name.nil?
237
+
238
+
239
+ request_headers = {}
240
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
241
+
242
+ # Set Headers
243
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
244
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
245
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}'
246
+
247
+ request_url = @base_url || @client.base_url
248
+
249
+ options = {
250
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
251
+ path_params: {'subscriptionId' => @client.subscription_id,'budgetName' => budget_name},
252
+ query_params: {'api-version' => @client.api_version},
253
+ headers: request_headers.merge(custom_headers || {}),
254
+ base_url: request_url
255
+ }
256
+ promise = @client.make_request_async(:get, path_template, options)
257
+
258
+ promise = promise.then do |result|
259
+ http_response = result.response
260
+ status_code = http_response.status
261
+ response_content = http_response.body
262
+ unless status_code == 200
263
+ error_model = JSON.load(response_content)
264
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
265
+ end
266
+
267
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
268
+ # Deserialize Response
269
+ if status_code == 200
270
+ begin
271
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
272
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Budget.mapper()
273
+ result.body = @client.deserialize(result_mapper, parsed_response)
274
+ rescue Exception => e
275
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
276
+ end
277
+ end
278
+
279
+ result
280
+ end
281
+
282
+ promise.execute
283
+ end
284
+
285
+ #
286
+ # The operation to create or update a budget. Update operation requires latest
287
+ # eTag to be set in the request mandatorily. You may obtain the latest eTag by
288
+ # performing a get operation. Create operation does not require eTag.
289
+ #
290
+ # @param budget_name [String] Budget Name.
291
+ # @param parameters [Budget] Parameters supplied to the Create Budget
292
+ # operation.
293
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
294
+ # will be added to the HTTP request.
295
+ #
296
+ # @return [Budget] operation results.
297
+ #
298
+ def create_or_update(budget_name, parameters, custom_headers:nil)
299
+ response = create_or_update_async(budget_name, parameters, custom_headers:custom_headers).value!
300
+ response.body unless response.nil?
301
+ end
302
+
303
+ #
304
+ # The operation to create or update a budget. Update operation requires latest
305
+ # eTag to be set in the request mandatorily. You may obtain the latest eTag by
306
+ # performing a get operation. Create operation does not require eTag.
307
+ #
308
+ # @param budget_name [String] Budget Name.
309
+ # @param parameters [Budget] Parameters supplied to the Create Budget
310
+ # operation.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
315
+ #
316
+ def create_or_update_with_http_info(budget_name, parameters, custom_headers:nil)
317
+ create_or_update_async(budget_name, parameters, custom_headers:custom_headers).value!
318
+ end
319
+
320
+ #
321
+ # The operation to create or update a budget. Update operation requires latest
322
+ # eTag to be set in the request mandatorily. You may obtain the latest eTag by
323
+ # performing a get operation. Create operation does not require eTag.
324
+ #
325
+ # @param budget_name [String] Budget Name.
326
+ # @param parameters [Budget] Parameters supplied to the Create Budget
327
+ # operation.
328
+ # @param [Hash{String => String}] A hash of custom headers that will be added
329
+ # to the HTTP request.
330
+ #
331
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
332
+ #
333
+ def create_or_update_async(budget_name, parameters, custom_headers:nil)
334
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
335
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
336
+ fail ArgumentError, 'budget_name is nil' if budget_name.nil?
337
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
338
+
339
+
340
+ request_headers = {}
341
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
342
+
343
+ # Set Headers
344
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
345
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
346
+
347
+ # Serialize Request
348
+ request_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Budget.mapper()
349
+ request_content = @client.serialize(request_mapper, parameters)
350
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
351
+
352
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}'
353
+
354
+ request_url = @base_url || @client.base_url
355
+
356
+ options = {
357
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
358
+ path_params: {'subscriptionId' => @client.subscription_id,'budgetName' => budget_name},
359
+ query_params: {'api-version' => @client.api_version},
360
+ body: request_content,
361
+ headers: request_headers.merge(custom_headers || {}),
362
+ base_url: request_url
363
+ }
364
+ promise = @client.make_request_async(:put, path_template, options)
365
+
366
+ promise = promise.then do |result|
367
+ http_response = result.response
368
+ status_code = http_response.status
369
+ response_content = http_response.body
370
+ unless status_code == 200 || status_code == 201
371
+ error_model = JSON.load(response_content)
372
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
373
+ end
374
+
375
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
376
+ # Deserialize Response
377
+ if status_code == 200
378
+ begin
379
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
380
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Budget.mapper()
381
+ result.body = @client.deserialize(result_mapper, parsed_response)
382
+ rescue Exception => e
383
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
384
+ end
385
+ end
386
+ # Deserialize Response
387
+ if status_code == 201
388
+ begin
389
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
390
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Budget.mapper()
391
+ result.body = @client.deserialize(result_mapper, parsed_response)
392
+ rescue Exception => e
393
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
394
+ end
395
+ end
396
+
397
+ result
398
+ end
399
+
400
+ promise.execute
401
+ end
402
+
403
+ #
404
+ # The operation to delete a budget.
405
+ #
406
+ # @param budget_name [String] Budget Name.
407
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
408
+ # will be added to the HTTP request.
409
+ #
410
+ #
411
+ def delete(budget_name, custom_headers:nil)
412
+ response = delete_async(budget_name, custom_headers:custom_headers).value!
413
+ nil
414
+ end
415
+
416
+ #
417
+ # The operation to delete a budget.
418
+ #
419
+ # @param budget_name [String] Budget Name.
420
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
421
+ # will be added to the HTTP request.
422
+ #
423
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
424
+ #
425
+ def delete_with_http_info(budget_name, custom_headers:nil)
426
+ delete_async(budget_name, custom_headers:custom_headers).value!
427
+ end
428
+
429
+ #
430
+ # The operation to delete a budget.
431
+ #
432
+ # @param budget_name [String] Budget Name.
433
+ # @param [Hash{String => String}] A hash of custom headers that will be added
434
+ # to the HTTP request.
435
+ #
436
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
437
+ #
438
+ def delete_async(budget_name, custom_headers:nil)
439
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
440
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
441
+ fail ArgumentError, 'budget_name is nil' if budget_name.nil?
442
+
443
+
444
+ request_headers = {}
445
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
446
+
447
+ # Set Headers
448
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
449
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
450
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}'
451
+
452
+ request_url = @base_url || @client.base_url
453
+
454
+ options = {
455
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
456
+ path_params: {'subscriptionId' => @client.subscription_id,'budgetName' => budget_name},
457
+ query_params: {'api-version' => @client.api_version},
458
+ headers: request_headers.merge(custom_headers || {}),
459
+ base_url: request_url
460
+ }
461
+ promise = @client.make_request_async(:delete, path_template, options)
462
+
463
+ promise = promise.then do |result|
464
+ http_response = result.response
465
+ status_code = http_response.status
466
+ response_content = http_response.body
467
+ unless status_code == 200
468
+ error_model = JSON.load(response_content)
469
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
470
+ end
471
+
472
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
473
+
474
+ result
475
+ end
476
+
477
+ promise.execute
478
+ end
479
+
480
+ #
481
+ # Gets the budget for a resource group under a subscription by budget name.
482
+ #
483
+ # @param resource_group_name [String] Azure Resource Group Name.
484
+ # @param budget_name [String] Budget Name.
485
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
486
+ # will be added to the HTTP request.
487
+ #
488
+ # @return [Budget] operation results.
489
+ #
490
+ def get_by_resource_group_name(resource_group_name, budget_name, custom_headers:nil)
491
+ response = get_by_resource_group_name_async(resource_group_name, budget_name, custom_headers:custom_headers).value!
492
+ response.body unless response.nil?
493
+ end
494
+
495
+ #
496
+ # Gets the budget for a resource group under a subscription by budget name.
497
+ #
498
+ # @param resource_group_name [String] Azure Resource Group Name.
499
+ # @param budget_name [String] Budget Name.
500
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
501
+ # will be added to the HTTP request.
502
+ #
503
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
504
+ #
505
+ def get_by_resource_group_name_with_http_info(resource_group_name, budget_name, custom_headers:nil)
506
+ get_by_resource_group_name_async(resource_group_name, budget_name, custom_headers:custom_headers).value!
507
+ end
508
+
509
+ #
510
+ # Gets the budget for a resource group under a subscription by budget name.
511
+ #
512
+ # @param resource_group_name [String] Azure Resource Group Name.
513
+ # @param budget_name [String] Budget Name.
514
+ # @param [Hash{String => String}] A hash of custom headers that will be added
515
+ # to the HTTP request.
516
+ #
517
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
518
+ #
519
+ def get_by_resource_group_name_async(resource_group_name, budget_name, custom_headers:nil)
520
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
521
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
522
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
523
+ fail ArgumentError, 'budget_name is nil' if budget_name.nil?
524
+
525
+
526
+ request_headers = {}
527
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
528
+
529
+ # Set Headers
530
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
531
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
532
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}'
533
+
534
+ request_url = @base_url || @client.base_url
535
+
536
+ options = {
537
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
538
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'budgetName' => budget_name},
539
+ query_params: {'api-version' => @client.api_version},
540
+ headers: request_headers.merge(custom_headers || {}),
541
+ base_url: request_url
542
+ }
543
+ promise = @client.make_request_async(:get, path_template, options)
544
+
545
+ promise = promise.then do |result|
546
+ http_response = result.response
547
+ status_code = http_response.status
548
+ response_content = http_response.body
549
+ unless status_code == 200
550
+ error_model = JSON.load(response_content)
551
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
552
+ end
553
+
554
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
555
+ # Deserialize Response
556
+ if status_code == 200
557
+ begin
558
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
559
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Budget.mapper()
560
+ result.body = @client.deserialize(result_mapper, parsed_response)
561
+ rescue Exception => e
562
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
563
+ end
564
+ end
565
+
566
+ result
567
+ end
568
+
569
+ promise.execute
570
+ end
571
+
572
+ #
573
+ # The operation to create or update a budget. Update operation requires latest
574
+ # eTag to be set in the request mandatorily. You may obtain the latest eTag by
575
+ # performing a get operation. Create operation does not require eTag.
576
+ #
577
+ # @param resource_group_name [String] Azure Resource Group Name.
578
+ # @param budget_name [String] Budget Name.
579
+ # @param parameters [Budget] Parameters supplied to the Create Budget
580
+ # 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 [Budget] operation results.
585
+ #
586
+ def create_or_update_by_resource_group_name(resource_group_name, budget_name, parameters, custom_headers:nil)
587
+ response = create_or_update_by_resource_group_name_async(resource_group_name, budget_name, parameters, custom_headers:custom_headers).value!
588
+ response.body unless response.nil?
589
+ end
590
+
591
+ #
592
+ # The operation to create or update a budget. Update operation requires latest
593
+ # eTag to be set in the request mandatorily. You may obtain the latest eTag by
594
+ # performing a get operation. Create operation does not require eTag.
595
+ #
596
+ # @param resource_group_name [String] Azure Resource Group Name.
597
+ # @param budget_name [String] Budget Name.
598
+ # @param parameters [Budget] Parameters supplied to the Create Budget
599
+ # operation.
600
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
601
+ # will be added to the HTTP request.
602
+ #
603
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
604
+ #
605
+ def create_or_update_by_resource_group_name_with_http_info(resource_group_name, budget_name, parameters, custom_headers:nil)
606
+ create_or_update_by_resource_group_name_async(resource_group_name, budget_name, parameters, custom_headers:custom_headers).value!
607
+ end
608
+
609
+ #
610
+ # The operation to create or update a budget. Update operation requires latest
611
+ # eTag to be set in the request mandatorily. You may obtain the latest eTag by
612
+ # performing a get operation. Create operation does not require eTag.
613
+ #
614
+ # @param resource_group_name [String] Azure Resource Group Name.
615
+ # @param budget_name [String] Budget Name.
616
+ # @param parameters [Budget] Parameters supplied to the Create Budget
617
+ # operation.
618
+ # @param [Hash{String => String}] A hash of custom headers that will be added
619
+ # to the HTTP request.
620
+ #
621
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
622
+ #
623
+ def create_or_update_by_resource_group_name_async(resource_group_name, budget_name, parameters, custom_headers:nil)
624
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
625
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
626
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
627
+ fail ArgumentError, 'budget_name is nil' if budget_name.nil?
628
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
629
+
630
+
631
+ request_headers = {}
632
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
633
+
634
+ # Set Headers
635
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
636
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
637
+
638
+ # Serialize Request
639
+ request_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Budget.mapper()
640
+ request_content = @client.serialize(request_mapper, parameters)
641
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
642
+
643
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}'
644
+
645
+ request_url = @base_url || @client.base_url
646
+
647
+ options = {
648
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
649
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'budgetName' => budget_name},
650
+ query_params: {'api-version' => @client.api_version},
651
+ body: request_content,
652
+ headers: request_headers.merge(custom_headers || {}),
653
+ base_url: request_url
654
+ }
655
+ promise = @client.make_request_async(:put, path_template, options)
656
+
657
+ promise = promise.then do |result|
658
+ http_response = result.response
659
+ status_code = http_response.status
660
+ response_content = http_response.body
661
+ unless status_code == 200 || status_code == 201
662
+ error_model = JSON.load(response_content)
663
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
664
+ end
665
+
666
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
667
+ # Deserialize Response
668
+ if status_code == 200
669
+ begin
670
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
671
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Budget.mapper()
672
+ result.body = @client.deserialize(result_mapper, parsed_response)
673
+ rescue Exception => e
674
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
675
+ end
676
+ end
677
+ # Deserialize Response
678
+ if status_code == 201
679
+ begin
680
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
681
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::Budget.mapper()
682
+ result.body = @client.deserialize(result_mapper, parsed_response)
683
+ rescue Exception => e
684
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
685
+ end
686
+ end
687
+
688
+ result
689
+ end
690
+
691
+ promise.execute
692
+ end
693
+
694
+ #
695
+ # The operation to delete a budget.
696
+ #
697
+ # @param resource_group_name [String] Azure Resource Group Name.
698
+ # @param budget_name [String] Budget Name.
699
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
700
+ # will be added to the HTTP request.
701
+ #
702
+ #
703
+ def delete_by_resource_group_name(resource_group_name, budget_name, custom_headers:nil)
704
+ response = delete_by_resource_group_name_async(resource_group_name, budget_name, custom_headers:custom_headers).value!
705
+ nil
706
+ end
707
+
708
+ #
709
+ # The operation to delete a budget.
710
+ #
711
+ # @param resource_group_name [String] Azure Resource Group Name.
712
+ # @param budget_name [String] Budget Name.
713
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
714
+ # will be added to the HTTP request.
715
+ #
716
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
717
+ #
718
+ def delete_by_resource_group_name_with_http_info(resource_group_name, budget_name, custom_headers:nil)
719
+ delete_by_resource_group_name_async(resource_group_name, budget_name, custom_headers:custom_headers).value!
720
+ end
721
+
722
+ #
723
+ # The operation to delete a budget.
724
+ #
725
+ # @param resource_group_name [String] Azure Resource Group Name.
726
+ # @param budget_name [String] Budget Name.
727
+ # @param [Hash{String => String}] A hash of custom headers that will be added
728
+ # to the HTTP request.
729
+ #
730
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
731
+ #
732
+ def delete_by_resource_group_name_async(resource_group_name, budget_name, custom_headers:nil)
733
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
734
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
735
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
736
+ fail ArgumentError, 'budget_name is nil' if budget_name.nil?
737
+
738
+
739
+ request_headers = {}
740
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
741
+
742
+ # Set Headers
743
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
744
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
745
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}'
746
+
747
+ request_url = @base_url || @client.base_url
748
+
749
+ options = {
750
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
751
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'budgetName' => budget_name},
752
+ query_params: {'api-version' => @client.api_version},
753
+ headers: request_headers.merge(custom_headers || {}),
754
+ base_url: request_url
755
+ }
756
+ promise = @client.make_request_async(:delete, path_template, options)
757
+
758
+ promise = promise.then do |result|
759
+ http_response = result.response
760
+ status_code = http_response.status
761
+ response_content = http_response.body
762
+ unless status_code == 200
763
+ error_model = JSON.load(response_content)
764
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
765
+ end
766
+
767
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
768
+
769
+ result
770
+ end
771
+
772
+ promise.execute
773
+ end
774
+
775
+ #
776
+ # Lists all budgets for a subscription.
777
+ #
778
+ # @param next_page_link [String] The NextLink from the previous successful call
779
+ # to List operation.
780
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
781
+ # will be added to the HTTP request.
782
+ #
783
+ # @return [BudgetsListResult] operation results.
784
+ #
785
+ def list_next(next_page_link, custom_headers:nil)
786
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
787
+ response.body unless response.nil?
788
+ end
789
+
790
+ #
791
+ # Lists all budgets for a subscription.
792
+ #
793
+ # @param next_page_link [String] The NextLink from the previous successful call
794
+ # to List operation.
795
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
796
+ # will be added to the HTTP request.
797
+ #
798
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
799
+ #
800
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
801
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
802
+ end
803
+
804
+ #
805
+ # Lists all budgets for a subscription.
806
+ #
807
+ # @param next_page_link [String] The NextLink from the previous successful call
808
+ # to List operation.
809
+ # @param [Hash{String => String}] A hash of custom headers that will be added
810
+ # to the HTTP request.
811
+ #
812
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
813
+ #
814
+ def list_next_async(next_page_link, custom_headers:nil)
815
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
816
+
817
+
818
+ request_headers = {}
819
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
820
+
821
+ # Set Headers
822
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
823
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
824
+ path_template = '{nextLink}'
825
+
826
+ request_url = @base_url || @client.base_url
827
+
828
+ options = {
829
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
830
+ skip_encoding_path_params: {'nextLink' => next_page_link},
831
+ headers: request_headers.merge(custom_headers || {}),
832
+ base_url: request_url
833
+ }
834
+ promise = @client.make_request_async(:get, path_template, options)
835
+
836
+ promise = promise.then do |result|
837
+ http_response = result.response
838
+ status_code = http_response.status
839
+ response_content = http_response.body
840
+ unless status_code == 200
841
+ error_model = JSON.load(response_content)
842
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
843
+ end
844
+
845
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
846
+ # Deserialize Response
847
+ if status_code == 200
848
+ begin
849
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
850
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::BudgetsListResult.mapper()
851
+ result.body = @client.deserialize(result_mapper, parsed_response)
852
+ rescue Exception => e
853
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
854
+ end
855
+ end
856
+
857
+ result
858
+ end
859
+
860
+ promise.execute
861
+ end
862
+
863
+ #
864
+ # Lists all budgets for a resource group under a subscription.
865
+ #
866
+ # @param next_page_link [String] The NextLink from the previous successful call
867
+ # to List operation.
868
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
869
+ # will be added to the HTTP request.
870
+ #
871
+ # @return [BudgetsListResult] operation results.
872
+ #
873
+ def list_by_resource_group_name_next(next_page_link, custom_headers:nil)
874
+ response = list_by_resource_group_name_next_async(next_page_link, custom_headers:custom_headers).value!
875
+ response.body unless response.nil?
876
+ end
877
+
878
+ #
879
+ # Lists all budgets for a resource group under a subscription.
880
+ #
881
+ # @param next_page_link [String] The NextLink from the previous successful call
882
+ # to List operation.
883
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
884
+ # will be added to the HTTP request.
885
+ #
886
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
887
+ #
888
+ def list_by_resource_group_name_next_with_http_info(next_page_link, custom_headers:nil)
889
+ list_by_resource_group_name_next_async(next_page_link, custom_headers:custom_headers).value!
890
+ end
891
+
892
+ #
893
+ # Lists all budgets for a resource group under a subscription.
894
+ #
895
+ # @param next_page_link [String] The NextLink from the previous successful call
896
+ # to List operation.
897
+ # @param [Hash{String => String}] A hash of custom headers that will be added
898
+ # to the HTTP request.
899
+ #
900
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
901
+ #
902
+ def list_by_resource_group_name_next_async(next_page_link, custom_headers:nil)
903
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
904
+
905
+
906
+ request_headers = {}
907
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
908
+
909
+ # Set Headers
910
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
911
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
912
+ path_template = '{nextLink}'
913
+
914
+ request_url = @base_url || @client.base_url
915
+
916
+ options = {
917
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
918
+ skip_encoding_path_params: {'nextLink' => next_page_link},
919
+ headers: request_headers.merge(custom_headers || {}),
920
+ base_url: request_url
921
+ }
922
+ promise = @client.make_request_async(:get, path_template, options)
923
+
924
+ promise = promise.then do |result|
925
+ http_response = result.response
926
+ status_code = http_response.status
927
+ response_content = http_response.body
928
+ unless status_code == 200
929
+ error_model = JSON.load(response_content)
930
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
931
+ end
932
+
933
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
934
+ # Deserialize Response
935
+ if status_code == 200
936
+ begin
937
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
938
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::BudgetsListResult.mapper()
939
+ result.body = @client.deserialize(result_mapper, parsed_response)
940
+ rescue Exception => e
941
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
942
+ end
943
+ end
944
+
945
+ result
946
+ end
947
+
948
+ promise.execute
949
+ end
950
+
951
+ #
952
+ # Lists all budgets for a subscription.
953
+ #
954
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
955
+ # will be added to the HTTP request.
956
+ #
957
+ # @return [BudgetsListResult] which provide lazy access to pages of the
958
+ # response.
959
+ #
960
+ def list_as_lazy(custom_headers:nil)
961
+ response = list_async(custom_headers:custom_headers).value!
962
+ unless response.nil?
963
+ page = response.body
964
+ page.next_method = Proc.new do |next_page_link|
965
+ list_next_async(next_page_link, custom_headers:custom_headers)
966
+ end
967
+ page
968
+ end
969
+ end
970
+
971
+ #
972
+ # Lists all budgets for a resource group under a subscription.
973
+ #
974
+ # @param resource_group_name [String] Azure Resource Group Name.
975
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
976
+ # will be added to the HTTP request.
977
+ #
978
+ # @return [BudgetsListResult] which provide lazy access to pages of the
979
+ # response.
980
+ #
981
+ def list_by_resource_group_name_as_lazy(resource_group_name, custom_headers:nil)
982
+ response = list_by_resource_group_name_async(resource_group_name, custom_headers:custom_headers).value!
983
+ unless response.nil?
984
+ page = response.body
985
+ page.next_method = Proc.new do |next_page_link|
986
+ list_by_resource_group_name_next_async(next_page_link, custom_headers:custom_headers)
987
+ end
988
+ page
989
+ end
990
+ end
991
+
992
+ end
993
+ end