azure_mgmt_consumption 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  3. data/lib/2017-11-30/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  4. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  5. data/lib/2018-01-31/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  6. data/lib/2018-01-31/generated/azure_mgmt_consumption/price_sheet.rb +28 -12
  7. data/lib/2018-03-31/generated/azure_mgmt_consumption.rb +84 -0
  8. data/lib/2018-03-31/generated/azure_mgmt_consumption/budgets.rb +993 -0
  9. data/lib/2018-03-31/generated/azure_mgmt_consumption/consumption_management_client.rb +289 -0
  10. data/lib/2018-03-31/generated/azure_mgmt_consumption/cost_tags_operations.rb +233 -0
  11. data/lib/2018-03-31/generated/azure_mgmt_consumption/get_balances_by_billing_account.rb +120 -0
  12. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces.rb +528 -0
  13. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_billing_account.rb +536 -0
  14. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_department.rb +536 -0
  15. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_enrollment_accounts.rb +536 -0
  16. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/balance.rb +281 -0
  17. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/balance_properties_adjustment_details_item.rb +60 -0
  18. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/balance_properties_new_purchases_details_item.rb +60 -0
  19. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/billing_frequency.rb +17 -0
  20. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/budget.rb +171 -0
  21. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
  22. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/budgets_list_result.rb +101 -0
  23. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/category_type.rb +16 -0
  24. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/cost_tag.rb +46 -0
  25. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/cost_tags.rb +90 -0
  26. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
  27. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
  28. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  29. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  30. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/filters.rb +134 -0
  31. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/marketplace.rb +375 -0
  32. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb +101 -0
  33. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/meter_details.rb +122 -0
  34. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/notification.rb +139 -0
  35. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  36. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  37. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  38. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
  39. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +134 -0
  40. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  41. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
  42. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/query_options.rb +45 -0
  43. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_details.rb +187 -0
  44. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +100 -0
  45. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_recommendations.rb +224 -0
  46. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_recommendations_list_result.rb +101 -0
  47. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_summaries.rb +205 -0
  48. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +101 -0
  49. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  50. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/resource_attributes.rb +59 -0
  51. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/tag.rb +46 -0
  52. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/tags.rb +90 -0
  53. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
  54. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/usage_detail.rb +355 -0
  55. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  56. data/lib/2018-03-31/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  57. data/lib/2018-03-31/generated/azure_mgmt_consumption/operations.rb +216 -0
  58. data/lib/2018-03-31/generated/azure_mgmt_consumption/price_sheet.rb +262 -0
  59. data/lib/2018-03-31/generated/azure_mgmt_consumption/reservation_recommendations_operations.rb +226 -0
  60. data/lib/2018-03-31/generated/azure_mgmt_consumption/reservations_details.rb +449 -0
  61. data/lib/2018-03-31/generated/azure_mgmt_consumption/reservations_summaries.rb +465 -0
  62. data/lib/2018-03-31/generated/azure_mgmt_consumption/tags_operations.rb +113 -0
  63. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details.rb +577 -0
  64. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details_by_billing_account.rb +599 -0
  65. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details_by_department.rb +592 -0
  66. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details_by_enrollment_account.rb +599 -0
  67. data/lib/2018-05-31/generated/azure_mgmt_consumption.rb +49 -0
  68. data/lib/2018-05-31/generated/azure_mgmt_consumption/consumption_management_client.rb +144 -0
  69. data/lib/2018-05-31/generated/azure_mgmt_consumption/forecasts.rb +122 -0
  70. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/bound.rb +16 -0
  71. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/charge_type.rb +16 -0
  72. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  73. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  74. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/forecast.rb +163 -0
  75. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/forecast_properties_confidence_levels_item.rb +72 -0
  76. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/forecasts_list_result.rb +56 -0
  77. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/grain.rb +17 -0
  78. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/meter_details.rb +122 -0
  79. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  80. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  81. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  82. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +146 -0
  83. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  84. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/query_options.rb +45 -0
  85. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  86. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/usage_detail.rb +403 -0
  87. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  88. data/lib/2018-05-31/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  89. data/lib/2018-05-31/generated/azure_mgmt_consumption/operations.rb +216 -0
  90. data/lib/2018-05-31/generated/azure_mgmt_consumption/price_sheet.rb +262 -0
  91. data/lib/2018-05-31/generated/azure_mgmt_consumption/usage_details.rb +2289 -0
  92. data/lib/2018-06-30/generated/azure_mgmt_consumption.rb +85 -0
  93. data/lib/2018-06-30/generated/azure_mgmt_consumption/balances.rb +210 -0
  94. data/lib/2018-06-30/generated/azure_mgmt_consumption/budgets.rb +993 -0
  95. data/lib/2018-06-30/generated/azure_mgmt_consumption/consumption_management_client.rb +176 -0
  96. data/lib/2018-06-30/generated/azure_mgmt_consumption/cost_tags.rb +233 -0
  97. data/lib/2018-06-30/generated/azure_mgmt_consumption/forecasts.rb +122 -0
  98. data/lib/2018-06-30/generated/azure_mgmt_consumption/marketplaces.rb +2058 -0
  99. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/balance.rb +281 -0
  100. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/balance_properties_adjustment_details_item.rb +60 -0
  101. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/balance_properties_new_purchases_details_item.rb +60 -0
  102. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/billing_frequency.rb +17 -0
  103. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/bound.rb +16 -0
  104. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/budget.rb +171 -0
  105. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
  106. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/budgets_list_result.rb +101 -0
  107. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/category_type.rb +16 -0
  108. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/charge_type.rb +16 -0
  109. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/cost_tag.rb +90 -0
  110. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/cost_tag_properties.rb +46 -0
  111. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
  112. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
  113. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  114. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  115. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/filters.rb +134 -0
  116. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/forecast.rb +163 -0
  117. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/forecast_properties_confidence_levels_item.rb +72 -0
  118. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/forecasts_list_result.rb +56 -0
  119. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/grain.rb +17 -0
  120. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/marketplace.rb +375 -0
  121. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb +101 -0
  122. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/meter_details.rb +146 -0
  123. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/notification.rb +139 -0
  124. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  125. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  126. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  127. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
  128. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +146 -0
  129. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  130. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
  131. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/query_options.rb +45 -0
  132. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_detail.rb +187 -0
  133. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +100 -0
  134. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_recommendation.rb +224 -0
  135. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_recommendations_list_result.rb +101 -0
  136. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +100 -0
  137. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_summary.rb +205 -0
  138. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  139. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/resource_attributes.rb +59 -0
  140. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/tag.rb +46 -0
  141. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/tags_result.rb +90 -0
  142. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
  143. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/usage_detail.rb +415 -0
  144. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  145. data/lib/2018-06-30/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  146. data/lib/2018-06-30/generated/azure_mgmt_consumption/operations.rb +216 -0
  147. data/lib/2018-06-30/generated/azure_mgmt_consumption/price_sheet.rb +262 -0
  148. data/lib/2018-06-30/generated/azure_mgmt_consumption/reservation_recommendations.rb +226 -0
  149. data/lib/2018-06-30/generated/azure_mgmt_consumption/reservations_details.rb +449 -0
  150. data/lib/2018-06-30/generated/azure_mgmt_consumption/reservations_summaries.rb +465 -0
  151. data/lib/2018-06-30/generated/azure_mgmt_consumption/tags.rb +113 -0
  152. data/lib/2018-06-30/generated/azure_mgmt_consumption/usage_details.rb +2289 -0
  153. data/lib/azure_mgmt_consumption.rb +4 -1
  154. data/lib/profiles/latest/modules/consumption_profile_module.rb +160 -78
  155. data/lib/version.rb +1 -1
  156. metadata +150 -4
