azure_mgmt_cost_management 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2018-05-31/generated/azure_mgmt_cost_management.rb +63 -0
  4. data/lib/2018-05-31/generated/azure_mgmt_cost_management/billing_account_dimensions.rb +149 -0
  5. data/lib/2018-05-31/generated/azure_mgmt_cost_management/cost_management_client.rb +455 -0
  6. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/dimension.rb +154 -0
  7. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/dimensions_list_result.rb +56 -0
  8. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/error_details.rb +59 -0
  9. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/error_response.rb +48 -0
  10. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/format_type.rb +15 -0
  11. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/granularity_type.rb +15 -0
  12. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/operation.rb +59 -0
  13. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/operation_display.rb +72 -0
  14. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/operation_list_result.rb +103 -0
  15. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/query.rb +138 -0
  16. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/query_column.rb +58 -0
  17. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/query_result.rb +57 -0
  18. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/recurrence_type.rb +18 -0
  19. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config.rb +130 -0
  20. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_aggregation.rb +60 -0
  21. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_column_type.rb +16 -0
  22. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_comparison_expression.rb +82 -0
  23. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_dataset.rb +121 -0
  24. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_dataset_configuration.rb +56 -0
  25. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_definition.rb +87 -0
  26. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_delivery_destination.rb +71 -0
  27. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_delivery_info.rb +48 -0
  28. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_filter.rb +121 -0
  29. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_grouping.rb +58 -0
  30. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_list_result.rb +57 -0
  31. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_recurrence_period.rb +58 -0
  32. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_schedule.rb +74 -0
  33. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/report_config_time_period.rb +57 -0
  34. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/resource.rb +100 -0
  35. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/status_type.rb +16 -0
  36. data/lib/2018-05-31/generated/azure_mgmt_cost_management/models/timeframe_type.rb +18 -0
  37. data/lib/2018-05-31/generated/azure_mgmt_cost_management/module_definition.rb +9 -0
  38. data/lib/2018-05-31/generated/azure_mgmt_cost_management/operations.rb +219 -0
  39. data/lib/2018-05-31/generated/azure_mgmt_cost_management/report_config_operations.rb +794 -0
  40. data/lib/2018-05-31/generated/azure_mgmt_cost_management/resource_group_dimensions.rb +150 -0
  41. data/lib/2018-05-31/generated/azure_mgmt_cost_management/subscription_dimensions.rb +146 -0
  42. data/lib/2019-01-01/generated/azure_mgmt_cost_management.rb +69 -0
  43. data/lib/2019-01-01/generated/azure_mgmt_cost_management/cost_management_client.rb +144 -0
  44. data/lib/2019-01-01/generated/azure_mgmt_cost_management/dimensions.rb +182 -0
  45. data/lib/2019-01-01/generated/azure_mgmt_cost_management/exports.rb +754 -0
  46. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/common_export_properties.rb +72 -0
  47. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/dimension.rb +187 -0
  48. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/dimensions_list_result.rb +56 -0
  49. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/error_details.rb +59 -0
  50. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/error_response.rb +48 -0
  51. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/execution_status.rb +21 -0
  52. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/execution_type.rb +16 -0
  53. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/export.rb +128 -0
  54. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/export_delivery_destination.rb +78 -0
  55. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/export_delivery_info.rb +48 -0
  56. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/export_execution.rb +173 -0
  57. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/export_execution_list_result.rb +56 -0
  58. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/export_list_result.rb +57 -0
  59. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/export_recurrence_period.rb +57 -0
  60. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/export_schedule.rb +74 -0
  61. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/format_type.rb +15 -0
  62. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/granularity_type.rb +16 -0
  63. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/operation.rb +59 -0
  64. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/operation_display.rb +72 -0
  65. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/operation_list_result.rb +103 -0
  66. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query.rb +138 -0
  67. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_aggregation.rb +60 -0
  68. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_column.rb +58 -0
  69. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_column_type.rb +16 -0
  70. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_comparison_expression.rb +82 -0
  71. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_dataset.rb +141 -0
  72. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_dataset_configuration.rb +56 -0
  73. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_definition.rb +88 -0
  74. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_filter.rb +120 -0
  75. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_grouping.rb +58 -0
  76. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_result.rb +57 -0
  77. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_sorting_configuration.rb +58 -0
  78. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/query_time_period.rb +57 -0
  79. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/recurrence_type.rb +18 -0
  80. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/resource.rb +100 -0
  81. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/sort_direction.rb +16 -0
  82. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/status_type.rb +16 -0
  83. data/lib/2019-01-01/generated/azure_mgmt_cost_management/models/timeframe_type.rb +23 -0
  84. data/lib/2019-01-01/generated/azure_mgmt_cost_management/module_definition.rb +9 -0
  85. data/lib/2019-01-01/generated/azure_mgmt_cost_management/operations.rb +219 -0
  86. data/lib/2019-01-01/generated/azure_mgmt_cost_management/query_operations.rb +161 -0
  87. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management.rb +82 -0
  88. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/cloud_connector.rb +492 -0
  89. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/cost_management_client.rb +164 -0
  90. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/dimensions.rb +775 -0
  91. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/external_billing_account.rb +207 -0
  92. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/external_subscription.rb +482 -0
  93. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/forecast.rb +755 -0
  94. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/connector_billing_model.rb +18 -0
  95. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/connector_collection_error_info.rb +84 -0
  96. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/connector_collection_info.rb +86 -0
  97. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/connector_definition.rb +261 -0
  98. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/connector_definition_list_result.rb +57 -0
  99. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/connector_status.rb +18 -0
  100. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/cost_allocation_details_kind.rb +131 -0
  101. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/cost_allocation_policy.rb +17 -0
  102. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/custom_price_details_kind.rb +169 -0
  103. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/dimension.rb +187 -0
  104. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/dimensions_list_result.rb +56 -0
  105. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/error_base.rb +72 -0
  106. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/error_details.rb +91 -0
  107. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/error_response.rb +48 -0
  108. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/external_billing_account_definition.rb +133 -0
  109. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/external_billing_account_definition_list_result.rb +59 -0
  110. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/external_subscription_definition.rb +157 -0
  111. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/external_subscription_definition_list_result.rb +58 -0
  112. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/external_subscription_id_list_request.rb +54 -0
  113. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/function_type.rb +18 -0
  114. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/granularity_type.rb +16 -0
  115. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/markup.rb +46 -0
  116. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/operation.rb +59 -0
  117. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/operation_display.rb +72 -0
  118. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/operation_list_result.rb +103 -0
  119. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/operator_type.rb +16 -0
  120. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/query.rb +138 -0
  121. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/query_column.rb +58 -0
  122. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/query_result.rb +57 -0
  123. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_aggregation.rb +60 -0
  124. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_column_type.rb +16 -0
  125. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_comparison_expression.rb +80 -0
  126. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_dataset.rb +142 -0
  127. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_dataset_configuration.rb +56 -0
  128. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_definition.rb +90 -0
  129. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_filter.rb +121 -0
  130. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_grouping.rb +59 -0
  131. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_sorting.rb +58 -0
  132. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/report_config_time_period.rb +57 -0
  133. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/resource.rb +100 -0
  134. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/scope.rb +80 -0
  135. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/showback_rule.rb +173 -0
  136. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/showback_rule_list_result.rb +57 -0
  137. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/showback_rule_properties.rb +138 -0
  138. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/showback_rule_status.rb +16 -0
  139. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/models/timeframe_type.rb +18 -0
  140. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/module_definition.rb +9 -0
  141. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/operations.rb +219 -0
  142. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/query_operations.rb +649 -0
  143. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/showback_rule_operations.rb +222 -0
  144. data/lib/2019-03-01-preview/generated/azure_mgmt_cost_management/showback_rules.rb +114 -0
  145. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management.rb +69 -0
  146. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/budget.rb +460 -0
  147. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/budgets.rb +285 -0
  148. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/cost_management_client.rb +144 -0
  149. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/accumulated_type.rb +16 -0
  150. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/budget_model.rb +170 -0
  151. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/budget_time_period.rb +58 -0
  152. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/budgets_list_result.rb +101 -0
  153. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/category_type.rb +16 -0
  154. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/chart_type.rb +19 -0
  155. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/current_spend.rb +59 -0
  156. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/error_base.rb +72 -0
  157. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/error_details.rb +91 -0
  158. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/error_response.rb +48 -0
  159. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/granularity_type.rb +16 -0
  160. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/kpi_properties.rb +69 -0
  161. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/kpi_type_type.rb +16 -0
  162. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/metric_type.rb +17 -0
  163. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/notification.rb +139 -0
  164. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/notification_operator_type.rb +17 -0
  165. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/operation.rb +59 -0
  166. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/operation_display.rb +72 -0
  167. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/operation_list_result.rb +103 -0
  168. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/operator_type.rb +16 -0
  169. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/pivot_properties.rb +58 -0
  170. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/pivot_type_type.rb +16 -0
  171. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/proxy_resource.rb +84 -0
  172. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/report_config_aggregation.rb +60 -0
  173. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/report_config_column_type.rb +16 -0
  174. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/report_config_comparison_expression.rb +80 -0
  175. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/report_config_dataset.rb +142 -0
  176. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/report_config_dataset_configuration.rb +56 -0
  177. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/report_config_filter.rb +121 -0
  178. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/report_config_grouping.rb +59 -0
  179. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/report_config_sorting.rb +58 -0
  180. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/report_config_time_period.rb +57 -0
  181. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/resource.rb +100 -0
  182. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/scope.rb +80 -0
  183. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/time_grain_type.rb +17 -0
  184. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/timeframe_type.rb +18 -0
  185. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/view.rb +269 -0
  186. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/models/view_list_result.rb +100 -0
  187. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/module_definition.rb +9 -0
  188. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/operations.rb +219 -0
  189. data/lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb +1248 -0
  190. data/lib/azure_mgmt_cost_management.rb +9 -0
  191. data/lib/module_definition.rb +7 -0
  192. data/lib/profiles/latest/costmanagement_latest_profile_client.rb +40 -0
  193. data/lib/profiles/latest/costmanagement_module_definition.rb +8 -0
  194. data/lib/profiles/latest/modules/costmanagement_profile_module.rb +219 -0
  195. data/lib/version.rb +7 -0
  196. metadata +311 -0
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::CostManagement end
8
+ module Azure::CostManagement::Mgmt end
9
+ module Azure::CostManagement::Mgmt::V2019_04_01_preview end
@@ -0,0 +1,219 @@
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::CostManagement::Mgmt::V2019_04_01_preview
7
+ #
8
+ # Operations
9
+ #
10
+ class Operations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Operations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CostManagementClient] reference to the CostManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists all of the available consumption REST API operations.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [Array<Operation>] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ first_page = list_as_lazy(custom_headers:custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # Lists all of the available consumption REST API operations.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Lists all of the available consumption REST API operations.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
59
+
60
+
61
+ request_headers = {}
62
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
+
64
+ # Set Headers
65
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
+ path_template = 'providers/Microsoft.CostManagement/operations'
68
+
69
+ request_url = @base_url || @client.base_url
70
+
71
+ options = {
72
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
73
+ query_params: {'api-version' => @client.api_version},
74
+ headers: request_headers.merge(custom_headers || {}),
75
+ base_url: request_url
76
+ }
77
+ promise = @client.make_request_async(:get, path_template, options)
78
+
79
+ promise = promise.then do |result|
80
+ http_response = result.response
81
+ status_code = http_response.status
82
+ response_content = http_response.body
83
+ unless status_code == 200
84
+ error_model = JSON.load(response_content)
85
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
+ end
87
+
88
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
90
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
91
+ # Deserialize Response
92
+ if status_code == 200
93
+ begin
94
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
95
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::OperationListResult.mapper()
96
+ result.body = @client.deserialize(result_mapper, parsed_response)
97
+ rescue Exception => e
98
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
99
+ end
100
+ end
101
+
102
+ result
103
+ end
104
+
105
+ promise.execute
106
+ end
107
+
108
+ #
109
+ # Lists all of the available consumption REST API operations.
110
+ #
111
+ # @param next_page_link [String] The NextLink from the previous successful call
112
+ # to List operation.
113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
114
+ # will be added to the HTTP request.
115
+ #
116
+ # @return [OperationListResult] operation results.
117
+ #
118
+ def list_next(next_page_link, custom_headers:nil)
119
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
120
+ response.body unless response.nil?
121
+ end
122
+
123
+ #
124
+ # Lists all of the available consumption REST API operations.
125
+ #
126
+ # @param next_page_link [String] The NextLink from the previous successful call
127
+ # to List operation.
128
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
129
+ # will be added to the HTTP request.
130
+ #
131
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
132
+ #
133
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
134
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
135
+ end
136
+
137
+ #
138
+ # Lists all of the available consumption REST API operations.
139
+ #
140
+ # @param next_page_link [String] The NextLink from the previous successful call
141
+ # to List operation.
142
+ # @param [Hash{String => String}] A hash of custom headers that will be added
143
+ # to the HTTP request.
144
+ #
145
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
146
+ #
147
+ def list_next_async(next_page_link, custom_headers:nil)
148
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'
158
+
159
+ request_url = @base_url || @client.base_url
160
+
161
+ options = {
162
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
163
+ skip_encoding_path_params: {'nextLink' => next_page_link},
164
+ headers: request_headers.merge(custom_headers || {}),
165
+ base_url: request_url
166
+ }
167
+ promise = @client.make_request_async(:get, path_template, options)
168
+
169
+ promise = promise.then do |result|
170
+ http_response = result.response
171
+ status_code = http_response.status
172
+ response_content = http_response.body
173
+ unless status_code == 200
174
+ error_model = JSON.load(response_content)
175
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
176
+ end
177
+
178
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
179
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
180
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
181
+ # Deserialize Response
182
+ if status_code == 200
183
+ begin
184
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
185
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::OperationListResult.mapper()
186
+ result.body = @client.deserialize(result_mapper, parsed_response)
187
+ rescue Exception => e
188
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
189
+ end
190
+ end
191
+
192
+ result
193
+ end
194
+
195
+ promise.execute
196
+ end
197
+
198
+ #
199
+ # Lists all of the available consumption REST API operations.
200
+ #
201
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
202
+ # will be added to the HTTP request.
203
+ #
204
+ # @return [OperationListResult] which provide lazy access to pages of the
205
+ # response.
206
+ #
207
+ def list_as_lazy(custom_headers:nil)
208
+ response = list_async(custom_headers:custom_headers).value!
209
+ unless response.nil?
210
+ page = response.body
211
+ page.next_method = Proc.new do |next_page_link|
212
+ list_next_async(next_page_link, custom_headers:custom_headers)
213
+ end
214
+ page
215
+ end
216
+ end
217
+
218
+ end
219
+ end
@@ -0,0 +1,1248 @@
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::CostManagement::Mgmt::V2019_04_01_preview
7
+ #
8
+ # Views
9
+ #
10
+ class Views
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Views class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CostManagementClient] reference to the CostManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists all views by tenant and object.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [Array<View>] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ first_page = list_as_lazy(custom_headers:custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # Lists all views by tenant and object.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Lists all views by tenant and object.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
59
+
60
+
61
+ request_headers = {}
62
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
+
64
+ # Set Headers
65
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
+ path_template = 'providers/Microsoft.CostManagement/views'
68
+
69
+ request_url = @base_url || @client.base_url
70
+
71
+ options = {
72
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
73
+ query_params: {'api-version' => @client.api_version},
74
+ headers: request_headers.merge(custom_headers || {}),
75
+ base_url: request_url
76
+ }
77
+ promise = @client.make_request_async(:get, path_template, options)
78
+
79
+ promise = promise.then do |result|
80
+ http_response = result.response
81
+ status_code = http_response.status
82
+ response_content = http_response.body
83
+ unless status_code == 200
84
+ error_model = JSON.load(response_content)
85
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
+ end
87
+
88
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
90
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
91
+ # Deserialize Response
92
+ if status_code == 200
93
+ begin
94
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
95
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::ViewListResult.mapper()
96
+ result.body = @client.deserialize(result_mapper, parsed_response)
97
+ rescue Exception => e
98
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
99
+ end
100
+ end
101
+
102
+ result
103
+ end
104
+
105
+ promise.execute
106
+ end
107
+
108
+ #
109
+ # Lists all views at the given scope.
110
+ #
111
+ # @param scope [String] The scope associated with view operations. This
112
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
113
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
114
+ # resourceGroup scope,
115
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
116
+ # Account scope,
117
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
118
+ # for Department scope,
119
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
120
+ # for EnrollmentAccount scope,
121
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
122
+ # for BillingProfile scope,
123
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
124
+ # for InvoiceSection scope,
125
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
126
+ # Management Group scope,
127
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
128
+ # for External Billing Account scope and
129
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
130
+ # for External Subscription scope.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [Array<View>] operation results.
135
+ #
136
+ def list_by_scope(scope, custom_headers:nil)
137
+ first_page = list_by_scope_as_lazy(scope, custom_headers:custom_headers)
138
+ first_page.get_all_items
139
+ end
140
+
141
+ #
142
+ # Lists all views at the given scope.
143
+ #
144
+ # @param scope [String] The scope associated with view operations. This
145
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
146
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
147
+ # resourceGroup scope,
148
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
149
+ # Account scope,
150
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
151
+ # for Department scope,
152
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
153
+ # for EnrollmentAccount scope,
154
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
155
+ # for BillingProfile scope,
156
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
157
+ # for InvoiceSection scope,
158
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
159
+ # Management Group scope,
160
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
161
+ # for External Billing Account scope and
162
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
163
+ # for External Subscription scope.
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
168
+ #
169
+ def list_by_scope_with_http_info(scope, custom_headers:nil)
170
+ list_by_scope_async(scope, custom_headers:custom_headers).value!
171
+ end
172
+
173
+ #
174
+ # Lists all views at the given scope.
175
+ #
176
+ # @param scope [String] The scope associated with view operations. This
177
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
178
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
179
+ # resourceGroup scope,
180
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
181
+ # Account scope,
182
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
183
+ # for Department scope,
184
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
185
+ # for EnrollmentAccount scope,
186
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
187
+ # for BillingProfile scope,
188
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
189
+ # for InvoiceSection scope,
190
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
191
+ # Management Group scope,
192
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
193
+ # for External Billing Account scope and
194
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
195
+ # for External Subscription scope.
196
+ # @param [Hash{String => String}] A hash of custom headers that will be added
197
+ # to the HTTP request.
198
+ #
199
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
200
+ #
201
+ def list_by_scope_async(scope, custom_headers:nil)
202
+ fail ArgumentError, 'scope is nil' if scope.nil?
203
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
204
+
205
+
206
+ request_headers = {}
207
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
208
+
209
+ # Set Headers
210
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
211
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
212
+ path_template = '{scope}/providers/Microsoft.CostManagement/views'
213
+
214
+ request_url = @base_url || @client.base_url
215
+
216
+ options = {
217
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
218
+ path_params: {'scope' => scope},
219
+ query_params: {'api-version' => @client.api_version},
220
+ headers: request_headers.merge(custom_headers || {}),
221
+ base_url: request_url
222
+ }
223
+ promise = @client.make_request_async(:get, path_template, options)
224
+
225
+ promise = promise.then do |result|
226
+ http_response = result.response
227
+ status_code = http_response.status
228
+ response_content = http_response.body
229
+ unless status_code == 200
230
+ error_model = JSON.load(response_content)
231
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
232
+ end
233
+
234
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
235
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
236
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
237
+ # Deserialize Response
238
+ if status_code == 200
239
+ begin
240
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
241
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::ViewListResult.mapper()
242
+ result.body = @client.deserialize(result_mapper, parsed_response)
243
+ rescue Exception => e
244
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
245
+ end
246
+ end
247
+
248
+ result
249
+ end
250
+
251
+ promise.execute
252
+ end
253
+
254
+ #
255
+ # Gets the view by view name.
256
+ #
257
+ # @param view_name [String] View name
258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
259
+ # will be added to the HTTP request.
260
+ #
261
+ # @return [View] operation results.
262
+ #
263
+ def get(view_name, custom_headers:nil)
264
+ response = get_async(view_name, custom_headers:custom_headers).value!
265
+ response.body unless response.nil?
266
+ end
267
+
268
+ #
269
+ # Gets the view by view name.
270
+ #
271
+ # @param view_name [String] View name
272
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
273
+ # will be added to the HTTP request.
274
+ #
275
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
276
+ #
277
+ def get_with_http_info(view_name, custom_headers:nil)
278
+ get_async(view_name, custom_headers:custom_headers).value!
279
+ end
280
+
281
+ #
282
+ # Gets the view by view name.
283
+ #
284
+ # @param view_name [String] View name
285
+ # @param [Hash{String => String}] A hash of custom headers that will be added
286
+ # to the HTTP request.
287
+ #
288
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
289
+ #
290
+ def get_async(view_name, custom_headers:nil)
291
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
292
+ fail ArgumentError, 'view_name is nil' if view_name.nil?
293
+
294
+
295
+ request_headers = {}
296
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
297
+
298
+ # Set Headers
299
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
300
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
301
+ path_template = 'providers/Microsoft.CostManagement/views/{viewName}'
302
+
303
+ request_url = @base_url || @client.base_url
304
+
305
+ options = {
306
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
307
+ path_params: {'viewName' => view_name},
308
+ query_params: {'api-version' => @client.api_version},
309
+ headers: request_headers.merge(custom_headers || {}),
310
+ base_url: request_url
311
+ }
312
+ promise = @client.make_request_async(:get, path_template, options)
313
+
314
+ promise = promise.then do |result|
315
+ http_response = result.response
316
+ status_code = http_response.status
317
+ response_content = http_response.body
318
+ unless status_code == 200
319
+ error_model = JSON.load(response_content)
320
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
321
+ end
322
+
323
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
324
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
325
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
326
+ # Deserialize Response
327
+ if status_code == 200
328
+ begin
329
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
330
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.mapper()
331
+ result.body = @client.deserialize(result_mapper, parsed_response)
332
+ rescue Exception => e
333
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
334
+ end
335
+ end
336
+
337
+ result
338
+ end
339
+
340
+ promise.execute
341
+ end
342
+
343
+ #
344
+ # The operation to create or update a view. Update operation requires latest
345
+ # eTag to be set in the request. You may obtain the latest eTag by performing a
346
+ # get operation. Create operation does not require eTag.
347
+ #
348
+ # @param view_name [String] View name
349
+ # @param parameters [View] Parameters supplied to the CreateOrUpdate View
350
+ # operation.
351
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
352
+ # will be added to the HTTP request.
353
+ #
354
+ # @return [View] operation results.
355
+ #
356
+ def create_or_update(view_name, parameters, custom_headers:nil)
357
+ response = create_or_update_async(view_name, parameters, custom_headers:custom_headers).value!
358
+ response.body unless response.nil?
359
+ end
360
+
361
+ #
362
+ # The operation to create or update a view. Update operation requires latest
363
+ # eTag to be set in the request. You may obtain the latest eTag by performing a
364
+ # get operation. Create operation does not require eTag.
365
+ #
366
+ # @param view_name [String] View name
367
+ # @param parameters [View] Parameters supplied to the CreateOrUpdate View
368
+ # operation.
369
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
370
+ # will be added to the HTTP request.
371
+ #
372
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
373
+ #
374
+ def create_or_update_with_http_info(view_name, parameters, custom_headers:nil)
375
+ create_or_update_async(view_name, parameters, custom_headers:custom_headers).value!
376
+ end
377
+
378
+ #
379
+ # The operation to create or update a view. Update operation requires latest
380
+ # eTag to be set in the request. You may obtain the latest eTag by performing a
381
+ # get operation. Create operation does not require eTag.
382
+ #
383
+ # @param view_name [String] View name
384
+ # @param parameters [View] Parameters supplied to the CreateOrUpdate View
385
+ # operation.
386
+ # @param [Hash{String => String}] A hash of custom headers that will be added
387
+ # to the HTTP request.
388
+ #
389
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
390
+ #
391
+ def create_or_update_async(view_name, parameters, custom_headers:nil)
392
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
393
+ fail ArgumentError, 'view_name is nil' if view_name.nil?
394
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
395
+
396
+
397
+ request_headers = {}
398
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
399
+
400
+ # Set Headers
401
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
402
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
403
+
404
+ # Serialize Request
405
+ request_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.mapper()
406
+ request_content = @client.serialize(request_mapper, parameters)
407
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
408
+
409
+ path_template = 'providers/Microsoft.CostManagement/views/{viewName}'
410
+
411
+ request_url = @base_url || @client.base_url
412
+
413
+ options = {
414
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
415
+ path_params: {'viewName' => view_name},
416
+ query_params: {'api-version' => @client.api_version},
417
+ body: request_content,
418
+ headers: request_headers.merge(custom_headers || {}),
419
+ base_url: request_url
420
+ }
421
+ promise = @client.make_request_async(:put, path_template, options)
422
+
423
+ promise = promise.then do |result|
424
+ http_response = result.response
425
+ status_code = http_response.status
426
+ response_content = http_response.body
427
+ unless status_code == 200 || status_code == 201
428
+ error_model = JSON.load(response_content)
429
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
430
+ end
431
+
432
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
433
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
434
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
435
+ # Deserialize Response
436
+ if status_code == 200
437
+ begin
438
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
439
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.mapper()
440
+ result.body = @client.deserialize(result_mapper, parsed_response)
441
+ rescue Exception => e
442
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
443
+ end
444
+ end
445
+ # Deserialize Response
446
+ if status_code == 201
447
+ begin
448
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
449
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.mapper()
450
+ result.body = @client.deserialize(result_mapper, parsed_response)
451
+ rescue Exception => e
452
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
453
+ end
454
+ end
455
+
456
+ result
457
+ end
458
+
459
+ promise.execute
460
+ end
461
+
462
+ #
463
+ # The operation to delete a view.
464
+ #
465
+ # @param view_name [String] View name
466
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
467
+ # will be added to the HTTP request.
468
+ #
469
+ #
470
+ def delete(view_name, custom_headers:nil)
471
+ response = delete_async(view_name, custom_headers:custom_headers).value!
472
+ nil
473
+ end
474
+
475
+ #
476
+ # The operation to delete a view.
477
+ #
478
+ # @param view_name [String] View name
479
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
480
+ # will be added to the HTTP request.
481
+ #
482
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
483
+ #
484
+ def delete_with_http_info(view_name, custom_headers:nil)
485
+ delete_async(view_name, custom_headers:custom_headers).value!
486
+ end
487
+
488
+ #
489
+ # The operation to delete a view.
490
+ #
491
+ # @param view_name [String] View name
492
+ # @param [Hash{String => String}] A hash of custom headers that will be added
493
+ # to the HTTP request.
494
+ #
495
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
496
+ #
497
+ def delete_async(view_name, custom_headers:nil)
498
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
499
+ fail ArgumentError, 'view_name is nil' if view_name.nil?
500
+
501
+
502
+ request_headers = {}
503
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
504
+
505
+ # Set Headers
506
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
507
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
508
+ path_template = 'providers/Microsoft.CostManagement/views/{viewName}'
509
+
510
+ request_url = @base_url || @client.base_url
511
+
512
+ options = {
513
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
514
+ path_params: {'viewName' => view_name},
515
+ query_params: {'api-version' => @client.api_version},
516
+ headers: request_headers.merge(custom_headers || {}),
517
+ base_url: request_url
518
+ }
519
+ promise = @client.make_request_async(:delete, path_template, options)
520
+
521
+ promise = promise.then do |result|
522
+ http_response = result.response
523
+ status_code = http_response.status
524
+ response_content = http_response.body
525
+ unless status_code == 200 || status_code == 204
526
+ error_model = JSON.load(response_content)
527
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
528
+ end
529
+
530
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
531
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
532
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
533
+
534
+ result
535
+ end
536
+
537
+ promise.execute
538
+ end
539
+
540
+ #
541
+ # Gets the view for the defined scope by view name.
542
+ #
543
+ # @param scope [String] The scope associated with view operations. This
544
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
545
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
546
+ # resourceGroup scope,
547
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
548
+ # Account scope,
549
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
550
+ # for Department scope,
551
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
552
+ # for EnrollmentAccount scope,
553
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
554
+ # for BillingProfile scope,
555
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
556
+ # for InvoiceSection scope,
557
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
558
+ # Management Group scope,
559
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
560
+ # for External Billing Account scope and
561
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
562
+ # for External Subscription scope.
563
+ # @param view_name [String] View name
564
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
565
+ # will be added to the HTTP request.
566
+ #
567
+ # @return [View] operation results.
568
+ #
569
+ def get_by_scope(scope, view_name, custom_headers:nil)
570
+ response = get_by_scope_async(scope, view_name, custom_headers:custom_headers).value!
571
+ response.body unless response.nil?
572
+ end
573
+
574
+ #
575
+ # Gets the view for the defined scope by view name.
576
+ #
577
+ # @param scope [String] The scope associated with view operations. This
578
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
579
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
580
+ # resourceGroup scope,
581
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
582
+ # Account scope,
583
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
584
+ # for Department scope,
585
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
586
+ # for EnrollmentAccount scope,
587
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
588
+ # for BillingProfile scope,
589
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
590
+ # for InvoiceSection scope,
591
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
592
+ # Management Group scope,
593
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
594
+ # for External Billing Account scope and
595
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
596
+ # for External Subscription scope.
597
+ # @param view_name [String] View name
598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
599
+ # will be added to the HTTP request.
600
+ #
601
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
602
+ #
603
+ def get_by_scope_with_http_info(scope, view_name, custom_headers:nil)
604
+ get_by_scope_async(scope, view_name, custom_headers:custom_headers).value!
605
+ end
606
+
607
+ #
608
+ # Gets the view for the defined scope by view name.
609
+ #
610
+ # @param scope [String] The scope associated with view operations. This
611
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
612
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
613
+ # resourceGroup scope,
614
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
615
+ # Account scope,
616
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
617
+ # for Department scope,
618
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
619
+ # for EnrollmentAccount scope,
620
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
621
+ # for BillingProfile scope,
622
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
623
+ # for InvoiceSection scope,
624
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
625
+ # Management Group scope,
626
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
627
+ # for External Billing Account scope and
628
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
629
+ # for External Subscription scope.
630
+ # @param view_name [String] View name
631
+ # @param [Hash{String => String}] A hash of custom headers that will be added
632
+ # to the HTTP request.
633
+ #
634
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
635
+ #
636
+ def get_by_scope_async(scope, view_name, custom_headers:nil)
637
+ fail ArgumentError, 'scope is nil' if scope.nil?
638
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
639
+ fail ArgumentError, 'view_name is nil' if view_name.nil?
640
+
641
+
642
+ request_headers = {}
643
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
644
+
645
+ # Set Headers
646
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
647
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
648
+ path_template = '{scope}/providers/Microsoft.CostManagement/views/{viewName}'
649
+
650
+ request_url = @base_url || @client.base_url
651
+
652
+ options = {
653
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
654
+ path_params: {'scope' => scope,'viewName' => view_name},
655
+ query_params: {'api-version' => @client.api_version},
656
+ headers: request_headers.merge(custom_headers || {}),
657
+ base_url: request_url
658
+ }
659
+ promise = @client.make_request_async(:get, path_template, options)
660
+
661
+ promise = promise.then do |result|
662
+ http_response = result.response
663
+ status_code = http_response.status
664
+ response_content = http_response.body
665
+ unless status_code == 200
666
+ error_model = JSON.load(response_content)
667
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
668
+ end
669
+
670
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
671
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
672
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
673
+ # Deserialize Response
674
+ if status_code == 200
675
+ begin
676
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
677
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.mapper()
678
+ result.body = @client.deserialize(result_mapper, parsed_response)
679
+ rescue Exception => e
680
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
681
+ end
682
+ end
683
+
684
+ result
685
+ end
686
+
687
+ promise.execute
688
+ end
689
+
690
+ #
691
+ # The operation to create or update a view. Update operation requires latest
692
+ # eTag to be set in the request. You may obtain the latest eTag by performing a
693
+ # get operation. Create operation does not require eTag.
694
+ #
695
+ # @param scope [String] The scope associated with view operations. This
696
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
697
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
698
+ # resourceGroup scope,
699
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
700
+ # Account scope,
701
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
702
+ # for Department scope,
703
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
704
+ # for EnrollmentAccount scope,
705
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
706
+ # for BillingProfile scope,
707
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
708
+ # for InvoiceSection scope,
709
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
710
+ # Management Group scope,
711
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
712
+ # for External Billing Account scope and
713
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
714
+ # for External Subscription scope.
715
+ # @param view_name [String] View name
716
+ # @param parameters [View] Parameters supplied to the CreateOrUpdate View
717
+ # operation.
718
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
719
+ # will be added to the HTTP request.
720
+ #
721
+ # @return [View] operation results.
722
+ #
723
+ def create_or_update_by_scope(scope, view_name, parameters, custom_headers:nil)
724
+ response = create_or_update_by_scope_async(scope, view_name, parameters, custom_headers:custom_headers).value!
725
+ response.body unless response.nil?
726
+ end
727
+
728
+ #
729
+ # The operation to create or update a view. Update operation requires latest
730
+ # eTag to be set in the request. You may obtain the latest eTag by performing a
731
+ # get operation. Create operation does not require eTag.
732
+ #
733
+ # @param scope [String] The scope associated with view operations. This
734
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
735
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
736
+ # resourceGroup scope,
737
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
738
+ # Account scope,
739
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
740
+ # for Department scope,
741
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
742
+ # for EnrollmentAccount scope,
743
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
744
+ # for BillingProfile scope,
745
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
746
+ # for InvoiceSection scope,
747
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
748
+ # Management Group scope,
749
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
750
+ # for External Billing Account scope and
751
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
752
+ # for External Subscription scope.
753
+ # @param view_name [String] View name
754
+ # @param parameters [View] Parameters supplied to the CreateOrUpdate View
755
+ # operation.
756
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
757
+ # will be added to the HTTP request.
758
+ #
759
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
760
+ #
761
+ def create_or_update_by_scope_with_http_info(scope, view_name, parameters, custom_headers:nil)
762
+ create_or_update_by_scope_async(scope, view_name, parameters, custom_headers:custom_headers).value!
763
+ end
764
+
765
+ #
766
+ # The operation to create or update a view. Update operation requires latest
767
+ # eTag to be set in the request. You may obtain the latest eTag by performing a
768
+ # get operation. Create operation does not require eTag.
769
+ #
770
+ # @param scope [String] The scope associated with view operations. This
771
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
772
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
773
+ # resourceGroup scope,
774
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
775
+ # Account scope,
776
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
777
+ # for Department scope,
778
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
779
+ # for EnrollmentAccount scope,
780
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
781
+ # for BillingProfile scope,
782
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
783
+ # for InvoiceSection scope,
784
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
785
+ # Management Group scope,
786
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
787
+ # for External Billing Account scope and
788
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
789
+ # for External Subscription scope.
790
+ # @param view_name [String] View name
791
+ # @param parameters [View] Parameters supplied to the CreateOrUpdate View
792
+ # operation.
793
+ # @param [Hash{String => String}] A hash of custom headers that will be added
794
+ # to the HTTP request.
795
+ #
796
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
797
+ #
798
+ def create_or_update_by_scope_async(scope, view_name, parameters, custom_headers:nil)
799
+ fail ArgumentError, 'scope is nil' if scope.nil?
800
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
801
+ fail ArgumentError, 'view_name is nil' if view_name.nil?
802
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
803
+
804
+
805
+ request_headers = {}
806
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
807
+
808
+ # Set Headers
809
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
810
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
811
+
812
+ # Serialize Request
813
+ request_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.mapper()
814
+ request_content = @client.serialize(request_mapper, parameters)
815
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
816
+
817
+ path_template = '{scope}/providers/Microsoft.CostManagement/views/{viewName}'
818
+
819
+ request_url = @base_url || @client.base_url
820
+
821
+ options = {
822
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
823
+ path_params: {'scope' => scope,'viewName' => view_name},
824
+ query_params: {'api-version' => @client.api_version},
825
+ body: request_content,
826
+ headers: request_headers.merge(custom_headers || {}),
827
+ base_url: request_url
828
+ }
829
+ promise = @client.make_request_async(:put, path_template, options)
830
+
831
+ promise = promise.then do |result|
832
+ http_response = result.response
833
+ status_code = http_response.status
834
+ response_content = http_response.body
835
+ unless status_code == 200 || status_code == 201
836
+ error_model = JSON.load(response_content)
837
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
838
+ end
839
+
840
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
841
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
842
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
843
+ # Deserialize Response
844
+ if status_code == 200
845
+ begin
846
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
847
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.mapper()
848
+ result.body = @client.deserialize(result_mapper, parsed_response)
849
+ rescue Exception => e
850
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
851
+ end
852
+ end
853
+ # Deserialize Response
854
+ if status_code == 201
855
+ begin
856
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
857
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.mapper()
858
+ result.body = @client.deserialize(result_mapper, parsed_response)
859
+ rescue Exception => e
860
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
861
+ end
862
+ end
863
+
864
+ result
865
+ end
866
+
867
+ promise.execute
868
+ end
869
+
870
+ #
871
+ # The operation to delete a view.
872
+ #
873
+ # @param scope [String] The scope associated with view operations. This
874
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
875
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
876
+ # resourceGroup scope,
877
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
878
+ # Account scope,
879
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
880
+ # for Department scope,
881
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
882
+ # for EnrollmentAccount scope,
883
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
884
+ # for BillingProfile scope,
885
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
886
+ # for InvoiceSection scope,
887
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
888
+ # Management Group scope,
889
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
890
+ # for External Billing Account scope and
891
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
892
+ # for External Subscription scope.
893
+ # @param view_name [String] View name
894
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
895
+ # will be added to the HTTP request.
896
+ #
897
+ #
898
+ def delete_by_scope(scope, view_name, custom_headers:nil)
899
+ response = delete_by_scope_async(scope, view_name, custom_headers:custom_headers).value!
900
+ nil
901
+ end
902
+
903
+ #
904
+ # The operation to delete a view.
905
+ #
906
+ # @param scope [String] The scope associated with view operations. This
907
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
908
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
909
+ # resourceGroup scope,
910
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
911
+ # Account scope,
912
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
913
+ # for Department scope,
914
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
915
+ # for EnrollmentAccount scope,
916
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
917
+ # for BillingProfile scope,
918
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
919
+ # for InvoiceSection scope,
920
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
921
+ # Management Group scope,
922
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
923
+ # for External Billing Account scope and
924
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
925
+ # for External Subscription scope.
926
+ # @param view_name [String] View name
927
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
928
+ # will be added to the HTTP request.
929
+ #
930
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
931
+ #
932
+ def delete_by_scope_with_http_info(scope, view_name, custom_headers:nil)
933
+ delete_by_scope_async(scope, view_name, custom_headers:custom_headers).value!
934
+ end
935
+
936
+ #
937
+ # The operation to delete a view.
938
+ #
939
+ # @param scope [String] The scope associated with view operations. This
940
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
941
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
942
+ # resourceGroup scope,
943
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
944
+ # Account scope,
945
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
946
+ # for Department scope,
947
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
948
+ # for EnrollmentAccount scope,
949
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
950
+ # for BillingProfile scope,
951
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
952
+ # for InvoiceSection scope,
953
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
954
+ # Management Group scope,
955
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
956
+ # for External Billing Account scope and
957
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
958
+ # for External Subscription scope.
959
+ # @param view_name [String] View name
960
+ # @param [Hash{String => String}] A hash of custom headers that will be added
961
+ # to the HTTP request.
962
+ #
963
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
964
+ #
965
+ def delete_by_scope_async(scope, view_name, custom_headers:nil)
966
+ fail ArgumentError, 'scope is nil' if scope.nil?
967
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
968
+ fail ArgumentError, 'view_name is nil' if view_name.nil?
969
+
970
+
971
+ request_headers = {}
972
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
973
+
974
+ # Set Headers
975
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
976
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
977
+ path_template = '{scope}/providers/Microsoft.CostManagement/views/{viewName}'
978
+
979
+ request_url = @base_url || @client.base_url
980
+
981
+ options = {
982
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
983
+ path_params: {'scope' => scope,'viewName' => view_name},
984
+ query_params: {'api-version' => @client.api_version},
985
+ headers: request_headers.merge(custom_headers || {}),
986
+ base_url: request_url
987
+ }
988
+ promise = @client.make_request_async(:delete, path_template, options)
989
+
990
+ promise = promise.then do |result|
991
+ http_response = result.response
992
+ status_code = http_response.status
993
+ response_content = http_response.body
994
+ unless status_code == 200 || status_code == 204
995
+ error_model = JSON.load(response_content)
996
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
997
+ end
998
+
999
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1000
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1001
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1002
+
1003
+ result
1004
+ end
1005
+
1006
+ promise.execute
1007
+ end
1008
+
1009
+ #
1010
+ # Lists all views by tenant and object.
1011
+ #
1012
+ # @param next_page_link [String] The NextLink from the previous successful call
1013
+ # to List operation.
1014
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1015
+ # will be added to the HTTP request.
1016
+ #
1017
+ # @return [ViewListResult] operation results.
1018
+ #
1019
+ def list_next(next_page_link, custom_headers:nil)
1020
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
1021
+ response.body unless response.nil?
1022
+ end
1023
+
1024
+ #
1025
+ # Lists all views by tenant and object.
1026
+ #
1027
+ # @param next_page_link [String] The NextLink from the previous successful call
1028
+ # to List operation.
1029
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1030
+ # will be added to the HTTP request.
1031
+ #
1032
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1033
+ #
1034
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
1035
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
1036
+ end
1037
+
1038
+ #
1039
+ # Lists all views by tenant and object.
1040
+ #
1041
+ # @param next_page_link [String] The NextLink from the previous successful call
1042
+ # to List operation.
1043
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1044
+ # to the HTTP request.
1045
+ #
1046
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1047
+ #
1048
+ def list_next_async(next_page_link, custom_headers:nil)
1049
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1050
+
1051
+
1052
+ request_headers = {}
1053
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1054
+
1055
+ # Set Headers
1056
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1057
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1058
+ path_template = '{nextLink}'
1059
+
1060
+ request_url = @base_url || @client.base_url
1061
+
1062
+ options = {
1063
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1064
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1065
+ headers: request_headers.merge(custom_headers || {}),
1066
+ base_url: request_url
1067
+ }
1068
+ promise = @client.make_request_async(:get, path_template, options)
1069
+
1070
+ promise = promise.then do |result|
1071
+ http_response = result.response
1072
+ status_code = http_response.status
1073
+ response_content = http_response.body
1074
+ unless status_code == 200
1075
+ error_model = JSON.load(response_content)
1076
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1077
+ end
1078
+
1079
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1080
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1081
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1082
+ # Deserialize Response
1083
+ if status_code == 200
1084
+ begin
1085
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1086
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::ViewListResult.mapper()
1087
+ result.body = @client.deserialize(result_mapper, parsed_response)
1088
+ rescue Exception => e
1089
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1090
+ end
1091
+ end
1092
+
1093
+ result
1094
+ end
1095
+
1096
+ promise.execute
1097
+ end
1098
+
1099
+ #
1100
+ # Lists all views at the given scope.
1101
+ #
1102
+ # @param next_page_link [String] The NextLink from the previous successful call
1103
+ # to List operation.
1104
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1105
+ # will be added to the HTTP request.
1106
+ #
1107
+ # @return [ViewListResult] operation results.
1108
+ #
1109
+ def list_by_scope_next(next_page_link, custom_headers:nil)
1110
+ response = list_by_scope_next_async(next_page_link, custom_headers:custom_headers).value!
1111
+ response.body unless response.nil?
1112
+ end
1113
+
1114
+ #
1115
+ # Lists all views at the given scope.
1116
+ #
1117
+ # @param next_page_link [String] The NextLink from the previous successful call
1118
+ # to List operation.
1119
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1120
+ # will be added to the HTTP request.
1121
+ #
1122
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1123
+ #
1124
+ def list_by_scope_next_with_http_info(next_page_link, custom_headers:nil)
1125
+ list_by_scope_next_async(next_page_link, custom_headers:custom_headers).value!
1126
+ end
1127
+
1128
+ #
1129
+ # Lists all views at the given scope.
1130
+ #
1131
+ # @param next_page_link [String] The NextLink from the previous successful call
1132
+ # to List operation.
1133
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1134
+ # to the HTTP request.
1135
+ #
1136
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1137
+ #
1138
+ def list_by_scope_next_async(next_page_link, custom_headers:nil)
1139
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1140
+
1141
+
1142
+ request_headers = {}
1143
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1144
+
1145
+ # Set Headers
1146
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1147
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1148
+ path_template = '{nextLink}'
1149
+
1150
+ request_url = @base_url || @client.base_url
1151
+
1152
+ options = {
1153
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1154
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1155
+ headers: request_headers.merge(custom_headers || {}),
1156
+ base_url: request_url
1157
+ }
1158
+ promise = @client.make_request_async(:get, path_template, options)
1159
+
1160
+ promise = promise.then do |result|
1161
+ http_response = result.response
1162
+ status_code = http_response.status
1163
+ response_content = http_response.body
1164
+ unless status_code == 200
1165
+ error_model = JSON.load(response_content)
1166
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1167
+ end
1168
+
1169
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1170
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1171
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1172
+ # Deserialize Response
1173
+ if status_code == 200
1174
+ begin
1175
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1176
+ result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::ViewListResult.mapper()
1177
+ result.body = @client.deserialize(result_mapper, parsed_response)
1178
+ rescue Exception => e
1179
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1180
+ end
1181
+ end
1182
+
1183
+ result
1184
+ end
1185
+
1186
+ promise.execute
1187
+ end
1188
+
1189
+ #
1190
+ # Lists all views by tenant and object.
1191
+ #
1192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1193
+ # will be added to the HTTP request.
1194
+ #
1195
+ # @return [ViewListResult] which provide lazy access to pages of the response.
1196
+ #
1197
+ def list_as_lazy(custom_headers:nil)
1198
+ response = list_async(custom_headers:custom_headers).value!
1199
+ unless response.nil?
1200
+ page = response.body
1201
+ page.next_method = Proc.new do |next_page_link|
1202
+ list_next_async(next_page_link, custom_headers:custom_headers)
1203
+ end
1204
+ page
1205
+ end
1206
+ end
1207
+
1208
+ #
1209
+ # Lists all views at the given scope.
1210
+ #
1211
+ # @param scope [String] The scope associated with view operations. This
1212
+ # includes 'subscriptions/{subscriptionId}' for subscription scope,
1213
+ # 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
1214
+ # resourceGroup scope,
1215
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing
1216
+ # Account scope,
1217
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
1218
+ # for Department scope,
1219
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
1220
+ # for EnrollmentAccount scope,
1221
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
1222
+ # for BillingProfile scope,
1223
+ # 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
1224
+ # for InvoiceSection scope,
1225
+ # 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
1226
+ # Management Group scope,
1227
+ # 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
1228
+ # for External Billing Account scope and
1229
+ # 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
1230
+ # for External Subscription scope.
1231
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1232
+ # will be added to the HTTP request.
1233
+ #
1234
+ # @return [ViewListResult] which provide lazy access to pages of the response.
1235
+ #
1236
+ def list_by_scope_as_lazy(scope, custom_headers:nil)
1237
+ response = list_by_scope_async(scope, custom_headers:custom_headers).value!
1238
+ unless response.nil?
1239
+ page = response.body
1240
+ page.next_method = Proc.new do |next_page_link|
1241
+ list_by_scope_next_async(next_page_link, custom_headers:custom_headers)
1242
+ end
1243
+ page
1244
+ end
1245
+ end
1246
+
1247
+ end
1248
+ end