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,289 @@
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
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class ConsumptionManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Version of the API to be used with the client request.
21
+ # The current version is 2018-03-31.
22
+ attr_reader :api_version
23
+
24
+ # @return [String] Azure Subscription ID.
25
+ attr_accessor :subscription_id
26
+
27
+ # @return [String] The preferred language for the response.
28
+ attr_accessor :accept_language
29
+
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
+ attr_accessor :long_running_operation_retry_timeout
33
+
34
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
35
+ # generated. When set to true a unique x-ms-client-request-id value is
36
+ # generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return [UsageDetails] usage_details
40
+ attr_reader :usage_details
41
+
42
+ # @return [UsageDetailsByBillingAccount] usage_details_by_billing_account
43
+ attr_reader :usage_details_by_billing_account
44
+
45
+ # @return [UsageDetailsByDepartment] usage_details_by_department
46
+ attr_reader :usage_details_by_department
47
+
48
+ # @return [UsageDetailsByEnrollmentAccount]
49
+ # usage_details_by_enrollment_account
50
+ attr_reader :usage_details_by_enrollment_account
51
+
52
+ # @return [Marketplaces] marketplaces
53
+ attr_reader :marketplaces
54
+
55
+ # @return [MarketplacesByBillingAccount] marketplaces_by_billing_account
56
+ attr_reader :marketplaces_by_billing_account
57
+
58
+ # @return [MarketplacesByDepartment] marketplaces_by_department
59
+ attr_reader :marketplaces_by_department
60
+
61
+ # @return [MarketplacesByEnrollmentAccounts]
62
+ # marketplaces_by_enrollment_accounts
63
+ attr_reader :marketplaces_by_enrollment_accounts
64
+
65
+ # @return [GetBalancesByBillingAccount] get_balances_by_billing_account
66
+ attr_reader :get_balances_by_billing_account
67
+
68
+ # @return [ReservationsSummaries] reservations_summaries
69
+ attr_reader :reservations_summaries
70
+
71
+ # @return [ReservationsDetails] reservations_details
72
+ attr_reader :reservations_details
73
+
74
+ # @return [ReservationRecommendationsOperations]
75
+ # reservation_recommendations_operations
76
+ attr_reader :reservation_recommendations_operations
77
+
78
+ # @return [Budgets] budgets
79
+ attr_reader :budgets
80
+
81
+ # @return [Operations] operations
82
+ attr_reader :operations
83
+
84
+ # @return [PriceSheet] price_sheet
85
+ attr_reader :price_sheet
86
+
87
+ # @return [CostTagsOperations] cost_tags_operations
88
+ attr_reader :cost_tags_operations
89
+
90
+ # @return [TagsOperations] tags_operations
91
+ attr_reader :tags_operations
92
+
93
+ #
94
+ # Creates initializes a new instance of the ConsumptionManagementClient class.
95
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
96
+ # @param base_url [String] the base URI of the service.
97
+ # @param options [Array] filters to be applied to the HTTP requests.
98
+ #
99
+ def initialize(credentials = nil, base_url = nil, options = nil)
100
+ super(credentials, options)
101
+ @base_url = base_url || 'https://management.azure.com'
102
+
103
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
104
+ @credentials = credentials
105
+
106
+ @usage_details = UsageDetails.new(self)
107
+ @usage_details_by_billing_account = UsageDetailsByBillingAccount.new(self)
108
+ @usage_details_by_department = UsageDetailsByDepartment.new(self)
109
+ @usage_details_by_enrollment_account = UsageDetailsByEnrollmentAccount.new(self)
110
+ @marketplaces = Marketplaces.new(self)
111
+ @marketplaces_by_billing_account = MarketplacesByBillingAccount.new(self)
112
+ @marketplaces_by_department = MarketplacesByDepartment.new(self)
113
+ @marketplaces_by_enrollment_accounts = MarketplacesByEnrollmentAccounts.new(self)
114
+ @get_balances_by_billing_account = GetBalancesByBillingAccount.new(self)
115
+ @reservations_summaries = ReservationsSummaries.new(self)
116
+ @reservations_details = ReservationsDetails.new(self)
117
+ @reservation_recommendations_operations = ReservationRecommendationsOperations.new(self)
118
+ @budgets = Budgets.new(self)
119
+ @operations = Operations.new(self)
120
+ @price_sheet = PriceSheet.new(self)
121
+ @cost_tags_operations = CostTagsOperations.new(self)
122
+ @tags_operations = TagsOperations.new(self)
123
+ @api_version = '2018-03-31'
124
+ @accept_language = 'en-US'
125
+ @long_running_operation_retry_timeout = 30
126
+ @generate_client_request_id = true
127
+ add_telemetry
128
+ end
129
+
130
+ #
131
+ # Makes a request and returns the body of the response.
132
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
133
+ # @param path [String] the path, relative to {base_url}.
134
+ # @param options [Hash{String=>String}] specifying any request options like :body.
135
+ # @return [Hash{String=>String}] containing the body of the response.
136
+ # Example:
137
+ #
138
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
139
+ # path = "/path"
140
+ # options = {
141
+ # body: request_content,
142
+ # query_params: {'api-version' => '2016-02-01'}
143
+ # }
144
+ # result = @client.make_request(:put, path, options)
145
+ #
146
+ def make_request(method, path, options = {})
147
+ result = make_request_with_http_info(method, path, options)
148
+ result.body unless result.nil?
149
+ end
150
+
151
+ #
152
+ # Makes a request and returns the operation response.
153
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
154
+ # @param path [String] the path, relative to {base_url}.
155
+ # @param options [Hash{String=>String}] specifying any request options like :body.
156
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
157
+ #
158
+ def make_request_with_http_info(method, path, options = {})
159
+ result = make_request_async(method, path, options).value!
160
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
161
+ result
162
+ end
163
+
164
+ #
165
+ # Makes a request asynchronously.
166
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
167
+ # @param path [String] the path, relative to {base_url}.
168
+ # @param options [Hash{String=>String}] specifying any request options like :body.
169
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
170
+ #
171
+ def make_request_async(method, path, options = {})
172
+ fail ArgumentError, 'method is nil' if method.nil?
173
+ fail ArgumentError, 'path is nil' if path.nil?
174
+
175
+ request_url = options[:base_url] || @base_url
176
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
177
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
178
+ end
179
+
180
+ request_headers = @request_headers
181
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
182
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
183
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
184
+
185
+ super(request_url, method, path, options)
186
+ end
187
+
188
+ #
189
+ # Gets the balances for a scope by billingAccountId. Balances are available via
190
+ # this API only for May 1, 2014 or later.
191
+ #
192
+ # @param billing_account_id [String] BillingAccount ID
193
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
194
+ # will be added to the HTTP request.
195
+ #
196
+ # @return [Balance] operation results.
197
+ #
198
+ def get_balances_by_billing_account(billing_account_id, custom_headers:nil)
199
+ response = get_balances_by_billing_account_async(billing_account_id, custom_headers:custom_headers).value!
200
+ response.body unless response.nil?
201
+ end
202
+
203
+ #
204
+ # Gets the balances for a scope by billingAccountId. Balances are available via
205
+ # this API only for May 1, 2014 or later.
206
+ #
207
+ # @param billing_account_id [String] BillingAccount ID
208
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
209
+ # will be added to the HTTP request.
210
+ #
211
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
212
+ #
213
+ def get_balances_by_billing_account_with_http_info(billing_account_id, custom_headers:nil)
214
+ get_balances_by_billing_account_async(billing_account_id, custom_headers:custom_headers).value!
215
+ end
216
+
217
+ #
218
+ # Gets the balances for a scope by billingAccountId. Balances are available via
219
+ # this API only for May 1, 2014 or later.
220
+ #
221
+ # @param billing_account_id [String] BillingAccount ID
222
+ # @param [Hash{String => String}] A hash of custom headers that will be added
223
+ # to the HTTP request.
224
+ #
225
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
226
+ #
227
+ def get_balances_by_billing_account_async(billing_account_id, custom_headers:nil)
228
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
229
+ fail ArgumentError, 'billing_account_id is nil' if billing_account_id.nil?
230
+
231
+
232
+ request_headers = {}
233
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
234
+
235
+ # Set Headers
236
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
237
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
238
+ path_template = 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances'
239
+
240
+ request_url = @base_url || self.base_url
241
+
242
+ options = {
243
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
244
+ path_params: {'billingAccountId' => billing_account_id},
245
+ query_params: {'api-version' => api_version},
246
+ headers: request_headers.merge(custom_headers || {}),
247
+ base_url: request_url
248
+ }
249
+ promise = self.make_request_async(:get, path_template, options)
250
+
251
+ promise = promise.then do |result|
252
+ http_response = result.response
253
+ status_code = http_response.status
254
+ response_content = http_response.body
255
+ unless status_code == 200
256
+ error_model = JSON.load(response_content)
257
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
258
+ end
259
+
260
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
261
+ # Deserialize Response
262
+ if status_code == 200
263
+ begin
264
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
265
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::Balance.mapper()
266
+ result.body = self.deserialize(result_mapper, parsed_response)
267
+ rescue Exception => e
268
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
269
+ end
270
+ end
271
+
272
+ result
273
+ end
274
+
275
+ promise.execute
276
+ end
277
+
278
+
279
+ private
280
+ #
281
+ # Adds telemetry information.
282
+ #
283
+ def add_telemetry
284
+ sdk_information = 'azure_mgmt_consumption'
285
+ sdk_information = "#{sdk_information}/0.17.0"
286
+ add_user_agent_information(sdk_information)
287
+ end
288
+ end
289
+ end
@@ -0,0 +1,233 @@
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 CostTagsOperations
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the CostTagsOperations 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
+ # Get cost tags for a billing account.
27
+ #
28
+ # @param billing_account_id [String] BillingAccount ID
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [CostTags] operation results.
33
+ #
34
+ def get(billing_account_id, custom_headers:nil)
35
+ response = get_async(billing_account_id, custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Get cost tags for a billing account.
41
+ #
42
+ # @param billing_account_id [String] BillingAccount ID
43
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
44
+ # will be added to the HTTP request.
45
+ #
46
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
47
+ #
48
+ def get_with_http_info(billing_account_id, custom_headers:nil)
49
+ get_async(billing_account_id, custom_headers:custom_headers).value!
50
+ end
51
+
52
+ #
53
+ # Get cost tags for a billing account.
54
+ #
55
+ # @param billing_account_id [String] BillingAccount ID
56
+ # @param [Hash{String => String}] A hash of custom headers that will be added
57
+ # to the HTTP request.
58
+ #
59
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
60
+ #
61
+ def get_async(billing_account_id, custom_headers:nil)
62
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
63
+ fail ArgumentError, 'billing_account_id is nil' if billing_account_id.nil?
64
+
65
+
66
+ request_headers = {}
67
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
+ path_template = 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags'
73
+
74
+ request_url = @base_url || @client.base_url
75
+
76
+ options = {
77
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
+ path_params: {'billingAccountId' => billing_account_id},
79
+ query_params: {'api-version' => @client.api_version},
80
+ headers: request_headers.merge(custom_headers || {}),
81
+ base_url: request_url
82
+ }
83
+ promise = @client.make_request_async(:get, path_template, options)
84
+
85
+ promise = promise.then do |result|
86
+ http_response = result.response
87
+ status_code = http_response.status
88
+ response_content = http_response.body
89
+ unless status_code == 200
90
+ error_model = JSON.load(response_content)
91
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
92
+ end
93
+
94
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
95
+ # Deserialize Response
96
+ if status_code == 200
97
+ begin
98
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
99
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::CostTags.mapper()
100
+ result.body = @client.deserialize(result_mapper, parsed_response)
101
+ rescue Exception => e
102
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
103
+ end
104
+ end
105
+
106
+ result
107
+ end
108
+
109
+ promise.execute
110
+ end
111
+
112
+ #
113
+ # The operation to create or update cost tags assiciated with a billing
114
+ # account. Update operation requires latest eTag to be set in the request
115
+ # mandatorily. You may obtain the latest eTag by performing a get operation.
116
+ # Create operation does not require eTag.
117
+ #
118
+ # @param billing_account_id [String] BillingAccount ID
119
+ # @param parameters [CostTags] Parameters supplied to the Create cost tags
120
+ # operation.
121
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
122
+ # will be added to the HTTP request.
123
+ #
124
+ # @return [CostTags] operation results.
125
+ #
126
+ def create_or_update(billing_account_id, parameters, custom_headers:nil)
127
+ response = create_or_update_async(billing_account_id, parameters, custom_headers:custom_headers).value!
128
+ response.body unless response.nil?
129
+ end
130
+
131
+ #
132
+ # The operation to create or update cost tags assiciated with a billing
133
+ # account. Update operation requires latest eTag to be set in the request
134
+ # mandatorily. You may obtain the latest eTag by performing a get operation.
135
+ # Create operation does not require eTag.
136
+ #
137
+ # @param billing_account_id [String] BillingAccount ID
138
+ # @param parameters [CostTags] Parameters supplied to the Create cost tags
139
+ # operation.
140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
+ # will be added to the HTTP request.
142
+ #
143
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
144
+ #
145
+ def create_or_update_with_http_info(billing_account_id, parameters, custom_headers:nil)
146
+ create_or_update_async(billing_account_id, parameters, custom_headers:custom_headers).value!
147
+ end
148
+
149
+ #
150
+ # The operation to create or update cost tags assiciated with a billing
151
+ # account. Update operation requires latest eTag to be set in the request
152
+ # mandatorily. You may obtain the latest eTag by performing a get operation.
153
+ # Create operation does not require eTag.
154
+ #
155
+ # @param billing_account_id [String] BillingAccount ID
156
+ # @param parameters [CostTags] Parameters supplied to the Create cost tags
157
+ # operation.
158
+ # @param [Hash{String => String}] A hash of custom headers that will be added
159
+ # to the HTTP request.
160
+ #
161
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
162
+ #
163
+ def create_or_update_async(billing_account_id, parameters, custom_headers:nil)
164
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
165
+ fail ArgumentError, 'billing_account_id is nil' if billing_account_id.nil?
166
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
167
+
168
+
169
+ request_headers = {}
170
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
171
+
172
+ # Set Headers
173
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
174
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
175
+
176
+ # Serialize Request
177
+ request_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::CostTags.mapper()
178
+ request_content = @client.serialize(request_mapper, parameters)
179
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
180
+
181
+ path_template = 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags'
182
+
183
+ request_url = @base_url || @client.base_url
184
+
185
+ options = {
186
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
187
+ path_params: {'billingAccountId' => billing_account_id},
188
+ query_params: {'api-version' => @client.api_version},
189
+ body: request_content,
190
+ headers: request_headers.merge(custom_headers || {}),
191
+ base_url: request_url
192
+ }
193
+ promise = @client.make_request_async(:put, path_template, options)
194
+
195
+ promise = promise.then do |result|
196
+ http_response = result.response
197
+ status_code = http_response.status
198
+ response_content = http_response.body
199
+ unless status_code == 200 || status_code == 201
200
+ error_model = JSON.load(response_content)
201
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
202
+ end
203
+
204
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
205
+ # Deserialize Response
206
+ if status_code == 200
207
+ begin
208
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
209
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::CostTags.mapper()
210
+ result.body = @client.deserialize(result_mapper, parsed_response)
211
+ rescue Exception => e
212
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
213
+ end
214
+ end
215
+ # Deserialize Response
216
+ if status_code == 201
217
+ begin
218
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
219
+ result_mapper = Azure::Consumption::Mgmt::V2018_03_31::Models::CostTags.mapper()
220
+ result.body = @client.deserialize(result_mapper, parsed_response)
221
+ rescue Exception => e
222
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
223
+ end
224
+ end
225
+
226
+ result
227
+ end
228
+
229
+ promise.execute
230
+ end
231
+
232
+ end
233
+ end