azure_mgmt_consumption 0.15.2 → 0.16.0

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