azure_mgmt_billing 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/billing_client.rb +7 -6
  3. data/lib/2017-04-24-preview/generated/azure_mgmt_billing/billing_management_client.rb +7 -6
  4. data/lib/2018-03-01-preview/generated/azure_mgmt_billing.rb +44 -0
  5. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/billing_management_client.rb +144 -0
  6. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/billing_periods.rb +371 -0
  7. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/enrollment_accounts.rb +303 -0
  8. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/invoices.rb +503 -0
  9. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/billing_period.rb +107 -0
  10. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/billing_periods_list_result.rb +101 -0
  11. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/download_url.rb +61 -0
  12. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/enrollment_account.rb +74 -0
  13. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/enrollment_account_list_result.rb +100 -0
  14. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/error_details.rb +71 -0
  15. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/error_response.rb +48 -0
  16. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/invoice.rb +120 -0
  17. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/invoices_list_result.rb +101 -0
  18. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/operation.rb +59 -0
  19. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/operation_display.rb +72 -0
  20. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/operation_list_result.rb +103 -0
  21. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/resource.rb +71 -0
  22. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/module_definition.rb +9 -0
  23. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/operations.rb +216 -0
  24. data/lib/azure_mgmt_billing.rb +1 -0
  25. data/lib/profiles/latest/modules/billing_profile_module.rb +43 -33
  26. data/lib/version.rb +1 -1
  27. metadata +24 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31aab0d91ba4272b03b032c4e2d7224a2e4e36a7
4
- data.tar.gz: 850e83673685ebb0dd046a38e630ae957fe5c7ca
3
+ metadata.gz: b80d141708a512a75fb2a369dbac0422b476a8ee
4
+ data.tar.gz: 7d54cccd848ce29aca050910df66b9e7729b2211
5
5
  SHA512:
6
- metadata.gz: d275f730ddb175424520ab1e30322d1537db6cb5275f3487c66c0add0a7e3ea9e730433aae5fd882fc5d6440ed00fbf2d6b2ff4016e80f4eef8566c71f8cf926
7
- data.tar.gz: c16bd6d42148ff4eea38fb83ceeabf048c027a6256c13c3d7d668bd9919e5ad37d23f394a07f402cc82c65fc1a724f57cd2a051bc866f7f33abb98220a6ff46c
6
+ metadata.gz: 1af5089a438712ed839097ba51e54d106158874fbd1d6e6a3965728cefb812e0451c0db5d812225a922ef55b8538d423c009a61573735d2e940e3da6b22c8675
7
+ data.tar.gz: 26e116c2be96ceb1899c56330e8ba9fe00e3e98ae023b486b7b9cbef1e6b0890740f836a1bf6113e81572e348f8941c29b5074ee1865f40717146d6111095b3b
@@ -24,15 +24,16 @@ module Azure::Billing::Mgmt::V2017_02_27_preview
24
24
  # @return [String] Azure Subscription ID.
25
25
  attr_accessor :subscription_id
26
26
 
27
- # @return [String] Gets or sets the preferred language for the response.
27
+ # @return [String] The preferred language for the response.
28
28
  attr_accessor :accept_language
29
29
 
30
- # @return [Integer] Gets or sets the retry timeout in seconds for Long
31
- # Running Operations. Default value is 30.
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
32
  attr_accessor :long_running_operation_retry_timeout
33
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.
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.
36
37
  attr_accessor :generate_client_request_id
37
38
 
38
39
  # @return [Invoices] invoices
@@ -128,7 +129,7 @@ module Azure::Billing::Mgmt::V2017_02_27_preview
128
129
  #
129
130
  def add_telemetry
130
131
  sdk_information = 'azure_mgmt_billing'
131
- sdk_information = "#{sdk_information}/0.16.0"
132
+ sdk_information = "#{sdk_information}/0.17.0"
132
133
  add_user_agent_information(sdk_information)
133
134
  end
134
135
  end
@@ -24,15 +24,16 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
24
24
  # @return [String] Azure Subscription ID.
25
25
  attr_accessor :subscription_id
26
26
 
27
- # @return [String] Gets or sets the preferred language for the response.
27
+ # @return [String] The preferred language for the response.
28
28
  attr_accessor :accept_language
29
29
 
30
- # @return [Integer] Gets or sets the retry timeout in seconds for Long
31
- # Running Operations. Default value is 30.
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
32
  attr_accessor :long_running_operation_retry_timeout
