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,120 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Consumption::Mgmt::V2018_03_31
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class GetBalancesByBillingAccount
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the GetBalancesByBillingAccount class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ConsumptionManagementClient] reference to the ConsumptionManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets the balances for a scope by billing period and billingAccountId.
27
+ # Balances are available via this API only for May 1, 2014 or later.
28
+ #
29
+ # @param billing_account_id [String] BillingAccount ID
30
+ # @param billing_period_name [String] Billing Period Name.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [Balance] operation results.
35
+ #
36
+ def by_billing_period(billing_account_id, billing_period_name, custom_headers:nil)
37
+ response = by_billing_period_async(billing_account_id, billing_period_name, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Gets the balances for a scope by billing period and billingAccountId.
43
+ # Balances are available via this API only for May 1, 2014 or later.
44
+ #
45
+ # @param billing_account_id [String] BillingAccount ID
46
+ # @param billing_period_name [String] Billing Period Name.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
51
+ #
52
+ def by_billing_period_with_http_info(billing_account_id, billing_period_name, custom_headers:nil)
53
+ by_billing_period_async(billing_account_id, billing_period_name, custom_headers:custom_headers).value!
54
+ end
55
+
56
+ #
57
+ # Gets the balances for a scope by billing period and billingAccountId.
58
+ # Balances are available via this API only for May 1, 2014 or later.
59
+ #
60
+ # @param billing_account_id [String] BillingAccount ID
61
+ # @param billing_period_name [String] Billing Period Name.
62
+ # @param [Hash{String => String}] A hash of custom headers that will be added
63
+ # to the HTTP request.
64
+ #
65
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
66
+ #
67
+ def by_billing_period_async(billing_account_id, billing_period_name, custom_headers:nil)
68
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
69
+ fail ArgumentError, 'billing_account_id is nil' if billing_account_id.nil?
70
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
71
+
72
+
73
+ request_headers = {}
74
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
75
+
76
+ # Set Headers
77
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
78
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
79
+ path_template = 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/balances'
80
+
81
+ request_url = @base_url || @client.base_url
82
+
83
+ options = {
84
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
85
+ path_params: {'billingAccountId' => billing_account_id,'billingPeriodName' => billing_period_name},
86
+ query_params: {'api-version' => @client.api_version},
87
+ headers: request_headers.merge(custom_headers || {}),
88
+ base_url: request_url
89
+ }
90
+ promise = @client.make_request_async(:get, path_template, options)
91
+
92
+ promise = promise.then do |result|
93
+ http_response = result.response
94
+ status_code = http_response.status
95
+ response_content = http_response.body
96
+ unless status_code == 200
97
+ error_model = JSON.load(response_content)
98
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
99
+ end
100
+
101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
102
+ # Deserialize Response
103
+ if status_code == 200
104
+ begin
105
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
106
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::Balance.mapper()
107
+ result.body = @client.deserialize(result_mapper, parsed_response)
108
+ rescue Exception => e
109
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
110
+ end
111
+ end
112
+
113
+ result
114
+ end
115
+
116
+ promise.execute
117
+ end
118
+
119
+ end
120
+ end
@@ -0,0 +1,528 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Consumption::Mgmt::V2018_03_31
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class Marketplaces
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Marketplaces 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 marketplaces for a scope by subscriptionId and current billing
27
+ # period. Marketplaces are available via this API only for May 1, 2014 or
28
+ # later.
29
+ #
30
+ # @param filter [String] May be used to filter marketplaces by
31
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
32
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
33
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
34
+ # currently support 'ne', 'or', or 'not'.
35
+ # @param top [Integer] May be used to limit the number of results to the most
36
+ # recent N marketplaces.
37
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
38
+ # returned a partial result. If a previous response contains a nextLink
39
+ # element, the value of the nextLink element will include a skiptoken parameter
40
+ # that specifies a starting point to use for subsequent calls.
41
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
42
+ # will be added to the HTTP request.
43
+ #
44
+ # @return [Array<Marketplace>] operation results.
45
+ #
46
+ def list(filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
47
+ first_page = list_as_lazy(filter:filter, top:top, skiptoken:skiptoken, custom_headers:custom_headers)
48
+ first_page.get_all_items
49
+ end
50
+
51
+ #
52
+ # Lists the marketplaces for a scope by subscriptionId and current billing
53
+ # period. Marketplaces are available via this API only for May 1, 2014 or
54
+ # later.
55
+ #
56
+ # @param filter [String] May be used to filter marketplaces by
57
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
58
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
59
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
60
+ # currently support 'ne', 'or', or 'not'.
61
+ # @param top [Integer] May be used to limit the number of results to the most
62
+ # recent N marketplaces.
63
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
64
+ # returned a partial result. If a previous response contains a nextLink
65
+ # element, the value of the nextLink element will include a skiptoken parameter
66
+ # that specifies a starting point to use for subsequent calls.
67
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
68
+ # will be added to the HTTP request.
69
+ #
70
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
71
+ #
72
+ def list_with_http_info(filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
73
+ list_async(filter:filter, top:top, skiptoken:skiptoken, custom_headers:custom_headers).value!
74
+ end
75
+
76
+ #
77
+ # Lists the marketplaces for a scope by subscriptionId and current billing
78
+ # period. Marketplaces are available via this API only for May 1, 2014 or
79
+ # later.
80
+ #
81
+ # @param filter [String] May be used to filter marketplaces by
82
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
83
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
84
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
85
+ # currently support 'ne', 'or', or 'not'.
86
+ # @param top [Integer] May be used to limit the number of results to the most
87
+ # recent N marketplaces.
88
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
89
+ # returned a partial result. If a previous response contains a nextLink
90
+ # element, the value of the nextLink element will include a skiptoken parameter
91
+ # that specifies a starting point to use for subsequent calls.
92
+ # @param [Hash{String => String}] A hash of custom headers that will be added
93
+ # to the HTTP request.
94
+ #
95
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
96
+ #
97
+ def list_async(filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
98
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
99
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
100
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
101
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
102
+
103
+
104
+ request_headers = {}
105
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
106
+
107
+ # Set Headers
108
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
109
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
110
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/marketplaces'
111
+
112
+ request_url = @base_url || @client.base_url
113
+
114
+ options = {
115
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
116
+ path_params: {'subscriptionId' => @client.subscription_id},
117
+ query_params: {'$filter' => filter,'$top' => top,'$skiptoken' => skiptoken,'api-version' => @client.api_version},
118
+ headers: request_headers.merge(custom_headers || {}),
119
+ base_url: request_url
120
+ }
121
+ promise = @client.make_request_async(:get, path_template, options)
122
+
123
+ promise = promise.then do |result|
124
+ http_response = result.response
125
+ status_code = http_response.status
126
+ response_content = http_response.body
127
+ unless status_code == 200
128
+ error_model = JSON.load(response_content)
129
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
130
+ end
131
+
132
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
133
+ # Deserialize Response
134
+ if status_code == 200
135
+ begin
136
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
137
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::MarketplacesListResult.mapper()
138
+ result.body = @client.deserialize(result_mapper, parsed_response)
139
+ rescue Exception => e
140
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
141
+ end
142
+ end
143
+
144
+ result
145
+ end
146
+
147
+ promise.execute
148
+ end
149
+
150
+ #
151
+ # Lists the marketplaces for a scope by billing period and subscripotionId.
152
+ # Marketplaces are available via this API only for May 1, 2014 or later.
153
+ #
154
+ # @param billing_period_name [String] Billing Period Name.
155
+ # @param filter [String] May be used to filter marketplaces by
156
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
157
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
158
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
159
+ # currently support 'ne', 'or', or 'not'.
160
+ # @param top [Integer] May be used to limit the number of results to the most
161
+ # recent N marketplaces.
162
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
163
+ # returned a partial result. If a previous response contains a nextLink
164
+ # element, the value of the nextLink element will include a skiptoken parameter
165
+ # that specifies a starting point to use for subsequent calls.
166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
167
+ # will be added to the HTTP request.
168
+ #
169
+ # @return [Array<Marketplace>] operation results.
170
+ #
171
+ def list_by_billing_period(billing_period_name, filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
172
+ first_page = list_by_billing_period_as_lazy(billing_period_name, filter:filter, top:top, skiptoken:skiptoken, custom_headers:custom_headers)
173
+ first_page.get_all_items
174
+ end
175
+
176
+ #
177
+ # Lists the marketplaces for a scope by billing period and subscripotionId.
178
+ # Marketplaces are available via this API only for May 1, 2014 or later.
179
+ #
180
+ # @param billing_period_name [String] Billing Period Name.
181
+ # @param filter [String] May be used to filter marketplaces by
182
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
183
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
184
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
185
+ # currently support 'ne', 'or', or 'not'.
186
+ # @param top [Integer] May be used to limit the number of results to the most
187
+ # recent N marketplaces.
188
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
189
+ # returned a partial result. If a previous response contains a nextLink
190
+ # element, the value of the nextLink element will include a skiptoken parameter
191
+ # that specifies a starting point to use for subsequent calls.
192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
193
+ # will be added to the HTTP request.
194
+ #
195
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
196
+ #
197
+ def list_by_billing_period_with_http_info(billing_period_name, filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
198
+ list_by_billing_period_async(billing_period_name, filter:filter, top:top, skiptoken:skiptoken, custom_headers:custom_headers).value!
199
+ end
200
+
201
+ #
202
+ # Lists the marketplaces for a scope by billing period and subscripotionId.
203
+ # Marketplaces are available via this API only for May 1, 2014 or later.
204
+ #
205
+ # @param billing_period_name [String] Billing Period Name.
206
+ # @param filter [String] May be used to filter marketplaces by
207
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
208
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
209
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
210
+ # currently support 'ne', 'or', or 'not'.
211
+ # @param top [Integer] May be used to limit the number of results to the most
212
+ # recent N marketplaces.
213
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
214
+ # returned a partial result. If a previous response contains a nextLink
215
+ # element, the value of the nextLink element will include a skiptoken parameter
216
+ # that specifies a starting point to use for subsequent calls.
217
+ # @param [Hash{String => String}] A hash of custom headers that will be added
218
+ # to the HTTP request.
219
+ #
220
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
221
+ #
222
+ def list_by_billing_period_async(billing_period_name, filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
223
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
224
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
225
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
226
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
227
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
228
+
229
+
230
+ request_headers = {}
231
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
232
+
233
+ # Set Headers
234
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
235
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
236
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces'
237
+
238
+ request_url = @base_url || @client.base_url
239
+
240
+ options = {
241
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
242
+ path_params: {'subscriptionId' => @client.subscription_id,'billingPeriodName' => billing_period_name},
243
+ query_params: {'$filter' => filter,'$top' => top,'$skiptoken' => skiptoken,'api-version' => @client.api_version},
244
+ headers: request_headers.merge(custom_headers || {}),
245
+ base_url: request_url
246
+ }
247
+ promise = @client.make_request_async(:get, path_template, options)
248
+
249
+ promise = promise.then do |result|
250
+ http_response = result.response
251
+ status_code = http_response.status
252
+ response_content = http_response.body
253
+ unless status_code == 200
254
+ error_model = JSON.load(response_content)
255
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
256
+ end
257
+
258
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
259
+ # Deserialize Response
260
+ if status_code == 200
261
+ begin
262
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
263
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::MarketplacesListResult.mapper()
264
+ result.body = @client.deserialize(result_mapper, parsed_response)
265
+ rescue Exception => e
266
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
267
+ end
268
+ end
269
+
270
+ result
271
+ end
272
+
273
+ promise.execute
274
+ end
275
+
276
+ #
277
+ # Lists the marketplaces for a scope by subscriptionId and current billing
278
+ # period. Marketplaces are available via this API only for May 1, 2014 or
279
+ # later.
280
+ #
281
+ # @param next_page_link [String] The NextLink from the previous successful call
282
+ # to List operation.
283
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
284
+ # will be added to the HTTP request.
285
+ #
286
+ # @return [MarketplacesListResult] operation results.
287
+ #
288
+ def list_next(next_page_link, custom_headers:nil)
289
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
290
+ response.body unless response.nil?
291
+ end
292
+
293
+ #
294
+ # Lists the marketplaces for a scope by subscriptionId and current billing
295
+ # period. Marketplaces are available via this API only for May 1, 2014 or
296
+ # later.
297
+ #
298
+ # @param next_page_link [String] The NextLink from the previous successful call
299
+ # to List operation.
300
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
301
+ # will be added to the HTTP request.
302
+ #
303
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
304
+ #
305
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
306
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
307
+ end
308
+
309
+ #
310
+ # Lists the marketplaces for a scope by subscriptionId and current billing
311
+ # period. Marketplaces are available via this API only for May 1, 2014 or
312
+ # later.
313
+ #
314
+ # @param next_page_link [String] The NextLink from the previous successful call
315
+ # to List operation.
316
+ # @param [Hash{String => String}] A hash of custom headers that will be added
317
+ # to the HTTP request.
318
+ #
319
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
320
+ #
321
+ def list_next_async(next_page_link, custom_headers:nil)
322
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
323
+
324
+
325
+ request_headers = {}
326
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
327
+
328
+ # Set Headers
329
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
330
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
331
+ path_template = '{nextLink}'
332
+
333
+ request_url = @base_url || @client.base_url
334
+
335
+ options = {
336
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
337
+ skip_encoding_path_params: {'nextLink' => next_page_link},
338
+ headers: request_headers.merge(custom_headers || {}),
339
+ base_url: request_url
340
+ }
341
+ promise = @client.make_request_async(:get, path_template, options)
342
+
343
+ promise = promise.then do |result|
344
+ http_response = result.response
345
+ status_code = http_response.status
346
+ response_content = http_response.body
347
+ unless status_code == 200
348
+ error_model = JSON.load(response_content)
349
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
350
+ end
351
+
352
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
353
+ # Deserialize Response
354
+ if status_code == 200
355
+ begin
356
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
357
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::MarketplacesListResult.mapper()
358
+ result.body = @client.deserialize(result_mapper, parsed_response)
359
+ rescue Exception => e
360
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
361
+ end
362
+ end
363
+
364
+ result
365
+ end
366
+
367
+ promise.execute
368
+ end
369
+
370
+ #
371
+ # Lists the marketplaces for a scope by billing period and subscripotionId.
372
+ # Marketplaces are available via this API only for May 1, 2014 or later.
373
+ #
374
+ # @param next_page_link [String] The NextLink from the previous successful call
375
+ # to List operation.
376
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
377
+ # will be added to the HTTP request.
378
+ #
379
+ # @return [MarketplacesListResult] operation results.
380
+ #
381
+ def list_by_billing_period_next(next_page_link, custom_headers:nil)
382
+ response = list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
383
+ response.body unless response.nil?
384
+ end
385
+
386
+ #
387
+ # Lists the marketplaces for a scope by billing period and subscripotionId.
388
+ # Marketplaces are available via this API only for May 1, 2014 or later.
389
+ #
390
+ # @param next_page_link [String] The NextLink from the previous successful call
391
+ # to List operation.
392
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
393
+ # will be added to the HTTP request.
394
+ #
395
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
396
+ #
397
+ def list_by_billing_period_next_with_http_info(next_page_link, custom_headers:nil)
398
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
399
+ end
400
+
401
+ #
402
+ # Lists the marketplaces for a scope by billing period and subscripotionId.
403
+ # Marketplaces are available via this API only for May 1, 2014 or later.
404
+ #
405
+ # @param next_page_link [String] The NextLink from the previous successful call
406
+ # to List operation.
407
+ # @param [Hash{String => String}] A hash of custom headers that will be added
408
+ # to the HTTP request.
409
+ #
410
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
411
+ #
412
+ def list_by_billing_period_next_async(next_page_link, custom_headers:nil)
413
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
414
+
415
+
416
+ request_headers = {}
417
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
418
+
419
+ # Set Headers
420
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
421
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
422
+ path_template = '{nextLink}'
423
+
424
+ request_url = @base_url || @client.base_url
425
+
426
+ options = {
427
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
428
+ skip_encoding_path_params: {'nextLink' => next_page_link},
429
+ headers: request_headers.merge(custom_headers || {}),
430
+ base_url: request_url
431
+ }
432
+ promise = @client.make_request_async(:get, path_template, options)
433
+
434
+ promise = promise.then do |result|
435
+ http_response = result.response
436
+ status_code = http_response.status
437
+ response_content = http_response.body
438
+ unless status_code == 200
439
+ error_model = JSON.load(response_content)
440
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
441
+ end
442
+
443
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
444
+ # Deserialize Response
445
+ if status_code == 200
446
+ begin
447
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
448
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::MarketplacesListResult.mapper()
449
+ result.body = @client.deserialize(result_mapper, parsed_response)
450
+ rescue Exception => e
451
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
452
+ end
453
+ end
454
+
455
+ result
456
+ end
457
+
458
+ promise.execute
459
+ end
460
+
461
+ #
462
+ # Lists the marketplaces for a scope by subscriptionId and current billing
463
+ # period. Marketplaces are available via this API only for May 1, 2014 or
464
+ # later.
465
+ #
466
+ # @param filter [String] May be used to filter marketplaces by
467
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
468
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
469
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
470
+ # currently support 'ne', 'or', or 'not'.
471
+ # @param top [Integer] May be used to limit the number of results to the most
472
+ # recent N marketplaces.
473
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
474
+ # returned a partial result. If a previous response contains a nextLink
475
+ # element, the value of the nextLink element will include a skiptoken parameter
476
+ # that specifies a starting point to use for subsequent calls.
477
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
478
+ # will be added to the HTTP request.
479
+ #
480
+ # @return [MarketplacesListResult] which provide lazy access to pages of the
481
+ # response.
482
+ #
483
+ def list_as_lazy(filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
484
+ response = list_async(filter:filter, top:top, skiptoken:skiptoken, custom_headers:custom_headers).value!
485
+ unless response.nil?
486
+ page = response.body
487
+ page.next_method = Proc.new do |next_page_link|
488
+ list_next_async(next_page_link, custom_headers:custom_headers)
489
+ end
490
+ page
491
+ end
492
+ end
493
+
494
+ #
495
+ # Lists the marketplaces for a scope by billing period and subscripotionId.
496
+ # Marketplaces are available via this API only for May 1, 2014 or later.
497
+ #
498
+ # @param billing_period_name [String] Billing Period Name.
499
+ # @param filter [String] May be used to filter marketplaces by
500
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
501
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
502
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
503
+ # currently support 'ne', 'or', or 'not'.
504
+ # @param top [Integer] May be used to limit the number of results to the most
505
+ # recent N marketplaces.
506
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
507
+ # returned a partial result. If a previous response contains a nextLink
508
+ # element, the value of the nextLink element will include a skiptoken parameter
509
+ # that specifies a starting point to use for subsequent calls.
510
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
511
+ # will be added to the HTTP request.
512
+ #
513
+ # @return [MarketplacesListResult] which provide lazy access to pages of the
514
+ # response.
515
+ #
516
+ def list_by_billing_period_as_lazy(billing_period_name, filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
517
+ response = list_by_billing_period_async(billing_period_name, filter:filter, top:top, skiptoken:skiptoken, custom_headers:custom_headers).value!
518
+ unless response.nil?
519
+ page = response.body
520
+ page.next_method = Proc.new do |next_page_link|
521
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers)
522
+ end
523
+ page
524
+ end
525
+ end
526
+
527
+ end
528
+ end