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,176 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Consumption::Mgmt::V2018_06_30
7
+ #
8
+ # 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-06-30.
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 [Marketplaces] marketplaces
43
+ attr_reader :marketplaces
44
+
45
+ # @return [Balances] balances
46
+ attr_reader :balances
47
+
48
+ # @return [ReservationsSummaries] reservations_summaries
49
+ attr_reader :reservations_summaries
50
+
51
+ # @return [ReservationsDetails] reservations_details
52
+ attr_reader :reservations_details
53
+
54
+ # @return [ReservationRecommendations] reservation_recommendations
55
+ attr_reader :reservation_recommendations
56
+
57
+ # @return [Budgets] budgets
58
+ attr_reader :budgets
59
+
60
+ # @return [PriceSheet] price_sheet
61
+ attr_reader :price_sheet
62
+
63
+ # @return [CostTags] cost_tags
64
+ attr_reader :cost_tags
65
+
66
+ # @return [Tags] tags
67
+ attr_reader :tags
68
+
69
+ # @return [Forecasts] forecasts
70
+ attr_reader :forecasts
71
+
72
+ # @return [Operations] operations
73
+ attr_reader :operations
74
+
75
+ #
76
+ # Creates initializes a new instance of the ConsumptionManagementClient class.
77
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
78
+ # @param base_url [String] the base URI of the service.
79
+ # @param options [Array] filters to be applied to the HTTP requests.
80
+ #
81
+ def initialize(credentials = nil, base_url = nil, options = nil)
82
+ super(credentials, options)
83
+ @base_url = base_url || 'https://management.azure.com'
84
+
85
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
86
+ @credentials = credentials
87
+
88
+ @usage_details = UsageDetails.new(self)
89
+ @marketplaces = Marketplaces.new(self)
90
+ @balances = Balances.new(self)
91
+ @reservations_summaries = ReservationsSummaries.new(self)
92
+ @reservations_details = ReservationsDetails.new(self)
93
+ @reservation_recommendations = ReservationRecommendations.new(self)
94
+ @budgets = Budgets.new(self)
95
+ @price_sheet = PriceSheet.new(self)
96
+ @cost_tags = CostTags.new(self)
97
+ @tags = Tags.new(self)
98
+ @forecasts = Forecasts.new(self)
99
+ @operations = Operations.new(self)
100
+ @api_version = '2018-06-30'
101
+ @accept_language = 'en-US'
102
+ @long_running_operation_retry_timeout = 30
103
+ @generate_client_request_id = true
104
+ add_telemetry
105
+ end
106
+
107
+ #
108
+ # Makes a request and returns the body of the response.
109
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
110
+ # @param path [String] the path, relative to {base_url}.
111
+ # @param options [Hash{String=>String}] specifying any request options like :body.
112
+ # @return [Hash{String=>String}] containing the body of the response.
113
+ # Example:
114
+ #
115
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
116
+ # path = "/path"
117
+ # options = {
118
+ # body: request_content,
119
+ # query_params: {'api-version' => '2016-02-01'}
120
+ # }
121
+ # result = @client.make_request(:put, path, options)
122
+ #
123
+ def make_request(method, path, options = {})
124
+ result = make_request_with_http_info(method, path, options)
125
+ result.body unless result.nil?
126
+ end
127
+
128
+ #
129
+ # Makes a request and returns the operation response.
130
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
131
+ # @param path [String] the path, relative to {base_url}.
132
+ # @param options [Hash{String=>String}] specifying any request options like :body.
133
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
134
+ #
135
+ def make_request_with_http_info(method, path, options = {})
136
+ result = make_request_async(method, path, options).value!
137
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
138
+ result
139
+ end
140
+
141
+ #
142
+ # Makes a request asynchronously.
143
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
144
+ # @param path [String] the path, relative to {base_url}.
145
+ # @param options [Hash{String=>String}] specifying any request options like :body.
146
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
147
+ #
148
+ def make_request_async(method, path, options = {})
149
+ fail ArgumentError, 'method is nil' if method.nil?
150
+ fail ArgumentError, 'path is nil' if path.nil?
151
+
152
+ request_url = options[:base_url] || @base_url
153
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
154
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
155
+ end
156
+
157
+ request_headers = @request_headers
158
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
159
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
160
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
161
+
162
+ super(request_url, method, path, options)
163
+ end
164
+
165
+
166
+ private
167
+ #
168
+ # Adds telemetry information.
169
+ #
170
+ def add_telemetry
171
+ sdk_information = 'azure_mgmt_consumption'
172
+ sdk_information = "#{sdk_information}/0.17.0"
173
+ add_user_agent_information(sdk_information)
174
+ end
175
+ end
176
+ 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_06_30
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class CostTags
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the CostTags 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 [CostTag] 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_06_30::Models::CostTag.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 [CostTag] 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 [CostTag] 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 [CostTag] 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 [CostTag] 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_06_30::Models::CostTag.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_06_30::Models::CostTag.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_06_30::Models::CostTag.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
@@ -0,0 +1,122 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Consumption::Mgmt::V2018_06_30
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class Forecasts
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Forecasts 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 forecast charges by subscriptionId.
27
+ #
28
+ # @param filter [String] May be used to filter forecasts by
29
+ # properties/usageDate (Utc time), properties/chargeType or properties/grain.
30
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
31
+ # currently support 'ne', 'or', or 'not'.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [ForecastsListResult] operation results.
36
+ #
37
+ def list(filter:nil, custom_headers:nil)
38
+ response = list_async(filter:filter, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Lists the forecast charges by subscriptionId.
44
+ #
45
+ # @param filter [String] May be used to filter forecasts by
46
+ # properties/usageDate (Utc time), properties/chargeType or properties/grain.
47
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
48
+ # currently support 'ne', 'or', or 'not'.
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
53
+ #
54
+ def list_with_http_info(filter:nil, custom_headers:nil)
55
+ list_async(filter:filter, custom_headers:custom_headers).value!
56
+ end
57
+
58
+ #
59
+ # Lists the forecast charges by subscriptionId.
60
+ #
61
+ # @param filter [String] May be used to filter forecasts by
62
+ # properties/usageDate (Utc time), properties/chargeType or properties/grain.
63
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
64
+ # currently support 'ne', 'or', or 'not'.
65
+ # @param [Hash{String => String}] A hash of custom headers that will be added
66
+ # to the HTTP request.
67
+ #
68
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
69
+ #
70
+ def list_async(filter:nil, custom_headers:nil)
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
73
+
74
+
75
+ request_headers = {}
76
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
77
+
78
+ # Set Headers
79
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
80
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
81
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/forecasts'
82
+
83
+ request_url = @base_url || @client.base_url
84
+
85
+ options = {
86
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
87
+ path_params: {'subscriptionId' => @client.subscription_id},
88
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
89
+ headers: request_headers.merge(custom_headers || {}),
90
+ base_url: request_url
91
+ }
92
+ promise = @client.make_request_async(:get, path_template, options)
93
+
94
+ promise = promise.then do |result|
95
+ http_response = result.response
96
+ status_code = http_response.status
97
+ response_content = http_response.body
98
+ unless status_code == 200
99
+ error_model = JSON.load(response_content)
100
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
101
+ end
102
+
103
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
104
+ # Deserialize Response
105
+ if status_code == 200
106
+ begin
107
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
108
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::ForecastsListResult.mapper()
109
+ result.body = @client.deserialize(result_mapper, parsed_response)
110
+ rescue Exception => e
111
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
112
+ end
113
+ end
114
+
115
+ result
116
+ end
117
+
118
+ promise.execute
119
+ end
120
+
121
+ end
122
+ end