33
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.
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.
36
37
  attr_accessor :generate_client_request_id
37
38
 
38
39
  # @return [BillingPeriods] billing_periods
@@ -132,7 +133,7 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
132
133
  #
133
134
  def add_telemetry
134
135
  sdk_information = 'azure_mgmt_billing'
135
- sdk_information = "#{sdk_information}/0.16.0"
136
+ sdk_information = "#{sdk_information}/0.17.0"
136
137
  add_user_agent_information(sdk_information)
137
138
  end
138
139
  end
@@ -0,0 +1,44 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-03-01-preview/generated/azure_mgmt_billing/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Billing::Mgmt::V2018_03_01_preview
23
+ autoload :EnrollmentAccounts, '2018-03-01-preview/generated/azure_mgmt_billing/enrollment_accounts.rb'
24
+ autoload :BillingPeriods, '2018-03-01-preview/generated/azure_mgmt_billing/billing_periods.rb'
25
+ autoload :Invoices, '2018-03-01-preview/generated/azure_mgmt_billing/invoices.rb'
26
+ autoload :Operations, '2018-03-01-preview/generated/azure_mgmt_billing/operations.rb'
27
+ autoload :BillingManagementClient, '2018-03-01-preview/generated/azure_mgmt_billing/billing_management_client.rb'
28
+
29
+ module Models
30
+ autoload :ErrorResponse, '2018-03-01-preview/generated/azure_mgmt_billing/models/error_response.rb'
31
+ autoload :ErrorDetails, '2018-03-01-preview/generated/azure_mgmt_billing/models/error_details.rb'
32
+ autoload :OperationListResult, '2018-03-01-preview/generated/azure_mgmt_billing/models/operation_list_result.rb'
33
+ autoload :Resource, '2018-03-01-preview/generated/azure_mgmt_billing/models/resource.rb'
34
+ autoload :DownloadUrl, '2018-03-01-preview/generated/azure_mgmt_billing/models/download_url.rb'
35
+ autoload :InvoicesListResult, '2018-03-01-preview/generated/azure_mgmt_billing/models/invoices_list_result.rb'
36
+ autoload :BillingPeriodsListResult, '2018-03-01-preview/generated/azure_mgmt_billing/models/billing_periods_list_result.rb'
37
+ autoload :OperationDisplay, '2018-03-01-preview/generated/azure_mgmt_billing/models/operation_display.rb'
38
+ autoload :EnrollmentAccountListResult, '2018-03-01-preview/generated/azure_mgmt_billing/models/enrollment_account_list_result.rb'
39
+ autoload :Operation, '2018-03-01-preview/generated/azure_mgmt_billing/models/operation.rb'
40
+ autoload :EnrollmentAccount, '2018-03-01-preview/generated/azure_mgmt_billing/models/enrollment_account.rb'
41
+ autoload :BillingPeriod, '2018-03-01-preview/generated/azure_mgmt_billing/models/billing_period.rb'
42
+ autoload :Invoice, '2018-03-01-preview/generated/azure_mgmt_billing/models/invoice.rb'
43
+ end
44
+ end
@@ -0,0 +1,144 @@
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::Billing::Mgmt::V2018_03_01_preview
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class BillingManagementClient < 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-01-preview.
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 [EnrollmentAccounts] enrollment_accounts
40
+ attr_reader :enrollment_accounts
41
+
42
+ # @return [BillingPeriods] billing_periods
43
+ attr_reader :billing_periods
44
+
45
+ # @return [Invoices] invoices
46
+ attr_reader :invoices
47
+
48
+ # @return [Operations] operations
49
+ attr_reader :operations
50
+
51
+ #
52
+ # Creates initializes a new instance of the BillingManagementClient class.
53
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
54
+ # @param base_url [String] the base URI of the service.
55
+ # @param options [Array] filters to be applied to the HTTP requests.
56
+ #
57
+ def initialize(credentials = nil, base_url = nil, options = nil)
58
+ super(credentials, options)
59
+ @base_url = base_url || 'https://management.azure.com'
60
+
61
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
62
+ @credentials = credentials
63
+
64
+ @enrollment_accounts = EnrollmentAccounts.new(self)
65
+ @billing_periods = BillingPeriods.new(self)
66
+ @invoices = Invoices.new(self)
67
+ @operations = Operations.new(self)
68
+ @api_version = '2018-03-01-preview'
69
+ @accept_language = 'en-US'
70
+ @long_running_operation_retry_timeout = 30
71
+ @generate_client_request_id = true
72
+ add_telemetry
73
+ end
74
+
75
+ #
76
+ # Makes a request and returns the body of the response.
77
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
78
+ # @param path [String] the path, relative to {base_url}.
79
+ # @param options [Hash{String=>String}] specifying any request options like :body.
80
+ # @return [Hash{String=>String}] containing the body of the response.
81
+ # Example:
82
+ #
83
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
84
+ # path = "/path"
85
+ # options = {
86
+ # body: request_content,
87
+ # query_params: {'api-version' => '2016-02-01'}
88
+ # }
89
+ # result = @client.make_request(:put, path, options)
90
+ #
91
+ def make_request(method, path, options = {})
92
+ result = make_request_with_http_info(method, path, options)
93
+ result.body unless result.nil?
94
+ end
95
+
96
+ #
97
+ # Makes a request and returns the operation response.
98
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
99
+ # @param path [String] the path, relative to {base_url}.
100
+ # @param options [Hash{String=>String}] specifying any request options like :body.
101
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
102
+ #
103
+ def make_request_with_http_info(method, path, options = {})
104
+ result = make_request_async(method, path, options).value!
105
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
106
+ result
107
+ end
108
+
109
+ #
110
+ # Makes a request asynchronously.
111
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
112
+ # @param path [String] the path, relative to {base_url}.
113
+ # @param options [Hash{String=>String}] specifying any request options like :body.
114
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
115
+ #
116
+ def make_request_async(method, path, options = {})
117
+ fail ArgumentError, 'method is nil' if method.nil?
118
+ fail ArgumentError, 'path is nil' if path.nil?
119
+
120
+ request_url = options[:base_url] || @base_url
121
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
122
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
123
+ end
124
+
125
+ request_headers = @request_headers
126
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
127
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
128
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
129
+
130
+ super(request_url, method, path, options)
131
+ end
132
+
133
+
134
+ private
135
+ #
136
+ # Adds telemetry information.
137
+ #
138
+ def add_telemetry
139
+ sdk_information = 'azure_mgmt_billing'
140
+ sdk_information = "#{sdk_information}/0.17.0"
141
+ add_user_agent_information(sdk_information)
142
+ end
143
+ end
144
+ end
@@ -0,0 +1,371 @@
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::Billing::Mgmt::V2018_03_01_preview
7
+ #
8
+ # Billing client provides access to billing resources for Azure
9
+ # subscriptions.
10
+ #
11
+ class BillingPeriods
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the BillingPeriods class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [BillingManagementClient] reference to the BillingManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Lists the available billing periods for a subscription in reverse
27
+ # chronological order. This is only supported for Azure Web-Direct
28
+ # subscriptions. Other subscription types which were not purchased directly
29
+ # through the Azure web portal are not supported through this preview API.
30
+ #
31
+ # @param filter [String] May be used to filter billing periods by
32
+ # billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and
33
+ # 'and'. It does not currently support 'ne', 'or', or 'not'.
34
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
35
+ # returned a partial result. If a previous response contains a nextLink
36
+ # element, the value of the nextLink element will include a skiptoken parameter
37
+ # that specifies a starting point to use for subsequent calls.
38
+ # @param top [Integer] May be used to limit the number of results to the most
39
+ # recent N billing periods.
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<BillingPeriod>] operation results.
44
+ #
45
+ def list(filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
46
+ first_page = list_as_lazy(filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers)
47
+ first_page.get_all_items
48
+ end
49
+
50
+ #
51
+ # Lists the available billing periods for a subscription in reverse
52
+ # chronological order. This is only supported for Azure Web-Direct
53
+ # subscriptions. Other subscription types which were not purchased directly
54
+ # through the Azure web portal are not supported through this preview API.
55
+ #
56
+ # @param filter [String] May be used to filter billing periods by
57
+ # billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and
58
+ # 'and'. It does not currently support 'ne', 'or', or 'not'.
59
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
60
+ # returned a partial result. If a previous response contains a nextLink
61
+ # element, the value of the nextLink element will include a skiptoken parameter
62
+ # that specifies a starting point to use for subsequent calls.
63
+ # @param top [Integer] May be used to limit the number of results to the most
64
+ # recent N billing periods.
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, skiptoken:nil, top:nil, custom_headers:nil)
71
+ list_async(filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
72
+ end
73
+
74
+ #
75
+ # Lists the available billing periods for a subscription in reverse
76
+ # chronological order. This is only supported for Azure Web-Direct
77
+ # subscriptions. Other subscription types which were not purchased directly
78
+ # through the Azure web portal are not supported through this preview API.
79
+ #
80
+ # @param filter [String] May be used to filter billing periods by
81
+ # billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and
82
+ # 'and'. It does not currently support 'ne', 'or', or 'not'.
83
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
84
+ # returned a partial result. If a previous response contains a nextLink
85
+ # element, the value of the nextLink element will include a skiptoken parameter
86
+ # that specifies a starting point to use for subsequent calls.
87
+ # @param top [Integer] May be used to limit the number of results to the most
88
+ # recent N billing periods.
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, skiptoken:nil, top:nil, custom_headers:nil)
95
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
96
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
97
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '100'" if !top.nil? && top > 100
98
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
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.Billing/billingPeriods'
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: {'api-version' => @client.api_version,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top},
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::Billing::Mgmt::V2018_03_01_preview::Models::BillingPeriodsListResult.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
+ # Gets a named billing period. This is only supported for Azure Web-Direct
149
+ # subscriptions. Other subscription types which were not purchased directly
150
+ # through the Azure web portal are not supported through this preview API.
151
+ #
152
+ # @param billing_period_name [String] The name of a BillingPeriod resource.
153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
154
+ # will be added to the HTTP request.
155
+ #
156
+ # @return [BillingPeriod] operation results.
157
+ #
158
+ def get(billing_period_name, custom_headers:nil)
159
+ response = get_async(billing_period_name, custom_headers:custom_headers).value!
160
+ response.body unless response.nil?
161
+ end
162
+
163
+ #
164
+ # Gets a named billing period. This is only supported for Azure Web-Direct
165
+ # subscriptions. Other subscription types which were not purchased directly
166
+ # through the Azure web portal are not supported through this preview API.
167
+ #
168
+ # @param billing_period_name [String] The name of a BillingPeriod resource.
169
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
170
+ # will be added to the HTTP request.
171
+ #
172
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
173
+ #
174
+ def get_with_http_info(billing_period_name, custom_headers:nil)
175
+ get_async(billing_period_name, custom_headers:custom_headers).value!
176
+ end
177
+
178
+ #
179
+ # Gets a named billing period. This is only supported for Azure Web-Direct
180
+ # subscriptions. Other subscription types which were not purchased directly
181
+ # through the Azure web portal are not supported through this preview API.
182
+ #
183
+ # @param billing_period_name [String] The name of a BillingPeriod resource.
184
+ # @param [Hash{String => String}] A hash of custom headers that will be added
185
+ # to the HTTP request.
186
+ #
187
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
188
+ #
189
+ def get_async(billing_period_name, custom_headers:nil)
190
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
191
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
192
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
193
+
194
+
195
+ request_headers = {}
196
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
197
+
198
+ # Set Headers
199
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
200
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
201
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
202
+
203
+ request_url = @base_url || @client.base_url
204
+
205
+ options = {
206
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
207
+ path_params: {'subscriptionId' => @client.subscription_id,'billingPeriodName' => billing_period_name},
208
+ query_params: {'api-version' => @client.api_version},
209
+ headers: request_headers.merge(custom_headers || {}),
210
+ base_url: request_url
211
+ }
212
+ promise = @client.make_request_async(:get, path_template, options)
213
+
214
+ promise = promise.then do |result|
215
+ http_response = result.response
216
+ status_code = http_response.status
217
+ response_content = http_response.body
218
+ unless status_code == 200
219
+ error_model = JSON.load(response_content)
220
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
221
+ end
222
+
223
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
224
+ # Deserialize Response
225
+ if status_code == 200
226
+ begin
227
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
228
+ result_mapper = Azure::Billing::Mgmt::V2018_03_01_preview::Models::BillingPeriod.mapper()
229
+ result.body = @client.deserialize(result_mapper, parsed_response)
230
+ rescue Exception => e
231
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
232
+ end
233
+ end
234
+
235
+ result
236
+ end
237
+
238
+ promise.execute
239
+ end
240
+
241
+ #
242
+ # Lists the available billing periods for a subscription in reverse
243
+ # chronological order. This is only supported for Azure Web-Direct
244
+ # subscriptions. Other subscription types which were not purchased directly
245
+ # through the Azure web portal are not supported through this preview API.
246
+ #
247
+ # @param next_page_link [String] The NextLink from the previous successful call
248
+ # to List operation.
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ # @return [BillingPeriodsListResult] operation results.
253
+ #
254
+ def list_next(next_page_link, custom_headers:nil)
255
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
256
+ response.body unless response.nil?
257
+ end
258
+
259
+ #
260
+ # Lists the available billing periods for a subscription in reverse
261
+ # chronological order. This is only supported for Azure Web-Direct
262
+ # subscriptions. Other subscription types which were not purchased directly
263
+ # through the Azure web portal are not supported through this preview API.
264
+ #
265
+ # @param next_page_link [String] The NextLink from the previous successful call
266
+ # to List operation.
267
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
268
+ # will be added to the HTTP request.
269
+ #
270
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
271
+ #
272
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
273
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
274
+ end
275
+
276
+ #
277
+ # Lists the available billing periods for a subscription in reverse
278
+ # chronological order. This is only supported for Azure Web-Direct
279
+ # subscriptions. Other subscription types which were not purchased directly
280
+ # through the Azure web portal are not supported through this preview API.
281
+ #
282
+ # @param next_page_link [String] The NextLink from the previous successful call
283
+ # to List operation.
284
+ # @param [Hash{String => String}] A hash of custom headers that will be added
285
+ # to the HTTP request.
286
+ #
287
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
288
+ #
289
+ def list_next_async(next_page_link, custom_headers:nil)
290
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
291
+
292
+
293
+ request_headers = {}
294
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
295
+
296
+ # Set Headers
297
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
298
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
299
+ path_template = '{nextLink}'
300
+
301
+ request_url = @base_url || @client.base_url
302
+
303
+ options = {
304
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
305
+ skip_encoding_path_params: {'nextLink' => next_page_link},
306
+ headers: request_headers.merge(custom_headers || {}),
307
+ base_url: request_url
308
+ }
309
+ promise = @client.make_request_async(:get, path_template, options)
310
+
311
+ promise = promise.then do |result|
312
+ http_response = result.response
313
+ status_code = http_response.status
314
+ response_content = http_response.body
315
+ unless status_code == 200
316
+ error_model = JSON.load(response_content)
317
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
318
+ end
319
+
320
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
321
+ # Deserialize Response
322
+ if status_code == 200
323
+ begin
324
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
325
+ result_mapper = Azure::Billing::Mgmt::V2018_03_01_preview::Models::BillingPeriodsListResult.mapper()
326
+ result.body = @client.deserialize(result_mapper, parsed_response)
327
+ rescue Exception => e
328
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
329
+ end
330
+ end
331
+
332
+ result
333
+ end
334
+
335
+ promise.execute
336
+ end
337
+
338
+ #
339
+ # Lists the available billing periods for a subscription in reverse
340
+ # chronological order. This is only supported for Azure Web-Direct
341
+ # subscriptions. Other subscription types which were not purchased directly
342
+ # through the Azure web portal are not supported through this preview API.
343
+ #
344
+ # @param filter [String] May be used to filter billing periods by
345
+ # billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and
346
+ # 'and'. It does not currently support 'ne', 'or', or 'not'.
347
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
348
+ # returned a partial result. If a previous response contains a nextLink
349
+ # element, the value of the nextLink element will include a skiptoken parameter
350
+ # that specifies a starting point to use for subsequent calls.
351
+ # @param top [Integer] May be used to limit the number of results to the most
352
+ # recent N billing periods.
353
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
354
+ # will be added to the HTTP request.
355
+ #
356
+ # @return [BillingPeriodsListResult] which provide lazy access to pages of the
357
+ # response.
358
+ #
359
+ def list_as_lazy(filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
360
+ response = list_async(filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
361
+ unless response.nil?
362
+ page = response.body
363
+ page.next_method = Proc.new do |next_page_link|
364
+ list_next_async(next_page_link, custom_headers:custom_headers)
365
+ end
366
+ page
367
+ end
368
+ end
369
+
370
+ end
371
+ end