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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fef3f59f11fa59a3ab4d7b8546e51f3925e4c3a8
4
- data.tar.gz: 77d24580197e64c5e6724bc2308de00aa6fd8352
3
+ metadata.gz: e83b2f108f819252ded2c8d6da5e3b884c7d12ab
4
+ data.tar.gz: 81da7588ae34e526b917240c37a296f8df911576
5
5
  SHA512:
6
- metadata.gz: 9e9bd472535bc1353765a17d4ad34ce2836759bbff683f92022493b439162505d6e02b5c9410b9c008e9465f01444c237e32079c78b567bea878e69a691a0a19
7
- data.tar.gz: 20060fdb520f8d1a5450f713df64ab3c5280e1df70afb7d33955e9d33ac040e69503118d48d5e887ea9527b6ca41c23e9e72e22cdd9f7a4b01e751394b612d0b
6
+ metadata.gz: 0f9833bf5fd0ac90010c53ad9bb39029d6d4d043d367f31cf7a152be186acfeb82cc68dadc4e2e6e21560be2e11be7fa8f60b112d96d8b1275b112d245c7436d
7
+ data.tar.gz: 5898c7639ef5feb818ea36d63dd6ed0115742dad7868b1843bd1957d2ef80914d38fef9d0c3b5ecccafc366709adc293a709c038d10606d8afdb8c07fb54ec52
@@ -24,15 +24,16 @@ module Azure::Consumption::Mgmt::V2017_04_24_preview
24
24
  # @return [String] Azure Subscription ID.
25
25
  attr_accessor :subscription_id
26
26
 
27
- # @return [String] Gets or sets the preferred language for the response.
27
+ # @return [String] The preferred language for the response.
28
28
  attr_accessor :accept_language
29
29
 
30
- # @return [Integer] Gets or sets the retry timeout in seconds for Long
31
- # Running Operations. Default value is 30.
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
32
  attr_accessor :long_running_operation_retry_timeout
33
33
 
34
- # @return [Boolean] When set to true a unique x-ms-client-request-id value
35
- # is generated and included in each request. Default is true.
34
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
35
+ # generated. When set to true a unique x-ms-client-request-id value is
36
+ # generated and included in each request. Default is true.
36
37
  attr_accessor :generate_client_request_id
37
38
 
38
39
  # @return [UsageDetails] usage_details
@@ -128,7 +129,7 @@ module Azure::Consumption::Mgmt::V2017_04_24_preview
128
129
  #
129
130
  def add_telemetry
130
131
  sdk_information = 'azure_mgmt_consumption'
131
- sdk_information = "#{sdk_information}/0.16.0"
132
+ sdk_information = "#{sdk_information}/0.17.0"
132
133
  add_user_agent_information(sdk_information)
133
134
  end
134
135
  end
@@ -24,15 +24,16 @@ module Azure::Consumption::Mgmt::V2017_11_30
24
24
  # @return [String] Azure Subscription ID.
25
25
  attr_accessor :subscription_id
26
26
 
27
- # @return [String] Gets or sets the preferred language for the response.
27
+ # @return [String] The preferred language for the response.
28
28
  attr_accessor :accept_language
29
29
 
30
- # @return [Integer] Gets or sets the retry timeout in seconds for Long
31
- # Running Operations. Default value is 30.
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
32
  attr_accessor :long_running_operation_retry_timeout
33
33
 
34
- # @return [Boolean] When set to true a unique x-ms-client-request-id value
35
- # is generated and included in each request. Default is true.
34
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
35
+ # generated. When set to true a unique x-ms-client-request-id value is
36
+ # generated and included in each request. Default is true.
36
37
  attr_accessor :generate_client_request_id
37
38
 
38
39
  # @return [UsageDetails] usage_details
@@ -136,7 +137,7 @@ module Azure::Consumption::Mgmt::V2017_11_30
136
137
  #
137
138
  def add_telemetry
138
139
  sdk_information = 'azure_mgmt_consumption'
139
- sdk_information = "#{sdk_information}/0.16.0"
140
+ sdk_information = "#{sdk_information}/0.17.0"
140
141
  add_user_agent_information(sdk_information)
141
142
  end
142
143
  end
@@ -27,15 +27,16 @@ module Azure::Consumption::Mgmt::V2017_12_30_preview
27
27
  # @return [String] Budget name.