@@ -0,0 +1,101 @@
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_05_31
7
+ module Models
8
+ #
9
+ # Result of listing usage details. It contains a list of available usage
10
+ # details in reverse chronological order by billing period.
11
+ #
12
+ class UsageDetailsListResult
13
+
14
+ include MsRestAzure
15
+
16
+ include MsRest::JSONable
17
+ # @return [Array<UsageDetail>] The list of usage details.
18
+ attr_accessor :value
19
+
20
+ # @return [String] The link (url) to the next page of results.
21
+ attr_accessor :next_link
22
+
23
+ # return [Proc] with next page method call.
24
+ attr_accessor :next_method
25
+
26
+ #
27
+ # Gets the rest of the items for the request, enabling auto-pagination.
28
+ #
29
+ # @return [Array<UsageDetail>] operation results.
30
+ #
31
+ def get_all_items
32
+ items = @value
33
+ page = self
34
+ while page.next_link != nil do
35
+ page = page.get_next_page
36
+ items.concat(page.value)
37
+ end
38
+ items
39
+ end
40
+
41
+ #
42
+ # Gets the next page of results.
43
+ #
44
+ # @return [UsageDetailsListResult] with next page content.
45
+ #
46
+ def get_next_page
47
+ response = @next_method.call(@next_link).value! unless @next_method.nil?
48
+ unless response.nil?
49
+ @next_link = response.body.next_link
50
+ @value = response.body.value
51
+ self
52
+ end
53
+ end
54
+
55
+ #
56
+ # Mapper for UsageDetailsListResult class as Ruby Hash.
57
+ # This will be used for serialization/deserialization.
58
+ #
59
+ def self.mapper()
60
+ {
61
+ client_side_validation: true,
62
+ required: false,
63
+ serialized_name: 'UsageDetailsListResult',
64
+ type: {
65
+ name: 'Composite',
66
+ class_name: 'UsageDetailsListResult',
67
+ model_properties: {
68
+ value: {
69
+ client_side_validation: true,
70
+ required: false,
71
+ read_only: true,
72
+ serialized_name: 'value',
73
+ type: {
74
+ name: 'Sequence',
75
+ element: {
76
+ client_side_validation: true,
77
+ required: false,
78
+ serialized_name: 'UsageDetailElementType',
79
+ type: {
80
+ name: 'Composite',
81
+ class_name: 'UsageDetail'
82
+ }
83
+ }
84
+ }
85
+ },
86
+ next_link: {
87
+ client_side_validation: true,
88
+ required: false,
89
+ read_only: true,
90
+ serialized_name: 'nextLink',
91
+ type: {
92
+ name: 'String'
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ end
99
+ end
100
+ end
101
+ end
@@ -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::Consumption end
8
+ module Azure::Consumption::Mgmt end
9
+ module Azure::Consumption::Mgmt::V2018_05_31 end
@@ -0,0 +1,216 @@
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_05_31
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class Operations
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Operations 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 of the available consumption REST API operations.
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<Operation>] 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 of the available consumption REST API operations.
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 of the available consumption REST API operations.
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
+
61
+
62
+ request_headers = {}
63
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
64
+
65
+ # Set Headers
66
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
67
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
68
+ path_template = 'providers/Microsoft.Consumption/operations'
69
+
70
+ request_url = @base_url || @client.base_url
71
+
72
+ options = {
73
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
74
+ query_params: {'api-version' => @client.api_version},
75
+ headers: request_headers.merge(custom_headers || {}),
76
+ base_url: request_url
77
+ }
78
+ promise = @client.make_request_async(:get, path_template, options)
79
+
80
+ promise = promise.then do |result|
81
+ http_response = result.response
82
+ status_code = http_response.status
83
+ response_content = http_response.body
84
+ unless status_code == 200
85
+ error_model = JSON.load(response_content)
86
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
87
+ end
88
+
89
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
90
+ # Deserialize Response
91
+ if status_code == 200
92
+ begin
93
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
94
+ result_mapper = Azure::Consumption::Mgmt::V2018_05_31::Models::OperationListResult.mapper()
95
+ result.body = @client.deserialize(result_mapper, parsed_response)
96
+ rescue Exception => e
97
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
98
+ end
99
+ end
100
+
101
+ result
102
+ end
103
+
104
+ promise.execute
105
+ end
106
+
107
+ #
108
+ # Lists all of the available consumption REST API operations.
109
+ #
110
+ # @param next_page_link [String] The NextLink from the previous successful call
111
+ # to List operation.
112
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
113
+ # will be added to the HTTP request.
114
+ #
115
+ # @return [OperationListResult] operation results.
116
+ #
117
+ def list_next(next_page_link, custom_headers:nil)
118
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
119
+ response.body unless response.nil?
120
+ end
121
+
122
+ #
123
+ # Lists all of the available consumption REST API operations.
124
+ #
125
+ # @param next_page_link [String] The NextLink from the previous successful call
126
+ # to List operation.
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_next_with_http_info(next_page_link, custom_headers:nil)
133
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
134
+ end
135
+
136
+ #
137
+ # Lists all of the available consumption REST API operations.
138
+ #
139
+ # @param next_page_link [String] The NextLink from the previous successful call
140
+ # to List operation.
141
+ # @param [Hash{String => String}] A hash of custom headers that will be added
142
+ # to the HTTP request.
143
+ #
144
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
145
+ #
146
+ def list_next_async(next_page_link, custom_headers:nil)
147
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
148
+
149
+
150
+ request_headers = {}
151
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
152
+
153
+ # Set Headers
154
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
155
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
156
+ path_template = '{nextLink}'
157
+
158
+ request_url = @base_url || @client.base_url
159
+
160
+ options = {
161
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
162
+ skip_encoding_path_params: {'nextLink' => next_page_link},
163
+ headers: request_headers.merge(custom_headers || {}),
164
+ base_url: request_url
165
+ }
166
+ promise = @client.make_request_async(:get, path_template, options)
167
+
168
+ promise = promise.then do |result|
169
+ http_response = result.response
170
+ status_code = http_response.status
171
+ response_content = http_response.body
172
+ unless status_code == 200
173
+ error_model = JSON.load(response_content)
174
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
175
+ end
176
+
177
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
178
+ # Deserialize Response
179
+ if status_code == 200
180
+ begin
181
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
182
+ result_mapper = Azure::Consumption::Mgmt::V2018_05_31::Models::OperationListResult.mapper()
183
+ result.body = @client.deserialize(result_mapper, parsed_response)
184
+ rescue Exception => e
185
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
186
+ end
187
+ end
188
+
189
+ result
190
+ end
191
+
192
+ promise.execute
193
+ end
194
+
195
+ #
196
+ # Lists all of the available consumption REST API operations.
197
+ #
198
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
199
+ # will be added to the HTTP request.
200
+ #
201
+ # @return [OperationListResult] which provide lazy access to pages of the
202
+ # response.
203
+ #
204
+ def list_as_lazy(custom_headers:nil)
205
+ response = list_async(custom_headers:custom_headers).value!
206
+ unless response.nil?
207
+ page = response.body
208
+ page.next_method = Proc.new do |next_page_link|
209
+ list_next_async(next_page_link, custom_headers:custom_headers)
210
+ end
211
+ page
212
+ end
213
+ end
214
+
215
+ end
216
+ end
@@ -0,0 +1,262 @@
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_05_31
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class PriceSheet
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the PriceSheet class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ConsumptionManagementClient] reference to the ConsumptionManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets the price sheet for a scope by subscriptionId. Price sheet is available
27
+ # via this API only for May 1, 2014 or later.
28
+ #
29
+ # @param expand [String] May be used to expand the properties/meterDetails
30
+ # within a price sheet. By default, these fields are not included when
31
+ # returning price sheet.
32
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
33
+ # returned a partial result. If a previous response contains a nextLink
34
+ # element, the value of the nextLink element will include a skiptoken parameter
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.
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ # @return [PriceSheetResult] operation results.
42
+ #
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!
45
+ response.body unless response.nil?
46
+ end
47
+
48
+ #
49
+ # Gets the price sheet for a scope by subscriptionId. Price sheet is available
50
+ # via this API only for May 1, 2014 or later.
51
+ #
52
+ # @param expand [String] May be used to expand the properties/meterDetails
53
+ # within a price sheet. By default, these fields are not included when
54
+ # returning price sheet.
55
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
56
+ # returned a partial result. If a previous response contains a nextLink
57
+ # element, the value of the nextLink element will include a skiptoken parameter
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.
61
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
62
+ # will be added to the HTTP request.
63
+ #
64
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
65
+ #
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!
68
+ end
69
+
70
+ #
71
+ # Gets the price sheet for a scope by subscriptionId. Price sheet is available
72
+ # via this API only for May 1, 2014 or later.
73
+ #
74
+ # @param expand [String] May be used to expand the properties/meterDetails
75
+ # within a price sheet. By default, these fields are not included when
76
+ # returning price sheet.
77
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
78
+ # returned a partial result. If a previous response contains a nextLink
79
+ # element, the value of the nextLink element will include a skiptoken parameter
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.
83
+ # @param [Hash{String => String}] A hash of custom headers that will be added
84
+ # to the HTTP request.
85
+ #
86
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
87
+ #
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
91
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
92
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
93
+
94
+
95
+ request_headers = {}
96
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
97
+
98
+ # Set Headers
99
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
100
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
101
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default'
102
+
103
+ request_url = @base_url || @client.base_url
104
+
105
+ options = {
106
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
107
+ path_params: {'subscriptionId' => @client.subscription_id},
108
+ query_params: {'$expand' => expand,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version},
109
+ headers: request_headers.merge(custom_headers || {}),
110
+ base_url: request_url
111
+ }
112
+ promise = @client.make_request_async(:get, path_template, options)
113
+
114
+ promise = promise.then do |result|
115
+ http_response = result.response
116
+ status_code = http_response.status
117
+ response_content = http_response.body
118
+ unless status_code == 200
119
+ error_model = JSON.load(response_content)
120
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
121
+ end
122
+
123
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
124
+ # Deserialize Response
125
+ if status_code == 200
126
+ begin
127
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
128
+ result_mapper = Azure::Consumption::Mgmt::V2018_05_31::Models::PriceSheetResult.mapper()
129
+ result.body = @client.deserialize(result_mapper, parsed_response)
130
+ rescue Exception => e
131
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
132
+ end
133
+ end
134
+
135
+ result
136
+ end
137
+
138
+ promise.execute
139
+ end
140
+
141
+ #
142
+ # Get the price sheet for a scope by subscriptionId and billing period. Price
143
+ # sheet is available via this API only for May 1, 2014 or later.
144
+ #
145
+ # @param billing_period_name [String] Billing Period Name.
146
+ # @param expand [String] May be used to expand the properties/meterDetails
147
+ # within a price sheet. By default, these fields are not included when
148
+ # returning price sheet.
149
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
150
+ # returned a partial result. If a previous response contains a nextLink
151
+ # element, the value of the nextLink element will include a skiptoken parameter
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.
155
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
156
+ # will be added to the HTTP request.
157
+ #
158
+ # @return [PriceSheetResult] operation results.
159
+ #
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!
162
+ response.body unless response.nil?
163
+ end
164
+
165
+ #
166
+ # Get the price sheet for a scope by subscriptionId and billing period. Price
167
+ # sheet is available via this API only for May 1, 2014 or later.
168
+ #
169
+ # @param billing_period_name [String] Billing Period Name.
170
+ # @param expand [String] May be used to expand the properties/meterDetails
171
+ # within a price sheet. By default, these fields are not included when
172
+ # returning price sheet.
173
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
174
+ # returned a partial result. If a previous response contains a nextLink
175
+ # element, the value of the nextLink element will include a skiptoken parameter
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.
179
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
180
+ # will be added to the HTTP request.
181
+ #
182
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
183
+ #
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!
186
+ end
187
+
188
+ #
189
+ # Get the price sheet for a scope by subscriptionId and billing period. Price
190
+ # sheet is available via this API only for May 1, 2014 or later.
191
+ #
192
+ # @param billing_period_name [String] Billing Period Name.
193
+ # @param expand [String] May be used to expand the properties/meterDetails
194
+ # within a price sheet. By default, these fields are not included when
195
+ # returning price sheet.
196
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
197
+ # returned a partial result. If a previous response contains a nextLink
198
+ # element, the value of the nextLink element will include a skiptoken parameter
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.
202
+ # @param [Hash{String => String}] A hash of custom headers that will be added
203
+ # to the HTTP request.
204
+ #
205
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
206
+ #
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
210
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
211
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
212
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
213
+
214
+
215
+ request_headers = {}
216
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
217
+
218
+ # Set Headers
219
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
220
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
221
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/pricesheets/default'
222
+
223
+ request_url = @base_url || @client.base_url
224
+
225
+ options = {
226
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
227
+ path_params: {'subscriptionId' => @client.subscription_id,'billingPeriodName' => billing_period_name},
228
+ query_params: {'$expand' => expand,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version},
229
+ headers: request_headers.merge(custom_headers || {}),
230
+ base_url: request_url
231
+ }
232
+ promise = @client.make_request_async(:get, path_template, options)
233
+
234
+ promise = promise.then do |result|
235
+ http_response = result.response
236
+ status_code = http_response.status
237
+ response_content = http_response.body
238
+ unless status_code == 200
239
+ error_model = JSON.load(response_content)
240
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
241
+ end
242
+
243
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
244
+ # Deserialize Response
245
+ if status_code == 200
246
+ begin
247
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
248
+ result_mapper = Azure::Consumption::Mgmt::V2018_05_31::Models::PriceSheetResult.mapper()
249
+ result.body = @client.deserialize(result_mapper, parsed_response)
250
+ rescue Exception => e
251
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
252
+ end
253
+ end
254
+
255
+ result
256
+ end
257
+
258
+ promise.execute
259
+ end
260
+
261
+ end
262
+ end