azure_mgmt_billing 0.15.2 → 0.17.3

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 (49) hide show
  1. checksums.yaml +5 -5
  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 +136 -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 +80 -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 +10 -6
  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/models/billing_periods_list_result.rb +1 -1
  20. data/lib/2017-04-24-preview/generated/azure_mgmt_billing/models/invoices_list_result.rb +1 -1
  21. data/lib/2017-04-24-preview/generated/azure_mgmt_billing/models/operation_list_result.rb +1 -1
  22. data/lib/2017-04-24-preview/generated/azure_mgmt_billing/models/resource.rb +9 -0
  23. data/lib/2017-04-24-preview/generated/azure_mgmt_billing/operations.rb +15 -13
  24. data/lib/2018-03-01-preview/generated/azure_mgmt_billing.rb +44 -0
  25. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/billing_management_client.rb +144 -0
  26. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/billing_periods.rb +371 -0
  27. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/enrollment_accounts.rb +303 -0
  28. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/invoices.rb +503 -0
  29. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/billing_period.rb +107 -0
  30. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/billing_periods_list_result.rb +101 -0
  31. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/download_url.rb +61 -0
  32. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/enrollment_account.rb +74 -0
  33. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/enrollment_account_list_result.rb +100 -0
  34. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/error_details.rb +71 -0
  35. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/error_response.rb +48 -0
  36. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/invoice.rb +120 -0
  37. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/invoices_list_result.rb +101 -0
  38. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/operation.rb +59 -0
  39. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/operation_display.rb +72 -0
  40. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/operation_list_result.rb +103 -0
  41. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/models/resource.rb +80 -0
  42. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/module_definition.rb +9 -0
  43. data/lib/2018-03-01-preview/generated/azure_mgmt_billing/operations.rb +216 -0
  44. data/lib/azure_mgmt_billing.rb +2 -0
  45. data/lib/profiles/latest/billing_latest_profile_client.rb +28 -9
  46. data/lib/profiles/latest/billing_module_definition.rb +0 -1
  47. data/lib/profiles/latest/modules/billing_profile_module.rb +87 -58
  48. data/lib/version.rb +1 -1
  49. metadata +39 -5
@@ -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 && !page.next_link.strip.empty? 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,80 @@
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
+ # @return [String] the name of the resource group of the resource.
26
+ def resource_group
27
+ unless self.id.nil?
28
+ groups = self.id.match(/.+\/resourceGroups\/([^\/]+)\/.+/)
29
+ groups.captures[0].strip if groups
30
+ end
31
+ end
32
+
33
+
34
+ #
35
+ # Mapper for Resource class as Ruby Hash.
36
+ # This will be used for serialization/deserialization.
37
+ #
38
+ def self.mapper()
39
+ {
40
+ client_side_validation: true,
41
+ required: false,
42
+ serialized_name: 'Resource',
43
+ type: {
44
+ name: 'Composite',
45
+ class_name: 'Resource',
46
+ model_properties: {
47
+ id: {
48
+ client_side_validation: true,
49
+ required: false,
50
+ read_only: true,
51
+ serialized_name: 'id',
52
+ type: {
53
+ name: 'String'
54
+ }
55
+ },
56
+ name: {
57
+ client_side_validation: true,
58
+ required: false,
59
+ read_only: true,
60
+ serialized_name: 'name',
61
+ type: {
62
+ name: 'String'
63
+ }
64
+ },
65
+ type: {
66
+ client_side_validation: true,
67
+ required: false,
68
+ read_only: true,
69
+ serialized_name: 'type',
70
+ type: {
71
+ name: 'String'
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ end
78
+ end
79
+ end
80
+ 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
@@ -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
@@ -113,6 +114,9 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
113
114
  fail ArgumentError, 'path is nil' if path.nil?
114
115
 
115
116
  request_url = options[:base_url] || @base_url
117
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
118
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
119
+ end
116
120
 
117
121
  request_headers = @request_headers
118
122
  request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
@@ -129,7 +133,7 @@ module Azure::Billing::Mgmt::V2017_04_24_preview
129
133
  #
130
134
  def add_telemetry
131
135
  sdk_information = 'azure_mgmt_billing'
132
- sdk_information = "#{sdk_information}/0.15.2"
136
+ sdk_information = "#{sdk_information}/0.17.3"
133
137
  add_user_agent_information(sdk_information)
134
138
  end
135
139
  end