28
28
  attr_accessor :name
29
29
 
30
- # @return [String] Gets or sets the preferred language for the response.
30
+ # @return [String] The preferred language for the response.
31
31
  attr_accessor :accept_language
32
32
 
33
- # @return [Integer] Gets or sets the retry timeout in seconds for Long
34
- # Running Operations. Default value is 30.
33
+ # @return [Integer] The retry timeout in seconds for Long Running
34
+ # Operations. Default value is 30.
35
35
  attr_accessor :long_running_operation_retry_timeout
36
36
 
37
- # @return [Boolean] When set to true a unique x-ms-client-request-id value
38
- # is generated and included in each request. Default is true.
37
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
38
+ # generated. When set to true a unique x-ms-client-request-id value is
39
+ # generated and included in each request. Default is true.
39
40
  attr_accessor :generate_client_request_id
40
41
 
41
42
  # @return [Budgets] budgets
@@ -131,7 +132,7 @@ module Azure::Consumption::Mgmt::V2017_12_30_preview
131
132
  #
132
133
  def add_telemetry
133
134
  sdk_information = 'azure_mgmt_consumption'
134
- sdk_information = "#{sdk_information}/0.16.0"
135
+ sdk_information = "#{sdk_information}/0.17.0"
135
136
  add_user_agent_information(sdk_information)
136
137
  end
137
138
  end
@@ -24,15 +24,16 @@ module Azure::Consumption::Mgmt::V2018_01_31
24
24
  # @return [String] Azure Subscription ID.
25
25
  attr_accessor :subscription_id
26
26
 
27
- # @return [String] Gets or sets the preferred language for the response.
27
+ # @return [String] The preferred language for the response.
28
28
  attr_accessor :accept_language
29
29
 
30
- # @return [Integer] Gets or sets the retry timeout in seconds for Long
31
- # Running Operations. Default value is 30.
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
32
  attr_accessor :long_running_operation_retry_timeout
33
33
 
34
- # @return [Boolean] When set to true a unique x-ms-client-request-id value
35
- # is generated and included in each request. Default is true.
34
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
35
+ # generated. When set to true a unique x-ms-client-request-id value is
36
+ # generated and included in each request. Default is true.
36
37
  attr_accessor :generate_client_request_id
37
38
 
38
39
  # @return [UsageDetails] usage_details
@@ -148,7 +149,7 @@ module Azure::Consumption::Mgmt::V2018_01_31
148
149
  #
149
150
  def add_telemetry
150
151
  sdk_information = 'azure_mgmt_consumption'
151
- sdk_information = "#{sdk_information}/0.16.0"
152
+ sdk_information = "#{sdk_information}/0.17.0"
152
153
  add_user_agent_information(sdk_information)
153
154
  end
154
155
  end
@@ -33,13 +33,15 @@ module Azure::Consumption::Mgmt::V2018_01_31
33
33
  # returned a partial result. If a previous response contains a nextLink
34
34
  # element, the value of the nextLink element will include a skiptoken parameter
35
35
  # that specifies a starting point to use for subsequent calls.
36
+ # @param top [Integer] May be used to limit the number of results to the top N
37
+ # results.
36
38
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
39
  # will be added to the HTTP request.
38
40
  #
39
41
  # @return [PriceSheetResult] operation results.
40
42
  #
