azure_mgmt_billing 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/azure_mgmt_billing.rb +6 -0
- data/lib/generated/azure_mgmt_billing.rb +41 -0
- data/lib/generated/azure_mgmt_billing/billing_management_client.rb +138 -0
- data/lib/generated/azure_mgmt_billing/billing_periods.rb +347 -0
- data/lib/generated/azure_mgmt_billing/invoices.rb +466 -0
- data/lib/generated/azure_mgmt_billing/models/billing_period.rb +99 -0
- data/lib/generated/azure_mgmt_billing/models/billing_periods_list_result.rb +97 -0
- data/lib/generated/azure_mgmt_billing/models/download_url.rb +58 -0
- data/lib/generated/azure_mgmt_billing/models/error_details.rb +67 -0
- data/lib/generated/azure_mgmt_billing/models/error_response.rb +46 -0
- data/lib/generated/azure_mgmt_billing/models/invoice.rb +111 -0
- data/lib/generated/azure_mgmt_billing/models/invoices_list_result.rb +97 -0
- data/lib/generated/azure_mgmt_billing/models/operation.rb +56 -0
- data/lib/generated/azure_mgmt_billing/models/operation_display.rb +68 -0
- data/lib/generated/azure_mgmt_billing/models/operation_list_result.rb +99 -0
- data/lib/generated/azure_mgmt_billing/models/resource.rb +67 -0
- data/lib/generated/azure_mgmt_billing/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_billing/operations.rb +215 -0
- data/lib/generated/azure_mgmt_billing/version.rb +8 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 08b1c50ab16eeb76bb7cad1e3cfdfb7386585ff4
|
4
|
+
data.tar.gz: ba81831775c570160990470ac80bd91a94b26a23
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bd77430a52ce18ba2beaae61f052675aafbc4af0c32b1b21e2a3544201493a0799bb9450b3703213269859b991f6f2610942b743221e7f64c1d456ccc1403d00
|
7
|
+
data.tar.gz: d0617bd265e290febf55e3b2c6c91161912e5b33bf81c7aa2f7e43ac299f76bacabe2d0477f7537944baf5e5be84da8d9ffa2aa0af7774bb989499d555f78aa3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Microsoft Corporation
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,41 @@
|
|
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 'generated/azure_mgmt_billing/module_definition'
|
20
|
+
require 'ms_rest_azure'
|
21
|
+
|
22
|
+
module Azure::ARM::Billing
|
23
|
+
autoload :BillingPeriods, 'generated/azure_mgmt_billing/billing_periods.rb'
|
24
|
+
autoload :Invoices, 'generated/azure_mgmt_billing/invoices.rb'
|
25
|
+
autoload :Operations, 'generated/azure_mgmt_billing/operations.rb'
|
26
|
+
autoload :BillingManagementClient, 'generated/azure_mgmt_billing/billing_management_client.rb'
|
27
|
+
|
28
|
+
module Models
|
29
|
+
autoload :Resource, 'generated/azure_mgmt_billing/models/resource.rb'
|
30
|
+
autoload :BillingPeriodsListResult, 'generated/azure_mgmt_billing/models/billing_periods_list_result.rb'
|
31
|
+
autoload :InvoicesListResult, 'generated/azure_mgmt_billing/models/invoices_list_result.rb'
|
32
|
+
autoload :ErrorDetails, 'generated/azure_mgmt_billing/models/error_details.rb'
|
33
|
+
autoload :OperationDisplay, 'generated/azure_mgmt_billing/models/operation_display.rb'
|
34
|
+
autoload :DownloadUrl, 'generated/azure_mgmt_billing/models/download_url.rb'
|
35
|
+
autoload :Operation, 'generated/azure_mgmt_billing/models/operation.rb'
|
36
|
+
autoload :ErrorResponse, 'generated/azure_mgmt_billing/models/error_response.rb'
|
37
|
+
autoload :OperationListResult, 'generated/azure_mgmt_billing/models/operation_list_result.rb'
|
38
|
+
autoload :BillingPeriod, 'generated/azure_mgmt_billing/models/billing_period.rb'
|
39
|
+
autoload :Invoice, 'generated/azure_mgmt_billing/models/invoice.rb'
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,138 @@
|
|
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::ARM::Billing
|
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 2017-04-24-preview.
|
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 [BillingPeriods] billing_periods
|
39
|
+
attr_reader :billing_periods
|
40
|
+
|
41
|
+
# @return [Invoices] invoices
|
42
|
+
attr_reader :invoices
|
43
|
+
|
44
|
+
# @return [Operations] operations
|
45
|
+
attr_reader :operations
|
46
|
+
|
47
|
+
#
|
48
|
+
# Creates initializes a new instance of the BillingManagementClient class.
|
49
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
50
|
+
# @param base_url [String] the base URI of the service.
|
51
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
52
|
+
#
|
53
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
54
|
+
super(credentials, options)
|
55
|
+
@base_url = base_url || 'https://management.azure.com'
|
56
|
+
|
57
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
58
|
+
@credentials = credentials
|
59
|
+
|
60
|
+
@billing_periods = BillingPeriods.new(self)
|
61
|
+
@invoices = Invoices.new(self)
|
62
|
+
@operations = Operations.new(self)
|
63
|
+
@api_version = '2017-04-24-preview'
|
64
|
+
@accept_language = 'en-US'
|
65
|
+
@long_running_operation_retry_timeout = 30
|
66
|
+
@generate_client_request_id = true
|
67
|
+
add_telemetry
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
# Makes a request and returns the body of the response.
|
72
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
73
|
+
# @param path [String] the path, relative to {base_url}.
|
74
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
75
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
76
|
+
# Example:
|
77
|
+
#
|
78
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
79
|
+
# path = "/path"
|
80
|
+
# options = {
|
81
|
+
# body: request_content,
|
82
|
+
# query_params: {'api-version' => '2016-02-01'}
|
83
|
+
# }
|
84
|
+
# result = @client.make_request(:put, path, options)
|
85
|
+
#
|
86
|
+
def make_request(method, path, options = {})
|
87
|
+
result = make_request_with_http_info(method, path, options)
|
88
|
+
result.body unless result.nil?
|
89
|
+
end
|
90
|
+
|
91
|
+
#
|
92
|
+
# Makes a request and returns the operation response.
|
93
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
94
|
+
# @param path [String] the path, relative to {base_url}.
|
95
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
96
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
97
|
+
#
|
98
|
+
def make_request_with_http_info(method, path, options = {})
|
99
|
+
result = make_request_async(method, path, options).value!
|
100
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
101
|
+
result
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# Makes a request asynchronously.
|
106
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
107
|
+
# @param path [String] the path, relative to {base_url}.
|
108
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
109
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
110
|
+
#
|
111
|
+
def make_request_async(method, path, options = {})
|
112
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
113
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
114
|
+
|
115
|
+
request_url = options[:base_url] || @base_url
|
116
|
+
|
117
|
+
request_headers = @request_headers
|
118
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
119
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
120
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
121
|
+
|
122
|
+
super(request_url, method, path, options)
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
private
|
127
|
+
#
|
128
|
+
# Adds telemetry information.
|
129
|
+
#
|
130
|
+
def add_telemetry
|
131
|
+
sdk_information = 'azure_mgmt_billing'
|
132
|
+
if defined? Azure::ARM::Billing::VERSION
|
133
|
+
sdk_information = "#{sdk_information}/#{Azure::ARM::Billing::VERSION}"
|
134
|
+
end
|
135
|
+
add_user_agent_information(sdk_information)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,347 @@
|
|
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::ARM::Billing
|
7
|
+
#
|
8
|
+
# Billing client provides access to billing resources for Azure Web-Direct
|
9
|
+
# subscriptions. Other subscription types which were not purchased directly
|
10
|
+
# through the Azure web portal are not supported through this preview API.
|
11
|
+
#
|
12
|
+
class BillingPeriods
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
#
|
16
|
+
# Creates and initializes a new instance of the BillingPeriods class.
|
17
|
+
# @param client service class for accessing basic functionality.
|
18
|
+
#
|
19
|
+
def initialize(client)
|
20
|
+
@client = client
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [BillingManagementClient] reference to the BillingManagementClient
|
24
|
+
attr_reader :client
|
25
|
+
|
26
|
+
#
|
27
|
+
# Lists the available billing periods for a subscription in reverse
|
28
|
+
# chronological order.
|
29
|
+
#
|
30
|
+
# @param filter [String] May be used to filter billing periods by
|
31
|
+
# billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and
|
32
|
+
# 'and'. It does not currently support 'ne', 'or', or 'not'.
|
33
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
34
|
+
# returned a partial result. If a previous response contains a nextLink
|
35
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
36
|
+
# that specifies a starting point to use for subsequent calls.
|
37
|
+
# @param top [Integer] May be used to limit the number of results to the most
|
38
|
+
# recent N billing periods.
|
39
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
40
|
+
# will be added to the HTTP request.
|
41
|
+
#
|
42
|
+
# @return [Array<BillingPeriod>] operation results.
|
43
|
+
#
|
44
|
+
def list(filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
|
45
|
+
first_page = list_as_lazy(filter, skiptoken, top, custom_headers)
|
46
|
+
first_page.get_all_items
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Lists the available billing periods for a subscription in reverse
|
51
|
+
# chronological order.
|
52
|
+
#
|
53
|
+
# @param filter [String] May be used to filter billing periods by
|
54
|
+
# billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and
|
55
|
+
# 'and'. It does not currently support 'ne', 'or', or 'not'.
|
56
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
57
|
+
# returned a partial result. If a previous response contains a nextLink
|
58
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
59
|
+
# that specifies a starting point to use for subsequent calls.
|
60
|
+
# @param top [Integer] May be used to limit the number of results to the most
|
61
|
+
# recent N billing periods.
|
62
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
63
|
+
# will be added to the HTTP request.
|
64
|
+
#
|
65
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
66
|
+
#
|
67
|
+
def list_with_http_info(filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
|
68
|
+
list_async(filter, skiptoken, top, custom_headers).value!
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# Lists the available billing periods for a subscription in reverse
|
73
|
+
# chronological order.
|
74
|
+
#
|
75
|
+
# @param filter [String] May be used to filter billing periods by
|
76
|
+
# billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and
|
77
|
+
# 'and'. It does not currently support 'ne', 'or', or 'not'.
|
78
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
79
|
+
# returned a partial result. If a previous response contains a nextLink
|
80
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
81
|
+
# that specifies a starting point to use for subsequent calls.
|
82
|
+
# @param top [Integer] May be used to limit the number of results to the most
|
83
|
+
# recent N billing periods.
|
84
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
85
|
+
# to the HTTP request.
|
86
|
+
#
|
87
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
88
|
+
#
|
89
|
+
def list_async(filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
|
90
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
91
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
92
|
+
|
93
|
+
|
94
|
+
request_headers = {}
|
95
|
+
|
96
|
+
# Set Headers
|
97
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
98
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
99
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods'
|
100
|
+
|
101
|
+
request_url = @base_url || @client.base_url
|
102
|
+
|
103
|
+
options = {
|
104
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
105
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
106
|
+
query_params: {'api-version' => @client.api_version,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top},
|
107
|
+
headers: request_headers.merge(custom_headers || {}),
|
108
|
+
base_url: request_url
|
109
|
+
}
|
110
|
+
promise = @client.make_request_async(:get, path_template, options)
|
111
|
+
|
112
|
+
promise = promise.then do |result|
|
113
|
+
http_response = result.response
|
114
|
+
status_code = http_response.status
|
115
|
+
response_content = http_response.body
|
116
|
+
unless status_code == 200
|
117
|
+
error_model = JSON.load(response_content)
|
118
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
119
|
+
end
|
120
|
+
|
121
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
122
|
+
# Deserialize Response
|
123
|
+
if status_code == 200
|
124
|
+
begin
|
125
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
126
|
+
result_mapper = Azure::ARM::Billing::Models::BillingPeriodsListResult.mapper()
|
127
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
128
|
+
rescue Exception => e
|
129
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
result
|
134
|
+
end
|
135
|
+
|
136
|
+
promise.execute
|
137
|
+
end
|
138
|
+
|
139
|
+
#
|
140
|
+
# Gets a named billing period.
|
141
|
+
#
|
142
|
+
# @param billing_period_name [String] The name of a BillingPeriod resource.
|
143
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
144
|
+
# will be added to the HTTP request.
|
145
|
+
#
|
146
|
+
# @return [BillingPeriod] operation results.
|
147
|
+
#
|
148
|
+
def get(billing_period_name, custom_headers = nil)
|
149
|
+
response = get_async(billing_period_name, custom_headers).value!
|
150
|
+
response.body unless response.nil?
|
151
|
+
end
|
152
|
+
|
153
|
+
#
|
154
|
+
# Gets a named billing period.
|
155
|
+
#
|
156
|
+
# @param billing_period_name [String] The name of a BillingPeriod resource.
|
157
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
158
|
+
# will be added to the HTTP request.
|
159
|
+
#
|
160
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
161
|
+
#
|
162
|
+
def get_with_http_info(billing_period_name, custom_headers = nil)
|
163
|
+
get_async(billing_period_name, custom_headers).value!
|
164
|
+
end
|
165
|
+
|
166
|
+
#
|
167
|
+
# Gets a named billing period.
|
168
|
+
#
|
169
|
+
# @param billing_period_name [String] The name of a BillingPeriod resource.
|
170
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
171
|
+
# to the HTTP request.
|
172
|
+
#
|
173
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
174
|
+
#
|
175
|
+
def get_async(billing_period_name, custom_headers = nil)
|
176
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
177
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
178
|
+
fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
|
179
|
+
|
180
|
+
|
181
|
+
request_headers = {}
|
182
|
+
|
183
|
+
# Set Headers
|
184
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
185
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
186
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
|
187
|
+
|
188
|
+
request_url = @base_url || @client.base_url
|
189
|
+
|
190
|
+
options = {
|
191
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
192
|
+
path_params: {'subscriptionId' => @client.subscription_id,'billingPeriodName' => billing_period_name},
|
193
|
+
query_params: {'api-version' => @client.api_version},
|
194
|
+
headers: request_headers.merge(custom_headers || {}),
|
195
|
+
base_url: request_url
|
196
|
+
}
|
197
|
+
promise = @client.make_request_async(:get, path_template, options)
|
198
|
+
|
199
|
+
promise = promise.then do |result|
|
200
|
+
http_response = result.response
|
201
|
+
status_code = http_response.status
|
202
|
+
response_content = http_response.body
|
203
|
+
unless status_code == 200
|
204
|
+
error_model = JSON.load(response_content)
|
205
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
206
|
+
end
|
207
|
+
|
208
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
209
|
+
# Deserialize Response
|
210
|
+
if status_code == 200
|
211
|
+
begin
|
212
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
213
|
+
result_mapper = Azure::ARM::Billing::Models::BillingPeriod.mapper()
|
214
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
215
|
+
rescue Exception => e
|
216
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
result
|
221
|
+
end
|
222
|
+
|
223
|
+
promise.execute
|
224
|
+
end
|
225
|
+
|
226
|
+
#
|
227
|
+
# Lists the available billing periods for a subscription in reverse
|
228
|
+
# chronological order.
|
229
|
+
#
|
230
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
231
|
+
# to List operation.
|
232
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
233
|
+
# will be added to the HTTP request.
|
234
|
+
#
|
235
|
+
# @return [BillingPeriodsListResult] operation results.
|
236
|
+
#
|
237
|
+
def list_next(next_page_link, custom_headers = nil)
|
238
|
+
response = list_next_async(next_page_link, custom_headers).value!
|
239
|
+
response.body unless response.nil?
|
240
|
+
end
|
241
|
+
|
242
|
+
#
|
243
|
+
# Lists the available billing periods for a subscription in reverse
|
244
|
+
# chronological order.
|
245
|
+
#
|
246
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
247
|
+
# to List operation.
|
248
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
249
|
+
# will be added to the HTTP request.
|
250
|
+
#
|
251
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
252
|
+
#
|
253
|
+
def list_next_with_http_info(next_page_link, custom_headers = nil)
|
254
|
+
list_next_async(next_page_link, custom_headers).value!
|
255
|
+
end
|
256
|
+
|
257
|
+
#
|
258
|
+
# Lists the available billing periods for a subscription in reverse
|
259
|
+
# chronological order.
|
260
|
+
#
|
261
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
262
|
+
# to List operation.
|
263
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
264
|
+
# to the HTTP request.
|
265
|
+
#
|
266
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
267
|
+
#
|
268
|
+
def list_next_async(next_page_link, custom_headers = nil)
|
269
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
270
|
+
|
271
|
+
|
272
|
+
request_headers = {}
|
273
|
+
|
274
|
+
# Set Headers
|
275
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
276
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
277
|
+
path_template = '{nextLink}'
|
278
|
+
|
279
|
+
request_url = @base_url || @client.base_url
|
280
|
+
|
281
|
+
options = {
|
282
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
283
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
284
|
+
headers: request_headers.merge(custom_headers || {}),
|
285
|
+
base_url: request_url
|
286
|
+
}
|
287
|
+
promise = @client.make_request_async(:get, path_template, options)
|
288
|
+
|
289
|
+
promise = promise.then do |result|
|
290
|
+
http_response = result.response
|
291
|
+
status_code = http_response.status
|
292
|
+
response_content = http_response.body
|
293
|
+
unless status_code == 200
|
294
|
+
error_model = JSON.load(response_content)
|
295
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
296
|
+
end
|
297
|
+
|
298
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
299
|
+
# Deserialize Response
|
300
|
+
if status_code == 200
|
301
|
+
begin
|
302
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
303
|
+
result_mapper = Azure::ARM::Billing::Models::BillingPeriodsListResult.mapper()
|
304
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
305
|
+
rescue Exception => e
|
306
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
result
|
311
|
+
end
|
312
|
+
|
313
|
+
promise.execute
|
314
|
+
end
|
315
|
+
|
316
|
+
#
|
317
|
+
# Lists the available billing periods for a subscription in reverse
|
318
|
+
# chronological order.
|
319
|
+
#
|
320
|
+
# @param filter [String] May be used to filter billing periods by
|
321
|
+
# billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and
|
322
|
+
# 'and'. It does not currently support 'ne', 'or', or 'not'.
|
323
|
+
# @param skiptoken [String] Skiptoken is only used if a previous operation
|
324
|
+
# returned a partial result. If a previous response contains a nextLink
|
325
|
+
# element, the value of the nextLink element will include a skiptoken parameter
|
326
|
+
# that specifies a starting point to use for subsequent calls.
|
327
|
+
# @param top [Integer] May be used to limit the number of results to the most
|
328
|
+
# recent N billing periods.
|
329
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
330
|
+
# will be added to the HTTP request.
|
331
|
+
#
|
332
|
+
# @return [BillingPeriodsListResult] which provide lazy access to pages of the
|
333
|
+
# response.
|
334
|
+
#
|
335
|
+
def list_as_lazy(filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
|
336
|
+
response = list_async(filter, skiptoken, top, custom_headers).value!
|
337
|
+
unless response.nil?
|
338
|
+
page = response.body
|
339
|
+
page.next_method = Proc.new do |next_page_link|
|
340
|
+
list_next_async(next_page_link, custom_headers)
|
341
|
+
end
|
342
|
+
page
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|
347
|
+
end
|