azure_mgmt_subscriptions 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,142 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Subscriptions
7
+ #
8
+ # Tenants
9
+ #
10
+ class Tenants
11
+ include Azure::ARM::Subscriptions::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Tenants class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the SubscriptionClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets a list of the tenantIds.
27
+ #
28
+ # @param [Hash{String => String}] The hash of custom headers need to be
29
+ # applied to HTTP request.
30
+ #
31
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
32
+ # response.
33
+ #
34
+ def list(custom_headers = nil)
35
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
36
+ request_headers = {}
37
+
38
+ # Set Headers
39
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
40
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
41
+ path_template = '/tenants'
42
+ options = {
43
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
44
+ query_params: {'api-version' => @client.api_version},
45
+ headers: request_headers.merge(custom_headers || {})
46
+ }
47
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
48
+ promise = request.run_promise do |req|
49
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
50
+ end
51
+
52
+ promise = promise.then do |http_response|
53
+ status_code = http_response.status
54
+ response_content = http_response.body
55
+ unless status_code == 200
56
+ error_model = JSON.load(response_content)
57
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
58
+ end
59
+
60
+ # Create Result
61
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
62
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
63
+ # Deserialize Response
64
+ if status_code == 200
65
+ begin
66
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
67
+ unless parsed_response.nil?
68
+ parsed_response = TenantListResult.deserialize_object(parsed_response)
69
+ end
70
+ result.body = parsed_response
71
+ rescue Exception => e
72
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
73
+ end
74
+ end
75
+
76
+ result
77
+ end
78
+
79
+ promise.execute
80
+ end
81
+
82
+ #
83
+ # Gets a list of the tenantIds.
84
+ #
85
+ # @param next_page_link [String] The NextLink from the previous successful
86
+ # call to List operation.
87
+ # @param [Hash{String => String}] The hash of custom headers need to be
88
+ # applied to HTTP request.
89
+ #
90
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
91
+ # response.
92
+ #
93
+ def list_next(next_page_link, custom_headers = nil)
94
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
95
+ request_headers = {}
96
+
97
+ # Set Headers
98
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
99
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
100
+ path_template = '{nextLink}'
101
+ options = {
102
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
103
+ skip_encoding_path_params: {'nextLink' => next_page_link},
104
+ headers: request_headers.merge(custom_headers || {})
105
+ }
106
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
107
+ promise = request.run_promise do |req|
108
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
109
+ end
110
+
111
+ promise = promise.then do |http_response|
112
+ status_code = http_response.status
113
+ response_content = http_response.body
114
+ unless status_code == 200
115
+ error_model = JSON.load(response_content)
116
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
117
+ end
118
+
119
+ # Create Result
120
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
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
+ unless parsed_response.nil?
127
+ parsed_response = TenantListResult.deserialize_object(parsed_response)
128
+ end
129
+ result.body = parsed_response
130
+ rescue Exception => e
131
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
132
+ end
133
+ end
134
+
135
+ result
136
+ end
137
+
138
+ promise.execute
139
+ end
140
+
141
+ end
142
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Subscriptions
7
+ VERSION = '0.2.0'
8
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: azure_mgmt_subscriptions
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Microsoft Corporation
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dotenv
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: azure_mgmt_resources
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ms_rest_azure
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.2.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.2.0
97
+ description: Microsoft Azure Subscription Management Client Library for Ruby
98
+ email: azrubyteam@microsoft.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - ".rspec"
104
+ - LICENSE.txt
105
+ - Rakefile
106
+ - azure_mgmt_subscriptions.gemspec
107
+ - lib/azure_mgmt_subscriptions.rb
108
+ - lib/azure_mgmt_subscriptions/models/location.rb
109
+ - lib/azure_mgmt_subscriptions/models/location_list_result.rb
110
+ - lib/azure_mgmt_subscriptions/models/subscription.rb
111
+ - lib/azure_mgmt_subscriptions/models/subscription_list_result.rb
112
+ - lib/azure_mgmt_subscriptions/models/subscription_policies.rb
113
+ - lib/azure_mgmt_subscriptions/models/tenant_id_description.rb
114
+ - lib/azure_mgmt_subscriptions/models/tenant_list_result.rb
115
+ - lib/azure_mgmt_subscriptions/module_definition.rb
116
+ - lib/azure_mgmt_subscriptions/subscription_client.rb
117
+ - lib/azure_mgmt_subscriptions/subscriptions.rb
118
+ - lib/azure_mgmt_subscriptions/tenants.rb
119
+ - lib/azure_mgmt_subscriptions/version.rb
120
+ homepage: http://github.com/azure/azure-sdk-for-ruby
121
+ licenses:
122
+ - MIT
123
+ metadata: {}
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 1.9.3
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.4.6
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Official ruby client library to consume Microsoft Azure Subscription Management
144
+ services.
145
+ test_files: []