41
- def get(expand:nil, skiptoken:nil, custom_headers:nil)
42
- response = get_async(expand:expand, skiptoken:skiptoken, custom_headers:custom_headers).value!
43
+ def get(expand:nil, skiptoken:nil, top:nil, custom_headers:nil)
44
+ response = get_async(expand:expand, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
43
45
  response.body unless response.nil?
44
46
  end
45
47
 
@@ -54,13 +56,15 @@ module Azure::Consumption::Mgmt::V2018_01_31
54
56
  # returned a partial result. If a previous response contains a nextLink
55
57
  # element, the value of the nextLink element will include a skiptoken parameter
56
58
  # that specifies a starting point to use for subsequent calls.
59
+ # @param top [Integer] May be used to limit the number of results to the top N
60
+ # results.
57
61
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
58
62
  # will be added to the HTTP request.
59
63
  #
60
64
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
61
65
  #
62
- def get_with_http_info(expand:nil, skiptoken:nil, custom_headers:nil)
63
- get_async(expand:expand, skiptoken:skiptoken, custom_headers:custom_headers).value!
66
+ def get_with_http_info(expand:nil, skiptoken:nil, top:nil, custom_headers:nil)
67
+ get_async(expand:expand, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
64
68
  end
65
69
 
66
70
  #
@@ -74,12 +78,16 @@ module Azure::Consumption::Mgmt::V2018_01_31
74
78
  # returned a partial result. If a previous response contains a nextLink
75
79
  # element, the value of the nextLink element will include a skiptoken parameter
76
80
  # that specifies a starting point to use for subsequent calls.
81
+ # @param top [Integer] May be used to limit the number of results to the top N
82
+ # results.
77
83
  # @param [Hash{String => String}] A hash of custom headers that will be added
78
84
  # to the HTTP request.
79
85
  #
80
86
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
81
87
  #
82
- def get_async(expand:nil, skiptoken:nil, custom_headers:nil)
88
+ def get_async(expand:nil, skiptoken:nil, top:nil, custom_headers:nil)
89
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
90
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
83
91
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
84
92
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
85
93
 
@@ -97,7 +105,7 @@ module Azure::Consumption::Mgmt::V2018_01_31
97
105
  options = {
98
106
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
99
107
  path_params: {'subscriptionId' => @client.subscription_id},
100
- query_params: {'$expand' => expand,'$skiptoken' => skiptoken,'api-version' => @client.api_version},
108
+ query_params: {'$expand' => expand,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version},
101
109
  headers: request_headers.merge(custom_headers || {}),
102
110
  base_url: request_url
103
111
  }
@@ -142,13 +150,15 @@ module Azure::Consumption::Mgmt::V2018_01_31
142
150
  # returned a partial result. If a previous response contains a nextLink
143
151
  # element, the value of the nextLink element will include a skiptoken parameter
144
152
  # that specifies a starting point to use for subsequent calls.
153
+ # @param top [Integer] May be used to limit the number of results to the top N
154
+ # results.
145
155
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
156
  # will be added to the HTTP request.
147
157
  #
148
158
  # @return [PriceSheetResult] operation results.
149
159
  #
150
- def get_by_billing_period(billing_period_name, expand:nil, skiptoken:nil, custom_headers:nil)
151
- response = get_by_billing_period_async(billing_period_name, expand:expand, skiptoken:skiptoken, custom_headers:custom_headers).value!
160
+ def get_by_billing_period(billing_period_name, expand:nil, skiptoken:nil, top:nil, custom_headers:nil)
161
+ response = get_by_billing_period_async(billing_period_name, expand:expand, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
152
162
  response.body unless response.nil?
153
163
  end
154
164
 
@@ -164,13 +174,15 @@ module Azure::Consumption::Mgmt::V2018_01_31
164
174
  # returned a partial result. If a previous response contains a nextLink
165
175
  # element, the value of the nextLink element will include a skiptoken parameter
166
176
  # that specifies a starting point to use for subsequent calls.
177
+ # @param top [Integer] May be used to limit the number of results to the top N
178
+ # results.
167
179
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
168
180
  # will be added to the HTTP request.
169
181
  #
170
182
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
171
183
  #
172
- def get_by_billing_period_with_http_info(billing_period_name, expand:nil, skiptoken:nil, custom_headers:nil)
173
- get_by_billing_period_async(billing_period_name, expand:expand, skiptoken:skiptoken, custom_headers:custom_headers).value!
184
+ def get_by_billing_period_with_http_info(billing_period_name, expand:nil, skiptoken:nil, top:nil, custom_headers:nil)
185
+ get_by_billing_period_async(billing_period_name, expand:expand, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
174
186
  end
175
187
 
176
188
  #
@@ -185,12 +197,16 @@ module Azure::Consumption::Mgmt::V2018_01_31
185
197
  # returned a partial result. If a previous response contains a nextLink
186
198
  # element, the value of the nextLink element will include a skiptoken parameter
187
199
  # that specifies a starting point to use for subsequent calls.
200
+ # @param top [Integer] May be used to limit the number of results to the top N
201
+ # results.
188
202
  # @param [Hash{String => String}] A hash of custom headers that will be added
189
203
  # to the HTTP request.
190
204
  #
191
205
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
192
206
  #
193
- def get_by_billing_period_async(billing_period_name, expand:nil, skiptoken:nil, custom_headers:nil)
207
+ def get_by_billing_period_async(billing_period_name, expand:nil, skiptoken:nil, top:nil, custom_headers:nil)
208
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
209
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
194
210
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
195
211
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
196
212
  fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
@@ -209,7 +225,7 @@ module Azure::Consumption::Mgmt::V2018_01_31
209
225
  options = {
210
226
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
211
227
  path_params: {'subscriptionId' => @client.subscription_id,'billingPeriodName' => billing_period_name},
212
- query_params: {'$expand' => expand,'$skiptoken' => skiptoken,'api-version' => @client.api_version},
228
+ query_params: {'$expand' => expand,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version},
213
229
  headers: request_headers.merge(custom_headers || {}),
214
230
  base_url: request_url
215
231
  }
@@ -0,0 +1,84 @@
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-03-31/generated/azure_mgmt_consumption/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Consumption::Mgmt::V2018_03_31
23
+ autoload :UsageDetails, '2018-03-31/generated/azure_mgmt_consumption/usage_details.rb'
24
+ autoload :UsageDetailsByBillingAccount, '2018-03-31/generated/azure_mgmt_consumption/usage_details_by_billing_account.rb'
25
+ autoload :UsageDetailsByDepartment, '2018-03-31/generated/azure_mgmt_consumption/usage_details_by_department.rb'
26
+ autoload :UsageDetailsByEnrollmentAccount, '2018-03-31/generated/azure_mgmt_consumption/usage_details_by_enrollment_account.rb'
27
+ autoload :Marketplaces, '2018-03-31/generated/azure_mgmt_consumption/marketplaces.rb'
28
+ autoload :MarketplacesByBillingAccount, '2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_billing_account.rb'
29
+ autoload :MarketplacesByDepartment, '2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_department.rb'
30
+ autoload :MarketplacesByEnrollmentAccounts, '2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_enrollment_accounts.rb'
31
+ autoload :GetBalancesByBillingAccount, '2018-03-31/generated/azure_mgmt_consumption/get_balances_by_billing_account.rb'
32
+ autoload :ReservationsSummaries, '2018-03-31/generated/azure_mgmt_consumption/reservations_summaries.rb'
33
+ autoload :ReservationsDetails, '2018-03-31/generated/azure_mgmt_consumption/reservations_details.rb'
34
+ autoload :ReservationRecommendationsOperations, '2018-03-31/generated/azure_mgmt_consumption/reservation_recommendations_operations.rb'
35
+ autoload :Budgets, '2018-03-31/generated/azure_mgmt_consumption/budgets.rb'
36
+ autoload :Operations, '2018-03-31/generated/azure_mgmt_consumption/operations.rb'
37
+ autoload :PriceSheet, '2018-03-31/generated/azure_mgmt_consumption/price_sheet.rb'
38
+ autoload :CostTagsOperations, '2018-03-31/generated/azure_mgmt_consumption/cost_tags_operations.rb'
39
+ autoload :TagsOperations, '2018-03-31/generated/azure_mgmt_consumption/tags_operations.rb'
40
+ autoload :ConsumptionManagementClient, '2018-03-31/generated/azure_mgmt_consumption/consumption_management_client.rb'
41
+
42
+ module Models
43
+ autoload :Filters, '2018-03-31/generated/azure_mgmt_consumption/models/filters.rb'
44
+ autoload :CurrentSpend, '2018-03-31/generated/azure_mgmt_consumption/models/current_spend.rb'
45
+ autoload :Tag, '2018-03-31/generated/azure_mgmt_consumption/models/tag.rb'
46
+ autoload :UsageDetailsListResult, '2018-03-31/generated/azure_mgmt_consumption/models/usage_details_list_result.rb'
47
+ autoload :ResourceAttributes, '2018-03-31/generated/azure_mgmt_consumption/models/resource_attributes.rb'
48
+ autoload :MarketplacesListResult, '2018-03-31/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb'
49
+ autoload :BudgetTimePeriod, '2018-03-31/generated/azure_mgmt_consumption/models/budget_time_period.rb'
50
+ autoload :BalancePropertiesAdjustmentDetailsItem, '2018-03-31/generated/azure_mgmt_consumption/models/balance_properties_adjustment_details_item.rb'
51
+ autoload :MeterDetails, '2018-03-31/generated/azure_mgmt_consumption/models/meter_details.rb'
52
+ autoload :PriceSheetProperties, '2018-03-31/generated/azure_mgmt_consumption/models/price_sheet_properties.rb'
53
+ autoload :Resource, '2018-03-31/generated/azure_mgmt_consumption/models/resource.rb'
54
+ autoload :ProxyResource, '2018-03-31/generated/azure_mgmt_consumption/models/proxy_resource.rb'
55
+ autoload :Notification, '2018-03-31/generated/azure_mgmt_consumption/models/notification.rb'
56
+ autoload :ReservationRecommendations, '2018-03-31/generated/azure_mgmt_consumption/models/reservation_recommendations.rb'
57
+ autoload :OperationListResult, '2018-03-31/generated/azure_mgmt_consumption/models/operation_list_result.rb'
58
+ autoload :BudgetsListResult, '2018-03-31/generated/azure_mgmt_consumption/models/budgets_list_result.rb'
59
+ autoload :QueryOptions, '2018-03-31/generated/azure_mgmt_consumption/models/query_options.rb'
60
+ autoload :CostTag, '2018-03-31/generated/azure_mgmt_consumption/models/cost_tag.rb'
61
+ autoload :ReservationDetailsListResult, '2018-03-31/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb'
62
+ autoload :Operation, '2018-03-31/generated/azure_mgmt_consumption/models/operation.rb'
63
+ autoload :BalancePropertiesNewPurchasesDetailsItem, '2018-03-31/generated/azure_mgmt_consumption/models/balance_properties_new_purchases_details_item.rb'
64
+ autoload :ErrorDetails, '2018-03-31/generated/azure_mgmt_consumption/models/error_details.rb'
65
+ autoload :ReservationRecommendationsListResult, '2018-03-31/generated/azure_mgmt_consumption/models/reservation_recommendations_list_result.rb'
66
+ autoload :ErrorResponse, '2018-03-31/generated/azure_mgmt_consumption/models/error_response.rb'
67
+ autoload :ReservationSummariesListResult, '2018-03-31/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb'
68
+ autoload :OperationDisplay, '2018-03-31/generated/azure_mgmt_consumption/models/operation_display.rb'
69
+ autoload :UsageDetail, '2018-03-31/generated/azure_mgmt_consumption/models/usage_detail.rb'
70
+ autoload :Marketplace, '2018-03-31/generated/azure_mgmt_consumption/models/marketplace.rb'
71
+ autoload :Balance, '2018-03-31/generated/azure_mgmt_consumption/models/balance.rb'
72
+ autoload :ReservationSummaries, '2018-03-31/generated/azure_mgmt_consumption/models/reservation_summaries.rb'
73
+ autoload :ReservationDetails, '2018-03-31/generated/azure_mgmt_consumption/models/reservation_details.rb'
74
+ autoload :Tags, '2018-03-31/generated/azure_mgmt_consumption/models/tags.rb'
75
+ autoload :Budget, '2018-03-31/generated/azure_mgmt_consumption/models/budget.rb'
76
+ autoload :CostTags, '2018-03-31/generated/azure_mgmt_consumption/models/cost_tags.rb'
77
+ autoload :PriceSheetResult, '2018-03-31/generated/azure_mgmt_consumption/models/price_sheet_result.rb'
78
+ autoload :BillingFrequency, '2018-03-31/generated/azure_mgmt_consumption/models/billing_frequency.rb'
79
+ autoload :CategoryType, '2018-03-31/generated/azure_mgmt_consumption/models/category_type.rb'
80
+ autoload :TimeGrainType, '2018-03-31/generated/azure_mgmt_consumption/models/time_grain_type.rb'
81
+ autoload :OperatorType, '2018-03-31/generated/azure_mgmt_consumption/models/operator_type.rb'
82
+ autoload :Datagrain, '2018-03-31/generated/azure_mgmt_consumption/models/datagrain.rb'
83
+ end
84
+ 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_03_31
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_03_31::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_03_31::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_03_31::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_03_31::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_03_31::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_03_31::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_03_31::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_03_31::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_03_31::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_03_31::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_03_31::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_03_31::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