azure_mgmt_authorization 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_authorization.gemspec +34 -0
  6. data/lib/azure_mgmt_authorization/authorization_management_client.rb +84 -0
  7. data/lib/azure_mgmt_authorization/classic_administrators.rb +145 -0
  8. data/lib/azure_mgmt_authorization/models/classic_administrator.rb +90 -0
  9. data/lib/azure_mgmt_authorization/models/classic_administrator_list_result.rb +77 -0
  10. data/lib/azure_mgmt_authorization/models/classic_administrator_properties.rb +65 -0
  11. data/lib/azure_mgmt_authorization/models/permission.rb +66 -0
  12. data/lib/azure_mgmt_authorization/models/permission_get_result.rb +76 -0
  13. data/lib/azure_mgmt_authorization/models/provider_operation.rb +92 -0
  14. data/lib/azure_mgmt_authorization/models/provider_operations_metadata.rb +142 -0
  15. data/lib/azure_mgmt_authorization/models/provider_operations_metadata_list_result.rb +77 -0
  16. data/lib/azure_mgmt_authorization/models/resource_type.rb +95 -0
  17. data/lib/azure_mgmt_authorization/models/role_assignment.rb +90 -0
  18. data/lib/azure_mgmt_authorization/models/role_assignment_create_parameters.rb +63 -0
  19. data/lib/azure_mgmt_authorization/models/role_assignment_filter.rb +56 -0
  20. data/lib/azure_mgmt_authorization/models/role_assignment_list_result.rb +86 -0
  21. data/lib/azure_mgmt_authorization/models/role_assignment_properties.rb +65 -0
  22. data/lib/azure_mgmt_authorization/models/role_assignment_properties_with_scope.rb +74 -0
  23. data/lib/azure_mgmt_authorization/models/role_definition.rb +90 -0
  24. data/lib/azure_mgmt_authorization/models/role_definition_filter.rb +56 -0
  25. data/lib/azure_mgmt_authorization/models/role_definition_list_result.rb +76 -0
  26. data/lib/azure_mgmt_authorization/models/role_definition_properties.rb +113 -0
  27. data/lib/azure_mgmt_authorization/module_definition.rb +8 -0
  28. data/lib/azure_mgmt_authorization/permissions.rb +277 -0
  29. data/lib/azure_mgmt_authorization/provider_operations_metadata_operations.rb +207 -0
  30. data/lib/azure_mgmt_authorization/role_assignments.rb +907 -0
  31. data/lib/azure_mgmt_authorization/role_definitions.rb +408 -0
  32. data/lib/azure_mgmt_authorization/version.rb +8 -0
  33. data/lib/azure_mgmt_authorization.rb +50 -0
  34. metadata +147 -0
