azure_mgmt_billing 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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-02-27-preview/generated/azure_mgmt_billing.rb +38 -0
  3. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/billing_client.rb +135 -0
  4. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/invoices.rb +472 -0
  5. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/models/download_url.rb +61 -0
  6. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/models/error_details.rb +71 -0
  7. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/models/error_response.rb +48 -0
  8. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/models/invoice.rb +99 -0
  9. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/models/invoices_list_result.rb +101 -0
  10. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/models/operation.rb +59 -0
  11. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/models/operation_display.rb +72 -0
  12. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/models/operation_list_result.rb +103 -0
  13. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/models/resource.rb +71 -0
  14. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/module_definition.rb +9 -0
  15. data/lib/2017-02-27-preview/generated/azure_mgmt_billing/operations.rb +217 -0
  16. data/lib/2017-04-24-preview/generated/azure_mgmt_billing/billing_management_client.rb +4 -1
  17. data/lib/2017-04-24-preview/generated/azure_mgmt_billing/billing_periods.rb +21 -18
  18. data/lib/2017-04-24-preview/generated/azure_mgmt_billing/invoices.rb +27 -23
  19. data/lib/2017-04-24-preview/generated/azure_mgmt_billing/operations.rb +15 -13
  20. data/lib/azure_mgmt_billing.rb +1 -0
  21. data/lib/profiles/latest/billing_latest_profile_client.rb +28 -9
  22. data/lib/profiles/latest/billing_module_definition.rb +0 -1
  23. data/lib/profiles/latest/modules/billing_profile_module.rb +62 -43
  24. data/lib/version.rb +1 -1
  25. metadata +16 -2
