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