azure_mgmt_consumption 0.14.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a1be3e4126ead6554026849c3de09f31ef02a66f
4
+ data.tar.gz: dc172ce6a4a46fb66828484a9176e79f4c7bb18c
5
+ SHA512:
6
+ metadata.gz: 090e898a76c39f95084010f8ced2375589a02cfb4147b58e0f6a24524ffc711bfabfc78542652f47f51c57dc794836c6bd743b16ce8c3cca55a90518709695eb
7
+ data.tar.gz: 12e197aeebce5aec5f03444bda803906a35023ab7b4f4747b058b376c16037936f607a2ed1917cd2d9de5b26e29758d3ea8de44a5a25300d8e1abc5bbe2c7d2a
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,6 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require 'generated/azure_mgmt_consumption'
6
+
@@ -0,0 +1,38 @@
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_consumption/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::Consumption
23
+ autoload :UsageDetails, 'generated/azure_mgmt_consumption/usage_details.rb'
24
+ autoload :Operations, 'generated/azure_mgmt_consumption/operations.rb'
25
+ autoload :ConsumptionManagementClient, 'generated/azure_mgmt_consumption/consumption_management_client.rb'
26
+
27
+ module Models
28
+ autoload :ErrorResponse, 'generated/azure_mgmt_consumption/models/error_response.rb'
29
+ autoload :OperationDisplay, 'generated/azure_mgmt_consumption/models/operation_display.rb'
30
+ autoload :UsageDetailsListResult, 'generated/azure_mgmt_consumption/models/usage_details_list_result.rb'
31
+ autoload :Operation, 'generated/azure_mgmt_consumption/models/operation.rb'
32
+ autoload :MeterDetails, 'generated/azure_mgmt_consumption/models/meter_details.rb'
33
+ autoload :OperationListResult, 'generated/azure_mgmt_consumption/models/operation_list_result.rb'
34
+ autoload :ErrorDetails, 'generated/azure_mgmt_consumption/models/error_details.rb'
35
+ autoload :Resource, 'generated/azure_mgmt_consumption/models/resource.rb'
36
+ autoload :UsageDetail, 'generated/azure_mgmt_consumption/models/usage_detail.rb'
37
+ end
38
+ end
@@ -0,0 +1,134 @@
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::Consumption
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class ConsumptionManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Version of the API to be used with the client request.
21
+ # The current version is 2017-02-27-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 [UsageDetails] usage_details
39
+ attr_reader :usage_details
40
+
41
+ # @return [Operations] operations
42
+ attr_reader :operations
43
+
44
+ #
45
+ # Creates initializes a new instance of the ConsumptionManagementClient class.
46
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
47
+ # @param base_url [String] the base URI of the service.
48
+ # @param options [Array] filters to be applied to the HTTP requests.
49
+ #
50
+ def initialize(credentials = nil, base_url = nil, options = nil)
51
+ super(credentials, options)
52
+ @base_url = base_url || 'https://management.azure.com'
53
+
54
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
55
+ @credentials = credentials
56
+
57
+ @usage_details = UsageDetails.new(self)
58
+ @operations = Operations.new(self)
59
+ @api_version = '2017-04-24-preview'
60
+ @accept_language = 'en-US'
61
+ @long_running_operation_retry_timeout = 30
62
+ @generate_client_request_id = true
63
+ add_telemetry
64
+ end
65
+
66
+ #
67
+ # Makes a request and returns the body of the response.
68
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
69
+ # @param path [String] the path, relative to {base_url}.
70
+ # @param options [Hash{String=>String}] specifying any request options like :body.
71
+ # @return [Hash{String=>String}] containing the body of the response.
72
+ # Example:
73
+ #
74
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
75
+ # path = "/path"
76
+ # options = {
77
+ # body: request_content,
78
+ # query_params: {'api-version' => '2016-02-01'}
79
+ # }
80
+ # result = @client.make_request(:put, path, options)
81
+ #
82
+ def make_request(method, path, options = {})
83
+ result = make_request_with_http_info(method, path, options)
84
+ result.body unless result.nil?
85
+ end
86
+
87
+ #
88
+ # Makes a request and returns the operation response.
89
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
90
+ # @param path [String] the path, relative to {base_url}.
91
+ # @param options [Hash{String=>String}] specifying any request options like :body.
92
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
93
+ #
94
+ def make_request_with_http_info(method, path, options = {})
95
+ result = make_request_async(method, path, options).value!
96
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
97
+ result
98
+ end
99
+
100
+ #
101
+ # Makes a request asynchronously.
102
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
103
+ # @param path [String] the path, relative to {base_url}.
104
+ # @param options [Hash{String=>String}] specifying any request options like :body.
105
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
106
+ #
107
+ def make_request_async(method, path, options = {})
108
+ fail ArgumentError, 'method is nil' if method.nil?
109
+ fail ArgumentError, 'path is nil' if path.nil?
110
+
111
+ request_url = options[:base_url] || @base_url
112
+
113
+ request_headers = @request_headers
114
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
115
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
116
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
117
+
118
+ super(request_url, method, path, options)
119
+ end
120
+
121
+
122
+ private
123
+ #
124
+ # Adds telemetry information.
125
+ #
126
+ def add_telemetry
127
+ sdk_information = 'azure_mgmt_consumption'
128
+ if defined? Azure::ARM::Consumption::VERSION
129
+ sdk_information = "#{sdk_information}/#{Azure::ARM::Consumption::VERSION}"
130
+ end
131
+ add_user_agent_information(sdk_information)
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,67 @@
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::Consumption
7
+ module Models
8
+ #
9
+ # The details of the error.
10
+ #
11
+ class ErrorDetails
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Error code.
16
+ attr_accessor :code
17
+
18
+ # @return [String] Error message indicating why the operation failed.
19
+ attr_accessor :message
20
+
21
+ # @return [String] The target of the particular error.
22
+ attr_accessor :target
23
+
24
+
25
+ #
26
+ # Mapper for ErrorDetails class as Ruby Hash.
27
+ # This will be used for serialization/deserialization.
28
+ #
29
+ def self.mapper()
30
+ {
31
+ required: false,
32
+ serialized_name: 'ErrorDetails',
33
+ type: {
34
+ name: 'Composite',
35
+ class_name: 'ErrorDetails',
36
+ model_properties: {
37
+ code: {
38
+ required: false,
39
+ read_only: true,
40
+ serialized_name: 'code',
41
+ type: {
42
+ name: 'String'
43
+ }
44
+ },
45
+ message: {
46
+ required: false,
47
+ read_only: true,
48
+ serialized_name: 'message',
49
+ type: {
50
+ name: 'String'
51
+ }
52
+ },
53
+ target: {
54
+ required: false,
55
+ read_only: true,
56
+ serialized_name: 'target',
57
+ type: {
58
+ name: 'String'
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,46 @@
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::Consumption
7
+ module Models
8
+ #
9
+ # Error response indicates that the service is not able to process the
10
+ # incoming request. The reason is provided in the error message.
11
+ #
12
+ class ErrorResponse
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [ErrorDetails] The details of the error.
17
+ attr_accessor :error
18
+
19
+
20
+ #
21
+ # Mapper for ErrorResponse class as Ruby Hash.
22
+ # This will be used for serialization/deserialization.
23
+ #
24
+ def self.mapper()
25
+ {
26
+ required: false,
27
+ serialized_name: 'ErrorResponse',
28
+ type: {
29
+ name: 'Composite',
30
+ class_name: 'ErrorResponse',
31
+ model_properties: {
32
+ error: {
33
+ required: false,
34
+ serialized_name: 'error',
35
+ type: {
36
+ name: 'Composite',
37
+ class_name: 'ErrorDetails'
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,114 @@
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::Consumption
7
+ module Models
8
+ #
9
+ # The properties of the meter detail.
10
+ #
11
+ class MeterDetails
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] The name of the meter, within the given meter category
16
+ attr_accessor :meter_name
17
+
18
+ # @return [String] The category of the meter, for example, 'Cloud
19
+ # services', 'Networking', etc..
20
+ attr_accessor :meter_category
21
+
22
+ # @return [String] The subcategory of the meter, for example, 'A6 Cloud
23
+ # services', 'ExpressRoute (IXP)', etc..
24
+ attr_accessor :meter_sub_category
25
+
26
+ # @return [String] The unit in which the meter consumption is charged,
27
+ # for example, 'Hours', 'GB', etc.
28
+ attr_accessor :unit
29
+
30
+ # @return [String] The location in which the Azure service is available.
31
+ attr_accessor :meter_location
32
+
33
+ # @return The total included quantity associated with the offer.
34
+ attr_accessor :total_included_quantity
35
+
36
+ # @return The pretax listing price.
37
+ attr_accessor :pretax_standard_rate
38
+
39
+
40
+ #
41
+ # Mapper for MeterDetails class as Ruby Hash.
42
+ # This will be used for serialization/deserialization.
43
+ #
44
+ def self.mapper()
45
+ {
46
+ required: false,
47
+ serialized_name: 'MeterDetails',
48
+ type: {
49
+ name: 'Composite',
50
+ class_name: 'MeterDetails',
51
+ model_properties: {
52
+ meter_name: {
53
+ required: false,
54
+ read_only: true,
55
+ serialized_name: 'meterName',
56
+ type: {
57
+ name: 'String'
58
+ }
59
+ },
60
+ meter_category: {
61
+ required: false,
62
+ read_only: true,
63
+ serialized_name: 'meterCategory',
64
+ type: {
65
+ name: 'String'
66
+ }
67
+ },
68
+ meter_sub_category: {
69
+ required: false,
70
+ read_only: true,
71
+ serialized_name: 'meterSubCategory',
72
+ type: {
73
+ name: 'String'
74
+ }
75
+ },
76
+ unit: {
77
+ required: false,
78
+ read_only: true,
79
+ serialized_name: 'unit',
80
+ type: {
81
+ name: 'String'
82
+ }
83
+ },
84
+ meter_location: {
85
+ required: false,
86
+ read_only: true,
87
+ serialized_name: 'meterLocation',
88
+ type: {
89
+ name: 'String'
90
+ }
91
+ },
92
+ total_included_quantity: {
93
+ required: false,
94
+ read_only: true,
95
+ serialized_name: 'totalIncludedQuantity',
96
+ type: {
97
+ name: 'Number'
98
+ }
99
+ },
100
+ pretax_standard_rate: {
101
+ required: false,
102
+ read_only: true,
103
+ serialized_name: 'pretaxStandardRate',
104
+ type: {
105
+ name: 'Number'
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ end
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,56 @@
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::Consumption
7
+ module Models
8
+ #
9
+ # A Consumption REST API operation.
10
+ #
11
+ class Operation
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Operation name: {provider}/{resource}/{operation}.
16
+ attr_accessor :name
17
+
18
+ # @return [OperationDisplay] The object that represents the operation.
19
+ attr_accessor :display
20
+
21
+
22
+ #
23
+ # Mapper for Operation class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ required: false,
29
+ serialized_name: 'Operation',
30
+ type: {
31
+ name: 'Composite',
32
+ class_name: 'Operation',
33
+ model_properties: {
34
+ name: {
35
+ required: false,
36
+ read_only: true,
37
+ serialized_name: 'name',
38
+ type: {
39
+ name: 'String'
40
+ }
41
+ },
42
+ display: {
43
+ required: false,
44
+ serialized_name: 'display',
45
+ type: {
46
+ name: 'Composite',
47
+ class_name: 'OperationDisplay'
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ end
54
+ end
55
+ end
56
+ end