@@ -0,0 +1,103 @@
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::V2017_02_27_preview
7
+ module Models
8
+ #
9
+ # Result of the request to list billing operations. It contains a list of
10
+ # operations and a URL link to get the next set of results.
11
+ #
12
+ class OperationListResult
13
+
14
+ include MsRestAzure
15
+
16
+ include MsRest::JSONable
17
+ # @return [Array<Operation>] List of billing operations supported by the
18
+ # Microsoft.Billing resource provider.
19
+ attr_accessor :value
20
+
21
+ # @return [String] URL to get the next set of operation list results if
22
+ # there are any.
23
+ attr_accessor :next_link
24
+
25
+ # return [Proc] with next page method call.
26
+ attr_accessor :next_method
27
+
28
+ #
29
+ # Gets the rest of the items for the request, enabling auto-pagination.
30
+ #
31
+ # @return [Array<Operation>] operation results.
32
+ #
33
+ def get_all_items
34
+ items = @value
35
+ page = self
36
+ while page.next_link != nil do
37
+ page = page.get_next_page
38
+ items.concat(page.value)
39
+ end
40
+ items
41
+ end
42
+
43
+ #
44
+ # Gets the next page of results.
45
+ #
46
+ # @return [OperationListResult] with next page content.
47
+ #
48
+ def get_next_page
49
+ response = @next_method.call(@next_link).value! unless @next_method.nil?
50
+ unless response.nil?
51
+ @next_link = response.body.next_link
52
+ @value = response.body.value
53
+ self
54
+ end
55
+ end
56
+
57
+ #
58
+ # Mapper for OperationListResult class as Ruby Hash.
59
+ # This will be used for serialization/deserialization.
60
+ #
61
+ def self.mapper()
62
+ {
63
+ client_side_validation: true,
64
+ required: false,
65
+ serialized_name: 'OperationListResult',
66
+ type: {
67
+ name: 'Composite',
68
+ class_name: 'OperationListResult',
69
+ model_properties: {
70
+ value: {
71
+ client_side_validation: true,
72
+ required: false,
73
+ read_only: true,
74
+ serialized_name: 'value',
75
+ type: {
76
+ name: 'Sequence',
77
+ element: {
78
+ client_side_validation: true,
79
+ required: false,
80
+ serialized_name: 'OperationElementType',
81
+ type: {
82
+ name: 'Composite',
83
+ class_name: 'Operation'
84
+ }
85
+ }
86
+ }
87
+ },
88
+ next_link: {
89
+ client_side_validation: true,
90
+ required: false,
91
+ read_only: true,
92
+ serialized_name: 'nextLink',
93
+ type: {
94
+ name: 'String'
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,71 @@
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::V2017_02_27_preview
7
+ module Models
8
+ #
9
+ # The Resource model definition.
10
+ #
11
+ class Resource
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Resource Id
16
+ attr_accessor :id
17
+
18
+ # @return [String] Resource name
19
+ attr_accessor :name
20
+
21
+ # @return [String] Resource type
22
+ attr_accessor :type
23
+
24
+
25
+ #
26
+ # Mapper for Resource class as Ruby Hash.
27
+ # This will be used for serialization/deserialization.
28
+ #
29
+ def self.mapper()
30
+ {
31
+ client_side_validation: true,
32
+ required: false,
33
+ serialized_name: 'Resource',
34
+ type: {
35
+ name: 'Composite',
36
+ class_name: 'Resource',
37
+ model_properties: {
38
+ id: {
39
+ client_side_validation: true,
40
+ required: false,
41
+ read_only: true,
42
+ serialized_name: 'id',
43
+ type: {
44
+ name: 'String'
45
+ }
46
+ },
47
+ name: {
48
+ client_side_validation: true,
49
+ required: false,
50
+ read_only: true,
51
+ serialized_name: 'name',
52
+ type: {
53
+ name: 'String'
54
+ }
55
+ },
56
+ type: {
57
+ client_side_validation: true,
58
+ required: false,
59
+ read_only: true,
60
+ serialized_name: 'type',
61
+ type: {
62
+ name: 'String'
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::Billing end
8
+ module Azure::Billing::Mgmt end
9
+ module Azure::Billing::Mgmt::V2017_02_27_preview end
@@ -0,0 +1,217 @@
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::V2017_02_27_preview
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 Operations
13
+ include MsRestAzure
14
+
15
+ #
16
+ # Creates and initializes a new instance of the Operations class.
17
+ # @param client service class for accessing basic functionality.
18
+ #
19
+ def initialize(client)
20
+ @client = client
21
+ end
22
+
23
+ # @return [BillingClient] reference to the BillingClient
24
+ attr_reader :client
25
+
26
+ #
27
+ # Lists all of the available billing REST API operations.
28
+ #
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [Array<Operation>] operation results.
33
+ #
34
+ def list(custom_headers:nil)
35
+ first_page = list_as_lazy(custom_headers:custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Lists all of the available billing REST API operations.
41
+ #
42
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
43
+ # will be added to the HTTP request.
44
+ #
45
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
46
+ #
47
+ def list_with_http_info(custom_headers:nil)
48
+ list_async(custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Lists all of the available billing REST API operations.
53
+ #
54
+ # @param [Hash{String => String}] A hash of custom headers that will be added
55
+ # to the HTTP request.
56
+ #
57
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
58
+ #
59
+ def list_async(custom_headers:nil)
60
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
61
+
62
+
63
+ request_headers = {}
64
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
65
+
66
+ # Set Headers
67
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
68
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
69
+ path_template = 'providers/Microsoft.Billing/operations'
70
+
71
+ request_url = @base_url || @client.base_url
72
+
73
+ options = {
74
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
75
+ query_params: {'api-version' => @client.api_version},
76
+ headers: request_headers.merge(custom_headers || {}),
77
+ base_url: request_url
78
+ }
79
+ promise = @client.make_request_async(:get, path_template, options)
80
+
81
+ promise = promise.then do |result|
82
+ http_response = result.response
83
+ status_code = http_response.status
84
+ response_content = http_response.body
85
+ unless status_code == 200
86
+ error_model = JSON.load(response_content)
87
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
88
+ end
89
+
90
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
91
+ # Deserialize Response
92
+ if status_code == 200
93
+ begin
94
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
95
+ result_mapper = Azure::Billing::Mgmt::V2017_02_27_preview::Models::OperationListResult.mapper()
96
+ result.body = @client.deserialize(result_mapper, parsed_response)
97
+ rescue Exception => e
98
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
99
+ end
100
+ end
101
+
102
+ result
103
+ end
104
+
105
+ promise.execute
106
+ end
107
+
108
+ #
109
+ # Lists all of the available billing REST API operations.
110
+ #
111
+ # @param next_page_link [String] The NextLink from the previous successful call
112
+ # to List operation.
113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
114
+ # will be added to the HTTP request.
115
+ #
116
+ # @return [OperationListResult] operation results.
117
+ #
118
+ def list_next(next_page_link, custom_headers:nil)
119
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
120
+ response.body unless response.nil?
121
+ end
122
+
123
+ #
124
+ # Lists all of the available billing REST API operations.
125
+ #
126
+ # @param next_page_link [String] The NextLink from the previous successful call
127
+ # to List operation.
128
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
129
+ # will be added to the HTTP request.
130
+ #
131
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
132
+ #
133
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
134
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
135
+ end
136
+
137
+ #
138
+ # Lists all of the available billing REST API operations.
139
+ #
140
+ # @param next_page_link [String] The NextLink from the previous successful call
141
+ # to List operation.
142
+ # @param [Hash{String => String}] A hash of custom headers that will be added
143
+ # to the HTTP request.
144
+ #
145
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
146
+ #
147
+ def list_next_async(next_page_link, custom_headers:nil)
148
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
149
+
150
+
151
+ request_headers = {}
152
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
153
+
154
+ # Set Headers
155
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
156
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
157
+ path_template = '{nextLink}'
158
+
159
+ request_url = @base_url || @client.base_url
160
+
161
+ options = {
162
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
163
+ skip_encoding_path_params: {'nextLink' => next_page_link},
164
+ headers: request_headers.merge(custom_headers || {}),
165
+ base_url: request_url
166
+ }
167
+ promise = @client.make_request_async(:get, path_template, options)
168
+
169
+ promise = promise.then do |result|
170
+ http_response = result.response
171
+ status_code = http_response.status
172
+ response_content = http_response.body
173
+ unless status_code == 200
174
+ error_model = JSON.load(response_content)
175
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
176
+ end
177
+
178
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
179
+ # Deserialize Response
180
+ if status_code == 200
181
+ begin
182
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
183
+ result_mapper = Azure::Billing::Mgmt::V2017_02_27_preview::Models::OperationListResult.mapper()
184
+ result.body = @client.deserialize(result_mapper, parsed_response)
185
+ rescue Exception => e
186
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
187
+ end
188
+ end
189
+
190
+ result
191
+ end
192
+
193
+ promise.execute
194
+ end
195
+
196
+ #
197
+ # Lists all of the available billing REST API operations.
198
+ #
199
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
200
+ # will be added to the HTTP request.
201
+ #
202
+ # @return [OperationListResult] which provide lazy access to pages of the
203
+ # response.
204
+ #
205
+ def list_as_lazy(custom_headers:nil)
206
+ response = list_async(custom_headers:custom_headers).value!
207
+ unless response.nil?
208
+ page = response.body
209
+ page.next_method = Proc.new do |next_page_link|
210
+ list_next_async(next_page_link, custom_headers:custom_headers)
211
+ end
212
+ page
213
+ end
214
+ end
215
+
216
+ end
217
+ end
@@ -113,6 +113,9 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
113
113
  fail ArgumentError, 'path is nil' if path.nil?
114
114
 
115
115
  request_url = options[:base_url] || @base_url
116
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
117
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
118
+ end
116
119
 
117
120
  request_headers = @request_headers
118
121
  request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
@@ -129,7 +132,7 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
129
132
  #
130
133
  def add_telemetry
131
134
  sdk_information = 'azure_mgmt_billing'
132
- sdk_information = "#{sdk_information}/0.15.2"
135
+ sdk_information = "#{sdk_information}/0.16.0"
133
136
  add_user_agent_information(sdk_information)
134
137
  end
135
138
  end
@@ -41,8 +41,8 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
41
41
  #
42
42
  # @return [Array<BillingPeriod>] operation results.
43
43
  #
44
- def list(filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
45
- first_page = list_as_lazy(filter, skiptoken, top, custom_headers)
44
+ def list(filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
45
+ first_page = list_as_lazy(filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers)
46
46
  first_page.get_all_items
47
47
  end
48
48
 
@@ -64,8 +64,8 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
64
64
  #
65
65
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
66
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!
67
+ def list_with_http_info(filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
68
+ list_async(filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
69
69
  end
70
70
 
71
71
  #
@@ -86,7 +86,7 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
86
86
  #
87
87
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
88
88
  #
89
- def list_async(filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
89
+ def list_async(filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
90
90
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
91
91
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
92
92
  fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '100'" if !top.nil? && top > 100
@@ -94,6 +94,7 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
94
94
 
95
95
 
96
96
  request_headers = {}
97
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
97
98
 
98
99
  # Set Headers
99
100
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
@@ -147,8 +148,8 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
147
148
  #
148
149
  # @return [BillingPeriod] operation results.
149
150
  #
150
- def get(billing_period_name, custom_headers = nil)
151
- response = get_async(billing_period_name, custom_headers).value!
151
+ def get(billing_period_name, custom_headers:nil)
152
+ response = get_async(billing_period_name, custom_headers:custom_headers).value!
152
153
  response.body unless response.nil?
153
154
  end
154
155
 
@@ -161,8 +162,8 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
161
162
  #
162
163
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
163
164
  #
164
- def get_with_http_info(billing_period_name, custom_headers = nil)
165
- get_async(billing_period_name, custom_headers).value!
165
+ def get_with_http_info(billing_period_name, custom_headers:nil)
166
+ get_async(billing_period_name, custom_headers:custom_headers).value!
166
167
  end
167
168
 
168
169
  #
@@ -174,13 +175,14 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
174
175
  #
175
176
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
176
177
  #
177
- def get_async(billing_period_name, custom_headers = nil)
178
+ def get_async(billing_period_name, custom_headers:nil)
178
179
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
179
180
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
180
181
  fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
181
182
 
182
183
 
183
184
  request_headers = {}
185
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
184
186
 
185
187
  # Set Headers
186
188
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
@@ -236,8 +238,8 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
236
238
  #
237
239
  # @return [BillingPeriodsListResult] operation results.
238
240
  #
239
- def list_next(next_page_link, custom_headers = nil)
240
- response = list_next_async(next_page_link, custom_headers).value!
241
+ def list_next(next_page_link, custom_headers:nil)
242
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
241
243
  response.body unless response.nil?
242
244
  end
243
245
 
@@ -252,8 +254,8 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
252
254
  #
253
255
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
254
256
  #
255
- def list_next_with_http_info(next_page_link, custom_headers = nil)
256
- list_next_async(next_page_link, custom_headers).value!
257
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
258
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
257
259
  end
258
260
 
259
261
  #
@@ -267,11 +269,12 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
267
269
  #
268
270
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
269
271
  #
270
- def list_next_async(next_page_link, custom_headers = nil)
272
+ def list_next_async(next_page_link, custom_headers:nil)
271
273
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
272
274
 
273
275
 
274
276
  request_headers = {}
277
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
275
278
 
276
279
  # Set Headers
277
280
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
@@ -334,12 +337,12 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
334
337
  # @return [BillingPeriodsListResult] which provide lazy access to pages of the
335
338
  # response.
336
339
  #
337
- def list_as_lazy(filter = nil, skiptoken = nil, top = nil, custom_headers = nil)
338
- response = list_async(filter, skiptoken, top, custom_headers).value!
340
+ def list_as_lazy(filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
341
+ response = list_async(filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
339
342
  unless response.nil?
340
343
  page = response.body
341
344
  page.next_method = Proc.new do |next_page_link|
342
- list_next_async(next_page_link, custom_headers)
345
+ list_next_async(next_page_link, custom_headers:custom_headers)
343
346
  end
344
347
  page
345
348
  end