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,226 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Consumption::Mgmt::V2018_06_30
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class ReservationRecommendations
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ReservationRecommendations 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
+ # List of recomendations for purchasing reserved instances.
27
+ #
28
+ # @param filter [String] May be used to filter reservationRecommendations by
29
+ # properties/scope and properties/lookBackPeriod.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<ReservationRecommendation>] operation results.
34
+ #
35
+ def list(filter:nil, custom_headers:nil)
36
+ first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # List of recomendations for purchasing reserved instances.
42
+ #
43
+ # @param filter [String] May be used to filter reservationRecommendations by
44
+ # properties/scope and properties/lookBackPeriod.
45
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
46
+ # will be added to the HTTP request.
47
+ #
48
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
49
+ #
50
+ def list_with_http_info(filter:nil, custom_headers:nil)
51
+ list_async(filter:filter, custom_headers:custom_headers).value!
52
+ end
53
+
54
+ #
55
+ # List of recomendations for purchasing reserved instances.
56
+ #
57
+ # @param filter [String] May be used to filter reservationRecommendations by
58
+ # properties/scope and properties/lookBackPeriod.
59
+ # @param [Hash{String => String}] A hash of custom headers that will be added
60
+ # to the HTTP request.
61
+ #
62
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
63
+ #
64
+ def list_async(filter:nil, custom_headers:nil)
65
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
66
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
67
+
68
+
69
+ request_headers = {}
70
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
71
+
72
+ # Set Headers
73
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
74
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
75
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/reservationRecommendations'
76
+
77
+ request_url = @base_url || @client.base_url
78
+
79
+ options = {
80
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
81
+ path_params: {'subscriptionId' => @client.subscription_id},
82
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
83
+ headers: request_headers.merge(custom_headers || {}),
84
+ base_url: request_url
85
+ }
86
+ promise = @client.make_request_async(:get, path_template, options)
87
+
88
+ promise = promise.then do |result|
89
+ http_response = result.response
90
+ status_code = http_response.status
91
+ response_content = http_response.body
92
+ unless status_code == 200
93
+ error_model = JSON.load(response_content)
94
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
95
+ end
96
+
97
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
98
+ # Deserialize Response
99
+ if status_code == 200
100
+ begin
101
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
102
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::ReservationRecommendationsListResult.mapper()
103
+ result.body = @client.deserialize(result_mapper, parsed_response)
104
+ rescue Exception => e
105
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
106
+ end
107
+ end
108
+
109
+ result
110
+ end
111
+
112
+ promise.execute
113
+ end
114
+
115
+ #
116
+ # List of recomendations for purchasing reserved instances.
117
+ #
118
+ # @param next_page_link [String] The NextLink from the previous successful call
119
+ # to List operation.
120
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
121
+ # will be added to the HTTP request.
122
+ #
123
+ # @return [ReservationRecommendationsListResult] operation results.
124
+ #
125
+ def list_next(next_page_link, custom_headers:nil)
126
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
127
+ response.body unless response.nil?
128
+ end
129
+
130
+ #
131
+ # List of recomendations for purchasing reserved instances.
132
+ #
133
+ # @param next_page_link [String] The NextLink from the previous successful call
134
+ # to List operation.
135
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
136
+ # will be added to the HTTP request.
137
+ #
138
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
139
+ #
140
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
141
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
142
+ end
143
+
144
+ #
145
+ # List of recomendations for purchasing reserved instances.
146
+ #
147
+ # @param next_page_link [String] The NextLink from the previous successful call
148
+ # to List operation.
149
+ # @param [Hash{String => String}] A hash of custom headers that will be added
150
+ # to the HTTP request.
151
+ #
152
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
153
+ #
154
+ def list_next_async(next_page_link, custom_headers:nil)
155
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
156
+
157
+
158
+ request_headers = {}
159
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
160
+
161
+ # Set Headers
162
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
163
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
164
+ path_template = '{nextLink}'
165
+
166
+ request_url = @base_url || @client.base_url
167
+
168
+ options = {
169
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
170
+ skip_encoding_path_params: {'nextLink' => next_page_link},
171
+ headers: request_headers.merge(custom_headers || {}),
172
+ base_url: request_url
173
+ }
174
+ promise = @client.make_request_async(:get, path_template, options)
175
+
176
+ promise = promise.then do |result|
177
+ http_response = result.response
178
+ status_code = http_response.status
179
+ response_content = http_response.body
180
+ unless status_code == 200
181
+ error_model = JSON.load(response_content)
182
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
183
+ end
184
+
185
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
186
+ # Deserialize Response
187
+ if status_code == 200
188
+ begin
189
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
190
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::ReservationRecommendationsListResult.mapper()
191
+ result.body = @client.deserialize(result_mapper, parsed_response)
192
+ rescue Exception => e
193
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
194
+ end
195
+ end
196
+
197
+ result
198
+ end
199
+
200
+ promise.execute
201
+ end
202
+
203
+ #
204
+ # List of recomendations for purchasing reserved instances.
205
+ #
206
+ # @param filter [String] May be used to filter reservationRecommendations by
207
+ # properties/scope and properties/lookBackPeriod.
208
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
209
+ # will be added to the HTTP request.
210
+ #
211
+ # @return [ReservationRecommendationsListResult] which provide lazy access to
212
+ # pages of the response.
213
+ #
214
+ def list_as_lazy(filter:nil, custom_headers:nil)
215
+ response = list_async(filter:filter, custom_headers:custom_headers).value!
216
+ unless response.nil?
217
+ page = response.body
218
+ page.next_method = Proc.new do |next_page_link|
219
+ list_next_async(next_page_link, custom_headers:custom_headers)
220
+ end
221
+ page
222
+ end
223
+ end
224
+
225
+ end
226
+ end
@@ -0,0 +1,449 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Consumption::Mgmt::V2018_06_30
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class ReservationsDetails
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ReservationsDetails class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ConsumptionManagementClient] reference to the ConsumptionManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Lists the reservations details for provided date range.
27
+ #
28
+ # @param reservation_order_id [String] Order Id of the reservation
29
+ # @param filter [String] Filter reservation details by date range. The
30
+ # properties/UsageDate for start date and end date. The filter supports 'le'
31
+ # and 'ge'
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [Array<ReservationDetail>] operation results.
36
+ #
37
+ def list_by_reservation_order(reservation_order_id, filter, custom_headers:nil)
38
+ first_page = list_by_reservation_order_as_lazy(reservation_order_id, filter, custom_headers:custom_headers)
39
+ first_page.get_all_items
40
+ end
41
+
42
+ #
43
+ # Lists the reservations details for provided date range.
44
+ #
45
+ # @param reservation_order_id [String] Order Id of the reservation
46
+ # @param filter [String] Filter reservation details by date range. The
47
+ # properties/UsageDate for start date and end date. The filter supports 'le'
48
+ # and 'ge'
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
53
+ #
54
+ def list_by_reservation_order_with_http_info(reservation_order_id, filter, custom_headers:nil)
55
+ list_by_reservation_order_async(reservation_order_id, filter, custom_headers:custom_headers).value!
56
+ end
57
+
58
+ #
59
+ # Lists the reservations details for provided date range.
60
+ #
61
+ # @param reservation_order_id [String] Order Id of the reservation
62
+ # @param filter [String] Filter reservation details by date range. The
63
+ # properties/UsageDate for start date and end date. The filter supports 'le'
64
+ # and 'ge'
65
+ # @param [Hash{String => String}] A hash of custom headers that will be added
66
+ # to the HTTP request.
67
+ #
68
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
69
+ #
70
+ def list_by_reservation_order_async(reservation_order_id, filter, custom_headers:nil)
71
+ fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
72
+ fail ArgumentError, 'filter is nil' if filter.nil?
73
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
74
+
75
+
76
+ request_headers = {}
77
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+ path_template = 'providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption/reservationDetails'
83
+
84
+ request_url = @base_url || @client.base_url
85
+
86
+ options = {
87
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
88
+ path_params: {'reservationOrderId' => reservation_order_id},
89
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
90
+ headers: request_headers.merge(custom_headers || {}),
91
+ base_url: request_url
92
+ }
93
+ promise = @client.make_request_async(:get, path_template, options)
94
+
95
+ promise = promise.then do |result|
96
+ http_response = result.response
97
+ status_code = http_response.status
98
+ response_content = http_response.body
99
+ unless status_code == 200
100
+ error_model = JSON.load(response_content)
101
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
102
+ end
103
+
104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
105
+ # Deserialize Response
106
+ if status_code == 200
107
+ begin
108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
109
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::ReservationDetailsListResult.mapper()
110
+ result.body = @client.deserialize(result_mapper, parsed_response)
111
+ rescue Exception => e
112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
113
+ end
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ #
123
+ # Lists the reservations details for provided date range.
124
+ #
125
+ # @param reservation_order_id [String] Order Id of the reservation
126
+ # @param reservation_id [String] Id of the reservation
127
+ # @param filter [String] Filter reservation details by date range. The
128
+ # properties/UsageDate for start date and end date. The filter supports 'le'
129
+ # and 'ge'
130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
131
+ # will be added to the HTTP request.
132
+ #
133
+ # @return [Array<ReservationDetail>] operation results.
134
+ #
135
+ def list_by_reservation_order_and_reservation(reservation_order_id, reservation_id, filter, custom_headers:nil)
136
+ first_page = list_by_reservation_order_and_reservation_as_lazy(reservation_order_id, reservation_id, filter, custom_headers:custom_headers)
137
+ first_page.get_all_items
138
+ end
139
+
140
+ #
141
+ # Lists the reservations details for provided date range.
142
+ #
143
+ # @param reservation_order_id [String] Order Id of the reservation
144
+ # @param reservation_id [String] Id of the reservation
145
+ # @param filter [String] Filter reservation details by date range. The
146
+ # properties/UsageDate for start date and end date. The filter supports 'le'
147
+ # and 'ge'
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
152
+ #
153
+ def list_by_reservation_order_and_reservation_with_http_info(reservation_order_id, reservation_id, filter, custom_headers:nil)
154
+ list_by_reservation_order_and_reservation_async(reservation_order_id, reservation_id, filter, custom_headers:custom_headers).value!
155
+ end
156
+
157
+ #
158
+ # Lists the reservations details for provided date range.
159
+ #
160
+ # @param reservation_order_id [String] Order Id of the reservation
161
+ # @param reservation_id [String] Id of the reservation
162
+ # @param filter [String] Filter reservation details by date range. The
163
+ # properties/UsageDate for start date and end date. The filter supports 'le'
164
+ # and 'ge'
165
+ # @param [Hash{String => String}] A hash of custom headers that will be added
166
+ # to the HTTP request.
167
+ #
168
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
169
+ #
170
+ def list_by_reservation_order_and_reservation_async(reservation_order_id, reservation_id, filter, custom_headers:nil)
171
+ fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
172
+ fail ArgumentError, 'reservation_id is nil' if reservation_id.nil?
173
+ fail ArgumentError, 'filter is nil' if filter.nil?
174
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
175
+
176
+
177
+ request_headers = {}
178
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
179
+
180
+ # Set Headers
181
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
182
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
183
+ path_template = 'providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.Consumption/reservationDetails'
184
+
185
+ request_url = @base_url || @client.base_url
186
+
187
+ options = {
188
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
189
+ path_params: {'reservationOrderId' => reservation_order_id,'reservationId' => reservation_id},
190
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
191
+ headers: request_headers.merge(custom_headers || {}),
192
+ base_url: request_url
193
+ }
194
+ promise = @client.make_request_async(:get, path_template, options)
195
+
196
+ promise = promise.then do |result|
197
+ http_response = result.response
198
+ status_code = http_response.status
199
+ response_content = http_response.body
200
+ unless status_code == 200
201
+ error_model = JSON.load(response_content)
202
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
203
+ end
204
+
205
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
206
+ # Deserialize Response
207
+ if status_code == 200
208
+ begin
209
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
210
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::ReservationDetailsListResult.mapper()
211
+ result.body = @client.deserialize(result_mapper, parsed_response)
212
+ rescue Exception => e
213
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
214
+ end
215
+ end
216
+
217
+ result
218
+ end
219
+
220
+ promise.execute
221
+ end
222
+
223
+ #
224
+ # Lists the reservations details for provided date range.
225
+ #
226
+ # @param next_page_link [String] The NextLink from the previous successful call
227
+ # to List operation.
228
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
229
+ # will be added to the HTTP request.
230
+ #
231
+ # @return [ReservationDetailsListResult] operation results.
232
+ #
233
+ def list_by_reservation_order_next(next_page_link, custom_headers:nil)
234
+ response = list_by_reservation_order_next_async(next_page_link, custom_headers:custom_headers).value!
235
+ response.body unless response.nil?
236
+ end
237
+
238
+ #
239
+ # Lists the reservations details for provided date range.
240
+ #
241
+ # @param next_page_link [String] The NextLink from the previous successful call
242
+ # to List operation.
243
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
244
+ # will be added to the HTTP request.
245
+ #
246
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
247
+ #
248
+ def list_by_reservation_order_next_with_http_info(next_page_link, custom_headers:nil)
249
+ list_by_reservation_order_next_async(next_page_link, custom_headers:custom_headers).value!
250
+ end
251
+
252
+ #
253
+ # Lists the reservations details for provided date range.
254
+ #
255
+ # @param next_page_link [String] The NextLink from the previous successful call
256
+ # to List operation.
257
+ # @param [Hash{String => String}] A hash of custom headers that will be added
258
+ # to the HTTP request.
259
+ #
260
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
261
+ #
262
+ def list_by_reservation_order_next_async(next_page_link, custom_headers:nil)
263
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
264
+
265
+
266
+ request_headers = {}
267
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
268
+
269
+ # Set Headers
270
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
271
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
272
+ path_template = '{nextLink}'
273
+
274
+ request_url = @base_url || @client.base_url
275
+
276
+ options = {
277
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
278
+ skip_encoding_path_params: {'nextLink' => next_page_link},
279
+ headers: request_headers.merge(custom_headers || {}),
280
+ base_url: request_url
281
+ }
282
+ promise = @client.make_request_async(:get, path_template, options)
283
+
284
+ promise = promise.then do |result|
285
+ http_response = result.response
286
+ status_code = http_response.status
287
+ response_content = http_response.body
288
+ unless status_code == 200
289
+ error_model = JSON.load(response_content)
290
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
291
+ end
292
+
293
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
294
+ # Deserialize Response
295
+ if status_code == 200
296
+ begin
297
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
298
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::ReservationDetailsListResult.mapper()
299
+ result.body = @client.deserialize(result_mapper, parsed_response)
300
+ rescue Exception => e
301
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
302
+ end
303
+ end
304
+
305
+ result
306
+ end
307
+
308
+ promise.execute
309
+ end
310
+
311
+ #
312
+ # Lists the reservations details for provided date range.
313
+ #
314
+ # @param next_page_link [String] The NextLink from the previous successful call
315
+ # to List operation.
316
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
317
+ # will be added to the HTTP request.
318
+ #
319
+ # @return [ReservationDetailsListResult] operation results.
320
+ #
321
+ def list_by_reservation_order_and_reservation_next(next_page_link, custom_headers:nil)
322
+ response = list_by_reservation_order_and_reservation_next_async(next_page_link, custom_headers:custom_headers).value!
323
+ response.body unless response.nil?
324
+ end
325
+
326
+ #
327
+ # Lists the reservations details for provided date range.
328
+ #
329
+ # @param next_page_link [String] The NextLink from the previous successful call
330
+ # to List operation.
331
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
332
+ # will be added to the HTTP request.
333
+ #
334
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
335
+ #
336
+ def list_by_reservation_order_and_reservation_next_with_http_info(next_page_link, custom_headers:nil)
337
+ list_by_reservation_order_and_reservation_next_async(next_page_link, custom_headers:custom_headers).value!
338
+ end
339
+
340
+ #
341
+ # Lists the reservations details for provided date range.
342
+ #
343
+ # @param next_page_link [String] The NextLink from the previous successful call
344
+ # to List operation.
345
+ # @param [Hash{String => String}] A hash of custom headers that will be added
346
+ # to the HTTP request.
347
+ #
348
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
349
+ #
350
+ def list_by_reservation_order_and_reservation_next_async(next_page_link, custom_headers:nil)
351
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
352
+
353
+
354
+ request_headers = {}
355
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
356
+
357
+ # Set Headers
358
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
359
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
360
+ path_template = '{nextLink}'
361
+
362
+ request_url = @base_url || @client.base_url
363
+
364
+ options = {
365
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
366
+ skip_encoding_path_params: {'nextLink' => next_page_link},
367
+ headers: request_headers.merge(custom_headers || {}),
368
+ base_url: request_url
369
+ }
370
+ promise = @client.make_request_async(:get, path_template, options)
371
+
372
+ promise = promise.then do |result|
373
+ http_response = result.response
374
+ status_code = http_response.status
375
+ response_content = http_response.body
376
+ unless status_code == 200
377
+ error_model = JSON.load(response_content)
378
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
379
+ end
380
+
381
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
382
+ # Deserialize Response
383
+ if status_code == 200
384
+ begin
385
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
386
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::ReservationDetailsListResult.mapper()
387
+ result.body = @client.deserialize(result_mapper, parsed_response)
388
+ rescue Exception => e
389
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
390
+ end
391
+ end
392
+
393
+ result
394
+ end
395
+
396
+ promise.execute
397
+ end
398
+
399
+ #
400
+ # Lists the reservations details for provided date range.
401
+ #
402
+ # @param reservation_order_id [String] Order Id of the reservation
403
+ # @param filter [String] Filter reservation details by date range. The
404
+ # properties/UsageDate for start date and end date. The filter supports 'le'
405
+ # and 'ge'
406
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
407
+ # will be added to the HTTP request.
408
+ #
409
+ # @return [ReservationDetailsListResult] which provide lazy access to pages of
410
+ # the response.
411
+ #
412
+ def list_by_reservation_order_as_lazy(reservation_order_id, filter, custom_headers:nil)
413
+ response = list_by_reservation_order_async(reservation_order_id, filter, custom_headers:custom_headers).value!
414
+ unless response.nil?
415
+ page = response.body
416
+ page.next_method = Proc.new do |next_page_link|
417
+ list_by_reservation_order_next_async(next_page_link, custom_headers:custom_headers)
418
+ end
419
+ page
420
+ end
421
+ end
422
+
423
+ #
424
+ # Lists the reservations details for provided date range.
425
+ #
426
+ # @param reservation_order_id [String] Order Id of the reservation
427
+ # @param reservation_id [String] Id of the reservation
428
+ # @param filter [String] Filter reservation details by date range. The
429
+ # properties/UsageDate for start date and end date. The filter supports 'le'
430
+ # and 'ge'
431
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
432
+ # will be added to the HTTP request.
433
+ #
434
+ # @return [ReservationDetailsListResult] which provide lazy access to pages of
435
+ # the response.
436
+ #
437
+ def list_by_reservation_order_and_reservation_as_lazy(reservation_order_id, reservation_id, filter, custom_headers:nil)
438
+ response = list_by_reservation_order_and_reservation_async(reservation_order_id, reservation_id, filter, custom_headers:custom_headers).value!
439
+ unless response.nil?
440
+ page = response.body
441
+ page.next_method = Proc.new do |next_page_link|
442
+ list_by_reservation_order_and_reservation_next_async(next_page_link, custom_headers:custom_headers)
443
+ end
444
+ page
445
+ end
446
+ end
447
+
448
+ end
449
+ end