azure_mgmt_authorization 0.2.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.
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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c37c28b16ac7a8737b859d1c91bb1045d6c2a11f
4
+ data.tar.gz: c88d1d1f9a3e83f6c62cef3442bca09d2ec8e65f
5
+ SHA512:
6
+ metadata.gz: e85c87869fdee46a11b42016c3ae8ed84e6c3953302fa50ed6abfb0c2a0af1d46d0df813524ec59ce2b9a3a990b097013da4d1e5bfbdfebbed4a43bcec15f155
7
+ data.tar.gz: 71fd42aba9ec6ac3344f8f9b2888a0fed9081db2acc5f3b59ccfb3cebd0441f863d885caefd2eb367a6c0ebcebc5cbc3828c9e547e5e3aea40c64ef996cee667
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
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.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
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 "bundler/gem_tasks"
@@ -0,0 +1,34 @@
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
+ lib = File.expand_path('../lib', __FILE__)
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+
8
+ require 'azure_mgmt_authorization/module_definition'
9
+ require 'azure_mgmt_authorization/version'
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = 'azure_mgmt_authorization'
13
+ spec.version = Azure::ARM::Authorization::VERSION
14
+ spec.authors = 'Microsoft Corporation'
15
+ spec.email = 'azrubyteam@microsoft.com'
16
+ spec.description = 'Microsoft Azure Role Based Authorization Management Client Library for Ruby'
17
+ spec.summary = 'Official Ruby client library to consume Microsoft Azure Role Based Authorization Management services.'
18
+ spec.homepage = 'http://github.com/azure/azure-sdk-for-ruby'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = 'bin'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.required_ruby_version = '>= 1.9.3'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.9'
29
+ spec.add_development_dependency 'rake', '~> 10'
30
+ spec.add_development_dependency 'rspec', '~> 3'
31
+ spec.add_development_dependency 'dotenv', '~> 2'
32
+
33
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.2.0'
34
+ end
@@ -0,0 +1,84 @@
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
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class AuthorizationManagementClient < MsRestAzure::AzureServiceClient
11
+ include Azure::ARM::Authorization::Models
12
+ include MsRestAzure
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Gets Azure subscription credentials.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Gets subscription credentials which uniquely identify
21
+ # Microsoft Azure subscription. The subscription ID forms part of the URI
22
+ # for every service call.
23
+ attr_accessor :subscription_id
24
+
25
+ # @return [String] Client Api Version.
26
+ attr_reader :api_version
27
+
28
+ # @return [String] Gets or sets the preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
32
+ # Running Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
36
+ # is generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return Subscription credentials which uniquely identify client
40
+ # subscription.
41
+ attr_accessor :credentials
42
+
43
+ # @return classic_administrators
44
+ attr_reader :classic_administrators
45
+
46
+ # @return permissions
47
+ attr_reader :permissions
48
+
49
+ # @return provider_operations_metadata_operations
50
+ attr_reader :provider_operations_metadata_operations
51
+
52
+ # @return role_assignments
53
+ attr_reader :role_assignments
54
+
55
+ # @return role_definitions
56
+ attr_reader :role_definitions
57
+
58
+ #
59
+ # Creates initializes a new instance of the AuthorizationManagementClient class.
60
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
61
+ # @param base_url [String] the base URI of the service.
62
+ # @param options [Array] filters to be applied to the HTTP requests.
63
+ #
64
+ def initialize(credentials, base_url = nil, options = nil)
65
+ super(credentials, options)
66
+ @base_url = base_url || 'https://management.azure.com'
67
+
68
+ fail ArgumentError, 'credentials is nil' if credentials.nil?
69
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
70
+ @credentials = credentials
71
+
72
+ @classic_administrators = ClassicAdministrators.new(self)
73
+ @permissions = Permissions.new(self)
74
+ @provider_operations_metadata_operations = ProviderOperationsMetadataOperations.new(self)
75
+ @role_assignments = RoleAssignments.new(self)
76
+ @role_definitions = RoleDefinitions.new(self)
77
+ @api_version = '2015-07-01'
78
+ @accept_language = 'en-US'
79
+ @long_running_operation_retry_timeout = 30
80
+ @generate_client_request_id = true
81
+ end
82
+
83
+ end
84
+ end
@@ -0,0 +1,145 @@
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
+ # ClassicAdministrators
9
+ #
10
+ class ClassicAdministrators
11
+ include Azure::ARM::Authorization::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ClassicAdministrators 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 list of classic administrators for the subscription.
27
+ #
28
+ # @param api_version [String]
29
+ # @param [Hash{String => String}] The hash of custom headers need to be
30
+ # applied to HTTP request.
31
+ #
32
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
33
+ # response.
34
+ #
35
+ def list(api_version, custom_headers = nil)
36
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
37
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
38
+ request_headers = {}
39
+
40
+ # Set Headers
41
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
42
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
43
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators'
44
+ options = {
45
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
46
+ path_params: {'subscriptionId' => @client.subscription_id},
47
+ query_params: {'api-version' => api_version},
48
+ headers: request_headers.merge(custom_headers || {})
49
+ }
50
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
51
+ promise = request.run_promise do |req|
52
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
53
+ end
54
+
55
+ promise = promise.then do |http_response|
56
+ status_code = http_response.status
57
+ response_content = http_response.body
58
+ unless status_code == 200
59
+ error_model = JSON.load(response_content)
60
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
61
+ end
62
+
63
+ # Create Result
64
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
65
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
66
+ # Deserialize Response
67
+ if status_code == 200
68
+ begin
69
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
70
+ unless parsed_response.nil?
71
+ parsed_response = ClassicAdministratorListResult.deserialize_object(parsed_response)
72
+ end
73
+ result.body = parsed_response
74
+ rescue Exception => e
75
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
76
+ end
77
+ end
78
+
79
+ result
80
+ end
81
+
82
+ promise.execute
83
+ end
84
+
85
+ #
86
+ # Gets a list of classic administrators for the subscription.
87
+ #
88
+ # @param next_page_link [String] The NextLink from the previous successful
89
+ # call to List operation.
90
+ # @param [Hash{String => String}] The hash of custom headers need to be
91
+ # applied to HTTP request.
92
+ #
93
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
94
+ # response.
95
+ #
96
+ def list_next(next_page_link, custom_headers = nil)
97
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
98
+ request_headers = {}
99
+
100
+ # Set Headers
101
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
102
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
103
+ path_template = '{nextLink}'
104
+ options = {
105
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
106
+ skip_encoding_path_params: {'nextLink' => next_page_link},
107
+ headers: request_headers.merge(custom_headers || {})
108
+ }
109
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
110
+ promise = request.run_promise do |req|
111
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
112
+ end
113
+
114
+ promise = promise.then do |http_response|
115
+ status_code = http_response.status
116
+ response_content = http_response.body
117
+ unless status_code == 200
118
+ error_model = JSON.load(response_content)
119
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
120
+ end
121
+
122
+ # Create Result
123
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
124
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
125
+ # Deserialize Response
126
+ if status_code == 200
127
+ begin
128
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
129
+ unless parsed_response.nil?
130
+ parsed_response = ClassicAdministratorListResult.deserialize_object(parsed_response)
131
+ end
132
+ result.body = parsed_response
133
+ rescue Exception => e
134
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
135
+ end
136
+ end
137
+
138
+ result
139
+ end
140
+
141
+ promise.execute
142
+ end
143
+
144
+ end
145
+ end
@@ -0,0 +1,90 @@
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
+ module Models
8
+ #
9
+ # Classic Administrators
10
+ #
11
+ class ClassicAdministrator
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Gets or sets the classic administrator id.
16
+ attr_accessor :id
17
+
18
+ # @return [String] Gets or sets the classic administrator name.
19
+ attr_accessor :name
20
+
21
+ # @return [String] Gets or sets the classic administrator type.
22
+ attr_accessor :type
23
+
24
+ # @return [ClassicAdministratorProperties] Gets or sets the classic
25
+ # administrator properties.
26
+ attr_accessor :properties
27
+
28
+ #
29
+ # Validate the object. Throws ValidationError if validation fails.
30
+ #
31
+ def validate
32
+ @properties.validate unless @properties.nil?
33
+ end
34
+
35
+ #
36
+ # Serializes given Model object into Ruby Hash.
37
+ # @param object Model object to serialize.
38
+ # @return [Hash] Serialized object in form of Ruby Hash.
39
+ #
40
+ def self.serialize_object(object)
41
+ object.validate
42
+ output_object = {}
43
+
44
+ serialized_property = object.id
45
+ output_object['id'] = serialized_property unless serialized_property.nil?
46
+
47
+ serialized_property = object.name
48
+ output_object['name'] = serialized_property unless serialized_property.nil?
49
+
50
+ serialized_property = object.type
51
+ output_object['type'] = serialized_property unless serialized_property.nil?
52
+
53
+ serialized_property = object.properties
54
+ unless serialized_property.nil?
55
+ serialized_property = ClassicAdministratorProperties.serialize_object(serialized_property)
56
+ end
57
+ output_object['properties'] = serialized_property unless serialized_property.nil?
58
+
59
+ output_object
60
+ end
61
+
62
+ #
63
+ # Deserializes given Ruby Hash into Model object.
64
+ # @param object [Hash] Ruby Hash object to deserialize.
65
+ # @return [ClassicAdministrator] Deserialized object.
66
+ #
67
+ def self.deserialize_object(object)
68
+ return if object.nil?
69
+ output_object = ClassicAdministrator.new
70
+
71
+ deserialized_property = object['id']
72
+ output_object.id = deserialized_property
73
+
74
+ deserialized_property = object['name']
75
+ output_object.name = deserialized_property
76
+
77
+ deserialized_property = object['type']
78
+ output_object.type = deserialized_property
79
+
80
+ deserialized_property = object['properties']
81
+ unless deserialized_property.nil?
82
+ deserialized_property = ClassicAdministratorProperties.deserialize_object(deserialized_property)
83
+ end
84
+ output_object.properties = deserialized_property
85
+
86
+ output_object
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,77 @@
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
+ module Models
8
+ #
9
+ # ClassicAdministrator list result information.
10
+ #
11
+ class ClassicAdministratorListResult
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<ClassicAdministrator>] Gets or sets
16
+ # ClassicAdministrators.
17
+ attr_accessor :value
18
+
19
+ #
20
+ # Validate the object. Throws ValidationError if validation fails.
21
+ #
22
+ def validate
23
+ @value.each{ |e| e.validate if e.respond_to?(:validate) } unless @value.nil?
24
+ end
25
+
26
+ #
27
+ # Serializes given Model object into Ruby Hash.
28
+ # @param object Model object to serialize.
29
+ # @return [Hash] Serialized object in form of Ruby Hash.
30
+ #
31
+ def self.serialize_object(object)
32
+ object.validate
33
+ output_object = {}
34
+
35
+ serialized_property = object.value
36
+ unless serialized_property.nil?
37
+ serializedArray = []
38
+ serialized_property.each do |element|
39
+ unless element.nil?
40
+ element = ClassicAdministrator.serialize_object(element)
41
+ end
42
+ serializedArray.push(element)
43
+ end
44
+ serialized_property = serializedArray
45
+ end
46
+ output_object['value'] = serialized_property unless serialized_property.nil?
47
+
48
+ output_object
49
+ end
50
+
51
+ #
52
+ # Deserializes given Ruby Hash into Model object.
53
+ # @param object [Hash] Ruby Hash object to deserialize.
54
+ # @return [ClassicAdministratorListResult] Deserialized object.
55
+ #
56
+ def self.deserialize_object(object)
57
+ return if object.nil?
58
+ output_object = ClassicAdministratorListResult.new
59
+
60
+ deserialized_property = object['value']
61
+ unless deserialized_property.nil?
62
+ deserialized_array = []
63
+ deserialized_property.each do |element1|
64
+ unless element1.nil?
65
+ element1 = ClassicAdministrator.deserialize_object(element1)
66
+ end
67
+ deserialized_array.push(element1)
68
+ end
69
+ deserialized_property = deserialized_array
70
+ end
71
+ output_object.value = deserialized_property
72
+
73
+ output_object
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,65 @@
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
+ module Models
8
+ #
9
+ # Classic Administrator properties.
10
+ #
11
+ class ClassicAdministratorProperties
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Gets or sets the email address
16
+ attr_accessor :email_address
17
+
18
+ # @return [String] Gets or sets the role
19
+ attr_accessor :role
20
+
21
+ #
22
+ # Validate the object. Throws ValidationError if validation fails.
23
+ #
24
+ def validate
25
+ # Nothing to validate
26
+ end
27
+
28
+ #
29
+ # Serializes given Model object into Ruby Hash.
30
+ # @param object Model object to serialize.
31
+ # @return [Hash] Serialized object in form of Ruby Hash.
32
+ #
33
+ def self.serialize_object(object)
34
+ object.validate
35
+ output_object = {}
36
+
37
+ serialized_property = object.email_address
38
+ output_object['emailAddress'] = serialized_property unless serialized_property.nil?
39
+
40
+ serialized_property = object.role
41
+ output_object['role'] = serialized_property unless serialized_property.nil?
42
+
43
+ output_object
44
+ end
45
+
46
+ #
47
+ # Deserializes given Ruby Hash into Model object.
48
+ # @param object [Hash] Ruby Hash object to deserialize.
49
+ # @return [ClassicAdministratorProperties] Deserialized object.
50
+ #
51
+ def self.deserialize_object(object)
52
+ return if object.nil?
53
+ output_object = ClassicAdministratorProperties.new
54
+
55
+ deserialized_property = object['emailAddress']
56
+ output_object.email_address = deserialized_property
57
+
58
+ deserialized_property = object['role']
59
+ output_object.role = deserialized_property
60
+
61
+ output_object
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,66 @@
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
+ module Models
8
+ #
9
+ # Role definition permissions.
10
+ #
11
+ class Permission
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<String>] Role definition allowed actions.
16
+ attr_accessor :actions
17
+
18
+ # @return [Array<String>] Role definition denied actions.
19
+ attr_accessor :not_actions
20
+
21
+ #
22
+ # Validate the object. Throws ValidationError if validation fails.
23
+ #
24
+ def validate
25
+ @actions.each{ |e| e.validate if e.respond_to?(:validate) } unless @actions.nil?
26
+ @not_actions.each{ |e| e.validate if e.respond_to?(:validate) } unless @not_actions.nil?
27
+ end
28
+
29
+ #
30
+ # Serializes given Model object into Ruby Hash.
31
+ # @param object Model object to serialize.
32
+ # @return [Hash] Serialized object in form of Ruby Hash.
33
+ #
34
+ def self.serialize_object(object)
35
+ object.validate
36
+ output_object = {}
37
+
38
+ serialized_property = object.actions
39
+ output_object['actions'] = serialized_property unless serialized_property.nil?
40
+
41
+ serialized_property = object.not_actions
42
+ output_object['notActions'] = serialized_property unless serialized_property.nil?
43
+
44
+ output_object
45
+ end
46
+
47
+ #
48
+ # Deserializes given Ruby Hash into Model object.
49
+ # @param object [Hash] Ruby Hash object to deserialize.
50
+ # @return [Permission] Deserialized object.
51
+ #
52
+ def self.deserialize_object(object)
53
+ return if object.nil?
54
+ output_object = Permission.new
55
+
56
+ deserialized_property = object['actions']
57
+ output_object.actions = deserialized_property
58
+
59
+ deserialized_property = object['notActions']
60
+ output_object.not_actions = deserialized_property
61
+
62
+ output_object
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,76 @@
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
+ module Models
8
+ #
9
+ # Permissions information.
10
+ #
11
+ class PermissionGetResult
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<Permission>] Gets or sets permissions.
16
+ attr_accessor :value
17
+
18
+ #
19
+ # Validate the object. Throws ValidationError if validation fails.
20
+ #
21
+ def validate
22
+ @value.each{ |e| e.validate if e.respond_to?(:validate) } unless @value.nil?
23
+ end
24
+
25
+ #
26
+ # Serializes given Model object into Ruby Hash.
27
+ # @param object Model object to serialize.
28
+ # @return [Hash] Serialized object in form of Ruby Hash.
29
+ #
30
+ def self.serialize_object(object)
31
+ object.validate
32
+ output_object = {}
33
+
34
+ serialized_property = object.value
35
+ unless serialized_property.nil?
36
+ serializedArray = []
37
+ serialized_property.each do |element|
38
+ unless element.nil?
39
+ element = Permission.serialize_object(element)
40
+ end
41
+ serializedArray.push(element)
42
+ end
43
+ serialized_property = serializedArray
44
+ end
45
+ output_object['value'] = serialized_property unless serialized_property.nil?
46
+
47
+ output_object
48
+ end
49
+
50
+ #
51
+ # Deserializes given Ruby Hash into Model object.
52
+ # @param object [Hash] Ruby Hash object to deserialize.
53
+ # @return [PermissionGetResult] Deserialized object.
54
+ #
55
+ def self.deserialize_object(object)
56
+ return if object.nil?
57
+ output_object = PermissionGetResult.new
58
+
59
+ deserialized_property = object['value']
60
+ unless deserialized_property.nil?
61
+ deserialized_array = []
62
+ deserialized_property.each do |element1|
63
+ unless element1.nil?
64
+ element1 = Permission.deserialize_object(element1)
65
+ end
66
+ deserialized_array.push(element1)
67
+ end
68
+ deserialized_property = deserialized_array
69
+ end
70
+ output_object.value = deserialized_property
71
+
72
+ output_object
73
+ end
74
+ end
75
+ end
76
+ end