@@ -0,0 +1,277 @@
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::Authorization
7
+ #
8
+ # Permissions
9
+ #
10
+ class Permissions
11
+ include Azure::ARM::Authorization::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Permissions 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 AuthorizationManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets a resource group permissions.
27
+ #
28
+ # @param resource_group_name [String] Name of the resource group to get the
29
+ # permissions for.The name is case insensitive.
30
+ # @param [Hash{String => String}] The hash of custom headers need to be
31
+ # applied to HTTP request.
32
+ #
33
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
34
+ # response.
35
+ #
36
+ def list_for_resource_group(resource_group_name, custom_headers = nil)
37
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
38
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
39
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
40
+ request_headers = {}
41
+
42
+ # Set Headers
43
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
44
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
45
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions'
46
+ options = {
47
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
48
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
49
+ query_params: {'api-version' => @client.api_version},
50
+ headers: request_headers.merge(custom_headers || {})
51
+ }
52
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
53
+ promise = request.run_promise do |req|
54
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
55
+ end
56
+
57
+ promise = promise.then do |http_response|
58
+ status_code = http_response.status
59
+ response_content = http_response.body
60
+ unless status_code == 200
61
+ error_model = JSON.load(response_content)
62
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
63
+ end
64
+
65
+ # Create Result
66
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
67
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
68
+ # Deserialize Response
69
+ if status_code == 200
70
+ begin
71
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
72
+ unless parsed_response.nil?
73
+ parsed_response = PermissionGetResult.deserialize_object(parsed_response)
74
+ end
75
+ result.body = parsed_response
76
+ rescue Exception => e
77
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
78
+ end
79
+ end
80
+
81
+ result
82
+ end
83
+
84
+ promise.execute
85
+ end
86
+
87
+ #
88
+ # Gets a resource permissions.
89
+ #
90
+ # @param resource_group_name [String] The name of the resource group. The name
91
+ # is case insensitive.
92
+ # @param resource_provider_namespace [String] Resource
93
+ # @param parent_resource_path [String] Resource
94
+ # @param resource_type [String] Resource
95
+ # @param resource_name [String] Resource
96
+ # @param [Hash{String => String}] The hash of custom headers need to be
97
+ # applied to HTTP request.
98
+ #
99
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
100
+ # response.
101
+ #
102
+ def list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers = nil)
103
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
104
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
105
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
106
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
107
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
108
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
109
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
110
+ request_headers = {}
111
+
112
+ # Set Headers
113
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
114
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
115
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions'
116
+ options = {
117
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
118
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
119
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
120
+ query_params: {'api-version' => @client.api_version},
121
+ headers: request_headers.merge(custom_headers || {})
122
+ }
123
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
124
+ promise = request.run_promise do |req|
125
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
126
+ end
127
+
128
+ promise = promise.then do |http_response|
129
+ status_code = http_response.status
130
+ response_content = http_response.body
131
+ unless status_code == 200
132
+ error_model = JSON.load(response_content)
133
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
134
+ end
135
+
136
+ # Create Result
137
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
138
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
139
+ # Deserialize Response
140
+ if status_code == 200
141
+ begin
142
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
143
+ unless parsed_response.nil?
144
+ parsed_response = PermissionGetResult.deserialize_object(parsed_response)
145
+ end
146
+ result.body = parsed_response
147
+ rescue Exception => e
148
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
149
+ end
150
+ end
151
+
152
+ result
153
+ end
154
+
155
+ promise.execute
156
+ end
157
+
158
+ #
159
+ # Gets a resource group permissions.
160
+ #
161
+ # @param next_page_link [String] The NextLink from the previous successful
162
+ # call to List operation.
163
+ # @param [Hash{String => String}] The hash of custom headers need to be
164
+ # applied to HTTP request.
165
+ #
166
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
167
+ # response.
168
+ #
169
+ def list_for_resource_group_next(next_page_link, custom_headers = nil)
170
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
171
+ request_headers = {}
172
+
173
+ # Set Headers
174
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
175
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
176
+ path_template = '{nextLink}'
177
+ options = {
178
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
179
+ skip_encoding_path_params: {'nextLink' => next_page_link},
180
+ headers: request_headers.merge(custom_headers || {})
181
+ }
182
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
183
+ promise = request.run_promise do |req|
184
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
185
+ end
186
+
187
+ promise = promise.then do |http_response|
188
+ status_code = http_response.status
189
+ response_content = http_response.body
190
+ unless status_code == 200
191
+ error_model = JSON.load(response_content)
192
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
193
+ end
194
+
195
+ # Create Result
196
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
197
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
198
+ # Deserialize Response
199
+ if status_code == 200
200
+ begin
201
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
202
+ unless parsed_response.nil?
203
+ parsed_response = PermissionGetResult.deserialize_object(parsed_response)
204
+ end
205
+ result.body = parsed_response
206
+ rescue Exception => e
207
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
208
+ end
209
+ end
210
+
211
+ result
212
+ end
213
+
214
+ promise.execute
215
+ end
216
+
217
+ #
218
+ # Gets a resource permissions.
219
+ #
220
+ # @param next_page_link [String] The NextLink from the previous successful
221
+ # call to List operation.
222
+ # @param [Hash{String => String}] The hash of custom headers need to be
223
+ # applied to HTTP request.
224
+ #
225
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
226
+ # response.
227
+ #
228
+ def list_for_resource_next(next_page_link, custom_headers = nil)
229
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
230
+ request_headers = {}
231
+
232
+ # Set Headers
233
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
234
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
235
+ path_template = '{nextLink}'
236
+ options = {
237
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
238
+ skip_encoding_path_params: {'nextLink' => next_page_link},
239
+ headers: request_headers.merge(custom_headers || {})
240
+ }
241
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
242
+ promise = request.run_promise do |req|
243
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
244
+ end
245
+
246
+ promise = promise.then do |http_response|
247
+ status_code = http_response.status
248
+ response_content = http_response.body
249
+ unless status_code == 200
250
+ error_model = JSON.load(response_content)
251
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
252
+ end
253
+
254
+ # Create Result
255
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
256
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
257
+ # Deserialize Response
258
+ if status_code == 200
259
+ begin
260
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
261
+ unless parsed_response.nil?
262
+ parsed_response = PermissionGetResult.deserialize_object(parsed_response)
263
+ end
264
+ result.body = parsed_response
265
+ rescue Exception => e
266
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
267
+ end
268
+ end
269
+
270
+ result
271
+ end
272
+
273
+ promise.execute
274
+ end
275
+
276
+ end
277
+ end
@@ -0,0 +1,207 @@
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::Authorization
7
+ #
8
+ # ProviderOperationsMetadataOperations
9
+ #
10
+ class ProviderOperationsMetadataOperations
11
+ include Azure::ARM::Authorization::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ProviderOperationsMetadataOperations 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 AuthorizationManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets provider operations metadata
27
+ #
28
+ # @param resource_provider_namespace [String] Namespace of the resource
29
+ # provider.
30
+ # @param api_version [String]
31
+ # @param expand [String]
32
+ # @param [Hash{String => String}] The hash of custom headers need to be
33
+ # applied to HTTP request.
34
+ #
35
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
36
+ # response.
37
+ #
38
+ def get(resource_provider_namespace, api_version, expand = "'resourceTypes'", custom_headers = nil)
39
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
40
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
41
+ request_headers = {}
42
+
43
+ # Set Headers
44
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
45
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
46
+ path_template = '/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}'
47
+ options = {
48
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
49
+ path_params: {'resourceProviderNamespace' => resource_provider_namespace},
50
+ query_params: {'api-version' => api_version,'$expand' => expand},
51
+ headers: request_headers.merge(custom_headers || {})
52
+ }
53
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
54
+ promise = request.run_promise do |req|
55
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
56
+ end
57
+
58
+ promise = promise.then do |http_response|
59
+ status_code = http_response.status
60
+ response_content = http_response.body
61
+ unless status_code == 200
62
+ error_model = JSON.load(response_content)
63
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
64
+ end
65
+
66
+ # Create Result
67
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
68
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
69
+ # Deserialize Response
70
+ if status_code == 200
71
+ begin
72
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
73
+ unless parsed_response.nil?
74
+ parsed_response = ProviderOperationsMetadata.deserialize_object(parsed_response)
75
+ end
76
+ result.body = parsed_response
77
+ rescue Exception => e
78
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
79
+ end
80
+ end
81
+
82
+ result
83
+ end
84
+
85
+ promise.execute
86
+ end
87
+
88
+ #
89
+ # Gets provider operations metadata list
90
+ #
91
+ # @param api_version [String]
92
+ # @param expand [String]
93
+ # @param [Hash{String => String}] The hash of custom headers need to be
94
+ # applied to HTTP request.
95
+ #
96
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
97
+ # response.
98
+ #
99
+ def list(api_version, expand = "'resourceTypes'", custom_headers = nil)
100
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
101
+ request_headers = {}
102
+
103
+ # Set Headers
104
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
105
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
106
+ path_template = '/providers/Microsoft.Authorization/providerOperations'
107
+ options = {
108
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
109
+ query_params: {'api-version' => api_version,'$expand' => expand},
110
+ headers: request_headers.merge(custom_headers || {})
111
+ }
112
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
113
+ promise = request.run_promise do |req|
114
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
115
+ end
116
+
117
+ promise = promise.then do |http_response|
118
+ status_code = http_response.status
119
+ response_content = http_response.body
120
+ unless status_code == 200
121
+ error_model = JSON.load(response_content)
122
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
123
+ end
124
+
125
+ # Create Result
126
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
127
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
128
+ # Deserialize Response
129
+ if status_code == 200
130
+ begin
131
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
132
+ unless parsed_response.nil?
133
+ parsed_response = ProviderOperationsMetadataListResult.deserialize_object(parsed_response)
134
+ end
135
+ result.body = parsed_response
136
+ rescue Exception => e
137
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
138
+ end
139
+ end
140
+
141
+ result
142
+ end
143
+
144
+ promise.execute
145
+ end
146
+
147
+ #
148
+ # Gets provider operations metadata list
149
+ #
150
+ # @param next_page_link [String] The NextLink from the previous successful
151
+ # call to List operation.
152
+ # @param [Hash{String => String}] The hash of custom headers need to be
153
+ # applied to HTTP request.
154
+ #
155
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
156
+ # response.
157
+ #
158
+ def list_next(next_page_link, custom_headers = nil)
159
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
160
+ request_headers = {}
161
+
162
+ # Set Headers
163
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
164
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
165
+ path_template = '{nextLink}'
166
+ options = {
167
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
168
+ skip_encoding_path_params: {'nextLink' => next_page_link},
169
+ headers: request_headers.merge(custom_headers || {})
170
+ }
171
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
172
+ promise = request.run_promise do |req|
173
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
174
+ end
175
+
176
+ promise = promise.then do |http_response|
177
+ status_code = http_response.status
178
+ response_content = http_response.body
179
+ unless status_code == 200
180
+ error_model = JSON.load(response_content)
181
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
182
+ end
183
+
184
+ # Create Result
185
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
186
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
187
+ # Deserialize Response
188
+ if status_code == 200
189
+ begin
190
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
191
+ unless parsed_response.nil?
192
+ parsed_response = ProviderOperationsMetadataListResult.deserialize_object(parsed_response)
193
+ end
194
+ result.body = parsed_response
195
+ rescue Exception => e
196
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
197
+ end
198
+ end
199
+
200
+ result
201
+ end
202
+
203
+ promise.execute
204
+ end
205
+
206
+ end
207
+ end