azure_graph_rbac 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/1.6/generated/azure_graph_rbac.rb +75 -0
  4. data/lib/1.6/generated/azure_graph_rbac/applications.rb +1131 -0
  5. data/lib/1.6/generated/azure_graph_rbac/domains.rb +200 -0
  6. data/lib/1.6/generated/azure_graph_rbac/graph_rbac_client.rb +150 -0
  7. data/lib/1.6/generated/azure_graph_rbac/groups.rb +1079 -0
  8. data/lib/1.6/generated/azure_graph_rbac/models/aadobject.rb +297 -0
  9. data/lib/1.6/generated/azure_graph_rbac/models/adgroup.rb +116 -0
  10. data/lib/1.6/generated/azure_graph_rbac/models/application.rb +196 -0
  11. data/lib/1.6/generated/azure_graph_rbac/models/application_add_owner_parameters.rb +69 -0
  12. data/lib/1.6/generated/azure_graph_rbac/models/application_create_parameters.rb +202 -0
  13. data/lib/1.6/generated/azure_graph_rbac/models/application_list_result.rb +98 -0
  14. data/lib/1.6/generated/azure_graph_rbac/models/application_update_parameters.rb +201 -0
  15. data/lib/1.6/generated/azure_graph_rbac/models/check_group_membership_parameters.rb +77 -0
  16. data/lib/1.6/generated/azure_graph_rbac/models/check_group_membership_result.rb +67 -0
  17. data/lib/1.6/generated/azure_graph_rbac/models/directory_object.rb +92 -0
  18. data/lib/1.6/generated/azure_graph_rbac/models/directory_object_list_result.rb +57 -0
  19. data/lib/1.6/generated/azure_graph_rbac/models/domain.rb +101 -0
  20. data/lib/1.6/generated/azure_graph_rbac/models/domain_list_result.rb +55 -0
  21. data/lib/1.6/generated/azure_graph_rbac/models/get_objects_parameters.rb +104 -0
  22. data/lib/1.6/generated/azure_graph_rbac/models/get_objects_result.rb +98 -0
  23. data/lib/1.6/generated/azure_graph_rbac/models/graph_error.rb +57 -0
  24. data/lib/1.6/generated/azure_graph_rbac/models/group_add_member_parameters.rb +69 -0
  25. data/lib/1.6/generated/azure_graph_rbac/models/group_create_parameters.rb +106 -0
  26. data/lib/1.6/generated/azure_graph_rbac/models/group_get_member_groups_parameters.rb +67 -0
  27. data/lib/1.6/generated/azure_graph_rbac/models/group_get_member_groups_result.rb +55 -0
  28. data/lib/1.6/generated/azure_graph_rbac/models/group_list_result.rb +98 -0
  29. data/lib/1.6/generated/azure_graph_rbac/models/key_credential.rb +121 -0
  30. data/lib/1.6/generated/azure_graph_rbac/models/key_credential_list_result.rb +55 -0
  31. data/lib/1.6/generated/azure_graph_rbac/models/key_credentials_update_parameters.rb +55 -0
  32. data/lib/1.6/generated/azure_graph_rbac/models/password_credential.rb +98 -0
  33. data/lib/1.6/generated/azure_graph_rbac/models/password_credential_list_result.rb +56 -0
  34. data/lib/1.6/generated/azure_graph_rbac/models/password_credentials_update_parameters.rb +56 -0
  35. data/lib/1.6/generated/azure_graph_rbac/models/password_profile.rb +76 -0
  36. data/lib/1.6/generated/azure_graph_rbac/models/required_resource_access.rb +94 -0
  37. data/lib/1.6/generated/azure_graph_rbac/models/resource_access.rb +80 -0
  38. data/lib/1.6/generated/azure_graph_rbac/models/service_principal.rb +124 -0
  39. data/lib/1.6/generated/azure_graph_rbac/models/service_principal_create_parameters.rb +117 -0
  40. data/lib/1.6/generated/azure_graph_rbac/models/service_principal_list_result.rb +98 -0
  41. data/lib/1.6/generated/azure_graph_rbac/models/sign_in_name.rb +79 -0
  42. data/lib/1.6/generated/azure_graph_rbac/models/user.rb +221 -0
  43. data/lib/1.6/generated/azure_graph_rbac/models/user_base.rb +118 -0
  44. data/lib/1.6/generated/azure_graph_rbac/models/user_create_parameters.rb +158 -0
  45. data/lib/1.6/generated/azure_graph_rbac/models/user_get_member_groups_parameters.rb +67 -0
  46. data/lib/1.6/generated/azure_graph_rbac/models/user_get_member_groups_result.rb +55 -0
  47. data/lib/1.6/generated/azure_graph_rbac/models/user_list_result.rb +98 -0
  48. data/lib/1.6/generated/azure_graph_rbac/models/user_type.rb +16 -0
  49. data/lib/1.6/generated/azure_graph_rbac/models/user_update_parameters.rb +147 -0
  50. data/lib/1.6/generated/azure_graph_rbac/module_definition.rb +8 -0
  51. data/lib/1.6/generated/azure_graph_rbac/objects.rb +314 -0
  52. data/lib/1.6/generated/azure_graph_rbac/service_principals.rb +949 -0
  53. data/lib/1.6/generated/azure_graph_rbac/users.rb +686 -0
  54. data/lib/azure_graph_rbac.rb +6 -0
  55. data/lib/module_definition.rb +6 -0
  56. data/lib/profiles/latest/graphrbac_latest_profile_client.rb +38 -0
  57. data/lib/profiles/latest/graphrbac_module_definition.rb +8 -0
  58. data/lib/profiles/latest/modules/graphrbac_profile_module.rb +237 -0
  59. data/lib/version.rb +7 -0
  60. metadata +177 -0
@@ -0,0 +1,200 @@
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::GraphRbac::V1_6
7
+ #
8
+ # The Graph RBAC Management Client
9
+ #
10
+ class Domains
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Domains class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [GraphRbacClient] reference to the GraphRbacClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets a list of domains for the current tenant.
26
+ #
27
+ # @param filter [String] The filter to apply to the operation.
28
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
29
+ # will be added to the HTTP request.
30
+ #
31
+ # @return [DomainListResult] operation results.
32
+ #
33
+ def list(filter:nil, custom_headers:nil)
34
+ response = list_async(filter:filter, custom_headers:custom_headers).value!
35
+ response.body unless response.nil?
36
+ end
37
+
38
+ #
39
+ # Gets a list of domains for the current tenant.
40
+ #
41
+ # @param filter [String] The filter to apply to the operation.
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(filter:nil, custom_headers:nil)
48
+ list_async(filter:filter, custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Gets a list of domains for the current tenant.
53
+ #
54
+ # @param filter [String] The filter to apply to the operation.
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def list_async(filter:nil, custom_headers:nil)
61
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
63
+
64
+
65
+ request_headers = {}
66
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
67
+
68
+ # Set Headers
69
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
70
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
71
+ path_template = '{tenantID}/domains'
72
+
73
+ request_url = @base_url || @client.base_url
74
+
75
+ options = {
76
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
77
+ path_params: {'tenantID' => @client.tenant_id},
78
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
79
+ headers: request_headers.merge(custom_headers || {}),
80
+ base_url: request_url
81
+ }
82
+ promise = @client.make_request_async(:get, path_template, options)
83
+
84
+ promise = promise.then do |result|
85
+ http_response = result.response
86
+ status_code = http_response.status
87
+ response_content = http_response.body
88
+ unless status_code == 200
89
+ error_model = JSON.load(response_content)
90
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
91
+ end
92
+
93
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
94
+ # Deserialize Response
95
+ if status_code == 200
96
+ begin
97
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
98
+ result_mapper = Azure::GraphRbac::V1_6::Models::DomainListResult.mapper()
99
+ result.body = @client.deserialize(result_mapper, parsed_response)
100
+ rescue Exception => e
101
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
102
+ end
103
+ end
104
+
105
+ result
106
+ end
107
+
108
+ promise.execute
109
+ end
110
+
111
+ #
112
+ # Gets a specific domain in the current tenant.
113
+ #
114
+ # @param domain_name [String] name of the domain.
115
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
116
+ # will be added to the HTTP request.
117
+ #
118
+ # @return [Domain] operation results.
119
+ #
120
+ def get(domain_name, custom_headers:nil)
121
+ response = get_async(domain_name, custom_headers:custom_headers).value!
122
+ response.body unless response.nil?
123
+ end
124
+
125
+ #
126
+ # Gets a specific domain in the current tenant.
127
+ #
128
+ # @param domain_name [String] name of the domain.
129
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
130
+ # will be added to the HTTP request.
131
+ #
132
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
133
+ #
134
+ def get_with_http_info(domain_name, custom_headers:nil)
135
+ get_async(domain_name, custom_headers:custom_headers).value!
136
+ end
137
+
138
+ #
139
+ # Gets a specific domain in the current tenant.
140
+ #
141
+ # @param domain_name [String] name of the domain.
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 get_async(domain_name, custom_headers:nil)
148
+ fail ArgumentError, 'domain_name is nil' if domain_name.nil?
149
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
150
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
151
+
152
+
153
+ request_headers = {}
154
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
155
+
156
+ # Set Headers
157
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
158
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
159
+ path_template = '{tenantID}/domains/{domainName}'
160
+
161
+ request_url = @base_url || @client.base_url
162
+
163
+ options = {
164
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
165
+ path_params: {'domainName' => domain_name,'tenantID' => @client.tenant_id},
166
+ query_params: {'api-version' => @client.api_version},
167
+ headers: request_headers.merge(custom_headers || {}),
168
+ base_url: request_url
169
+ }
170
+ promise = @client.make_request_async(:get, path_template, options)
171
+
172
+ promise = promise.then do |result|
173
+ http_response = result.response
174
+ status_code = http_response.status
175
+ response_content = http_response.body
176
+ unless status_code == 200
177
+ error_model = JSON.load(response_content)
178
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
179
+ end
180
+
181
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
182
+ # Deserialize Response
183
+ if status_code == 200
184
+ begin
185
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
186
+ result_mapper = Azure::GraphRbac::V1_6::Models::Domain.mapper()
187
+ result.body = @client.deserialize(result_mapper, parsed_response)
188
+ rescue Exception => e
189
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
190
+ end
191
+ end
192
+
193
+ result
194
+ end
195
+
196
+ promise.execute
197
+ end
198
+
199
+ end
200
+ end
@@ -0,0 +1,150 @@
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::GraphRbac::V1_6
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class GraphRbacClient < 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] Client API version.
21
+ attr_reader :api_version
22
+
23
+ # @return [String] The tenant ID.
24
+ attr_accessor :tenant_id
25
+
26
+ # @return [String] Gets or sets the preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
30
+ # Running Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
34
+ # is generated and included in each request. Default is true.
35
+ attr_accessor :generate_client_request_id
36
+
37
+ # @return [Objects] objects
38
+ attr_reader :objects
39
+
40
+ # @return [Applications] applications
41
+ attr_reader :applications
42
+
43
+ # @return [Groups] groups
44
+ attr_reader :groups
45
+
46
+ # @return [ServicePrincipals] service_principals
47
+ attr_reader :service_principals
48
+
49
+ # @return [Users] users
50
+ attr_reader :users
51
+
52
+ # @return [Domains] domains
53
+ attr_reader :domains
54
+
55
+ #
56
+ # Creates initializes a new instance of the GraphRbacClient class.
57
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
58
+ # @param base_url [String] the base URI of the service.
59
+ # @param options [Array] filters to be applied to the HTTP requests.
60
+ #
61
+ def initialize(credentials = nil, base_url = nil, options = nil)
62
+ super(credentials, options)
63
+ @base_url = base_url || 'https://graph.windows.net'
64
+
65
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
66
+ @credentials = credentials
67
+
68
+ @objects = Objects.new(self)
69
+ @applications = Applications.new(self)
70
+ @groups = Groups.new(self)
71
+ @service_principals = ServicePrincipals.new(self)
72
+ @users = Users.new(self)
73
+ @domains = Domains.new(self)
74
+ @api_version = '1.6'
75
+ @accept_language = 'en-US'
76
+ @long_running_operation_retry_timeout = 30
77
+ @generate_client_request_id = true
78
+ add_telemetry
79
+ end
80
+
81
+ #
82
+ # Makes a request and returns the body of the response.
83
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
84
+ # @param path [String] the path, relative to {base_url}.
85
+ # @param options [Hash{String=>String}] specifying any request options like :body.
86
+ # @return [Hash{String=>String}] containing the body of the response.
87
+ # Example:
88
+ #
89
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
90
+ # path = "/path"
91
+ # options = {
92
+ # body: request_content,
93
+ # query_params: {'api-version' => '2016-02-01'}
94
+ # }
95
+ # result = @client.make_request(:put, path, options)
96
+ #
97
+ def make_request(method, path, options = {})
98
+ result = make_request_with_http_info(method, path, options)
99
+ result.body unless result.nil?
100
+ end
101
+
102
+ #
103
+ # Makes a request and returns the operation response.
104
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
105
+ # @param path [String] the path, relative to {base_url}.
106
+ # @param options [Hash{String=>String}] specifying any request options like :body.
107
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
108
+ #
109
+ def make_request_with_http_info(method, path, options = {})
110
+ result = make_request_async(method, path, options).value!
111
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
112
+ result
113
+ end
114
+
115
+ #
116
+ # Makes a request asynchronously.
117
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
118
+ # @param path [String] the path, relative to {base_url}.
119
+ # @param options [Hash{String=>String}] specifying any request options like :body.
120
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
121
+ #
122
+ def make_request_async(method, path, options = {})
123
+ fail ArgumentError, 'method is nil' if method.nil?
124
+ fail ArgumentError, 'path is nil' if path.nil?
125
+
126
+ request_url = options[:base_url] || @base_url
127
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
128
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
129
+ end
130
+
131
+ request_headers = @request_headers
132
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
133
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
134
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
135
+
136
+ super(request_url, method, path, options)
137
+ end
138
+
139
+
140
+ private
141
+ #
142
+ # Adds telemetry information.
143
+ #
144
+ def add_telemetry
145
+ sdk_information = 'azure_graph_rbac'
146
+ sdk_information = "#{sdk_information}/0.16.0"
147
+ add_user_agent_information(sdk_information)
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,1079 @@
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::GraphRbac::V1_6
7
+ #
8
+ # The Graph RBAC Management Client
9
+ #
10
+ class Groups
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Groups class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [GraphRbacClient] reference to the GraphRbacClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Checks whether the specified user, group, contact, or service principal is a
26
+ # direct or transitive member of the specified group.
27
+ #
28
+ # @param parameters [CheckGroupMembershipParameters] The check group membership
29
+ # parameters.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [CheckGroupMembershipResult] operation results.
34
+ #
35
+ def is_member_of(parameters, custom_headers:nil)
36
+ response = is_member_of_async(parameters, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Checks whether the specified user, group, contact, or service principal is a
42
+ # direct or transitive member of the specified group.
43
+ #
44
+ # @param parameters [CheckGroupMembershipParameters] The check group membership
45
+ # parameters.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def is_member_of_with_http_info(parameters, custom_headers:nil)
52
+ is_member_of_async(parameters, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Checks whether the specified user, group, contact, or service principal is a
57
+ # direct or transitive member of the specified group.
58
+ #
59
+ # @param parameters [CheckGroupMembershipParameters] The check group membership
60
+ # parameters.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def is_member_of_async(parameters, custom_headers:nil)
67
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
68
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
69
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
70
+
71
+
72
+ request_headers = {}
73
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
74
+
75
+ # Set Headers
76
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
77
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
78
+
79
+ # Serialize Request
80
+ request_mapper = Azure::GraphRbac::V1_6::Models::CheckGroupMembershipParameters.mapper()
81
+ request_content = @client.serialize(request_mapper, parameters)
82
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
83
+
84
+ path_template = '{tenantID}/isMemberOf'
85
+
86
+ request_url = @base_url || @client.base_url
87
+
88
+ options = {
89
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
90
+ path_params: {'tenantID' => @client.tenant_id},
91
+ query_params: {'api-version' => @client.api_version},
92
+ body: request_content,
93
+ headers: request_headers.merge(custom_headers || {}),
94
+ base_url: request_url
95
+ }
96
+ promise = @client.make_request_async(:post, path_template, options)
97
+
98
+ promise = promise.then do |result|
99
+ http_response = result.response
100
+ status_code = http_response.status
101
+ response_content = http_response.body
102
+ unless status_code == 200
103
+ error_model = JSON.load(response_content)
104
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
105
+ end
106
+
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::GraphRbac::V1_6::Models::CheckGroupMembershipResult.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Remove a member from a group.
127
+ #
128
+ # @param group_object_id [String] The object ID of the group from which to
129
+ # remove the member.
130
+ # @param member_object_id [String] Member object id
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ #
135
+ def remove_member(group_object_id, member_object_id, custom_headers:nil)
136
+ response = remove_member_async(group_object_id, member_object_id, custom_headers:custom_headers).value!
137
+ nil
138
+ end
139
+
140
+ #
141
+ # Remove a member from a group.
142
+ #
143
+ # @param group_object_id [String] The object ID of the group from which to
144
+ # remove the member.
145
+ # @param member_object_id [String] Member object id
146
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
147
+ # will be added to the HTTP request.
148
+ #
149
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
150
+ #
151
+ def remove_member_with_http_info(group_object_id, member_object_id, custom_headers:nil)
152
+ remove_member_async(group_object_id, member_object_id, custom_headers:custom_headers).value!
153
+ end
154
+
155
+ #
156
+ # Remove a member from a group.
157
+ #
158
+ # @param group_object_id [String] The object ID of the group from which to
159
+ # remove the member.
160
+ # @param member_object_id [String] Member object id
161
+ # @param [Hash{String => String}] A hash of custom headers that will be added
162
+ # to the HTTP request.
163
+ #
164
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
165
+ #
166
+ def remove_member_async(group_object_id, member_object_id, custom_headers:nil)
167
+ fail ArgumentError, 'group_object_id is nil' if group_object_id.nil?
168
+ fail ArgumentError, 'member_object_id is nil' if member_object_id.nil?
169
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
170
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
171
+
172
+
173
+ request_headers = {}
174
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
175
+
176
+ # Set Headers
177
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
178
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
179
+ path_template = '{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}'
180
+
181
+ request_url = @base_url || @client.base_url
182
+
183
+ options = {
184
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
185
+ path_params: {'groupObjectId' => group_object_id,'memberObjectId' => member_object_id,'tenantID' => @client.tenant_id},
186
+ query_params: {'api-version' => @client.api_version},
187
+ headers: request_headers.merge(custom_headers || {}),
188
+ base_url: request_url
189
+ }
190
+ promise = @client.make_request_async(:delete, path_template, options)
191
+
192
+ promise = promise.then do |result|
193
+ http_response = result.response
194
+ status_code = http_response.status
195
+ response_content = http_response.body
196
+ unless status_code == 204
197
+ error_model = JSON.load(response_content)
198
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
199
+ end
200
+
201
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
202
+
203
+ result
204
+ end
205
+
206
+ promise.execute
207
+ end
208
+
209
+ #
210
+ # Add a member to a group.
211
+ #
212
+ # @param group_object_id [String] The object ID of the group to which to add
213
+ # the member.
214
+ # @param parameters [GroupAddMemberParameters] The URL of the member object,
215
+ # such as
216
+ # https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
217
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
218
+ # will be added to the HTTP request.
219
+ #
220
+ #
221
+ def add_member(group_object_id, parameters, custom_headers:nil)
222
+ response = add_member_async(group_object_id, parameters, custom_headers:custom_headers).value!
223
+ nil
224
+ end
225
+
226
+ #
227
+ # Add a member to a group.
228
+ #
229
+ # @param group_object_id [String] The object ID of the group to which to add
230
+ # the member.
231
+ # @param parameters [GroupAddMemberParameters] The URL of the member object,
232
+ # such as
233
+ # https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
234
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
235
+ # will be added to the HTTP request.
236
+ #
237
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
238
+ #
239
+ def add_member_with_http_info(group_object_id, parameters, custom_headers:nil)
240
+ add_member_async(group_object_id, parameters, custom_headers:custom_headers).value!
241
+ end
242
+
243
+ #
244
+ # Add a member to a group.
245
+ #
246
+ # @param group_object_id [String] The object ID of the group to which to add
247
+ # the member.
248
+ # @param parameters [GroupAddMemberParameters] The URL of the member object,
249
+ # such as
250
+ # https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
251
+ # @param [Hash{String => String}] A hash of custom headers that will be added
252
+ # to the HTTP request.
253
+ #
254
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
255
+ #
256
+ def add_member_async(group_object_id, parameters, custom_headers:nil)
257
+ fail ArgumentError, 'group_object_id is nil' if group_object_id.nil?
258
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
259
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
260
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
261
+
262
+
263
+ request_headers = {}
264
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
265
+
266
+ # Set Headers
267
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
268
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
269
+
270
+ # Serialize Request
271
+ request_mapper = Azure::GraphRbac::V1_6::Models::GroupAddMemberParameters.mapper()
272
+ request_content = @client.serialize(request_mapper, parameters)
273
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
274
+
275
+ path_template = '{tenantID}/groups/{groupObjectId}/$links/members'
276
+
277
+ request_url = @base_url || @client.base_url
278
+
279
+ options = {
280
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
281
+ path_params: {'groupObjectId' => group_object_id,'tenantID' => @client.tenant_id},
282
+ query_params: {'api-version' => @client.api_version},
283
+ body: request_content,
284
+ headers: request_headers.merge(custom_headers || {}),
285
+ base_url: request_url
286
+ }
287
+ promise = @client.make_request_async(:post, path_template, options)
288
+
289
+ promise = promise.then do |result|
290
+ http_response = result.response
291
+ status_code = http_response.status
292
+ response_content = http_response.body
293
+ unless status_code == 204
294
+ error_model = JSON.load(response_content)
295
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
296
+ end
297
+
298
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
299
+
300
+ result
301
+ end
302
+
303
+ promise.execute
304
+ end
305
+
306
+ #
307
+ # Create a group in the directory.
308
+ #
309
+ # @param parameters [GroupCreateParameters] The parameters for the group to
310
+ # create.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [ADGroup] operation results.
315
+ #
316
+ def create(parameters, custom_headers:nil)
317
+ response = create_async(parameters, custom_headers:custom_headers).value!
318
+ response.body unless response.nil?
319
+ end
320
+
321
+ #
322
+ # Create a group in the directory.
323
+ #
324
+ # @param parameters [GroupCreateParameters] The parameters for the group to
325
+ # create.
326
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
327
+ # will be added to the HTTP request.
328
+ #
329
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
330
+ #
331
+ def create_with_http_info(parameters, custom_headers:nil)
332
+ create_async(parameters, custom_headers:custom_headers).value!
333
+ end
334
+
335
+ #
336
+ # Create a group in the directory.
337
+ #
338
+ # @param parameters [GroupCreateParameters] The parameters for the group to
339
+ # create.
340
+ # @param [Hash{String => String}] A hash of custom headers that will be added
341
+ # to the HTTP request.
342
+ #
343
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
344
+ #
345
+ def create_async(parameters, custom_headers:nil)
346
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
347
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
348
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
349
+
350
+
351
+ request_headers = {}
352
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
353
+
354
+ # Set Headers
355
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
356
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
357
+
358
+ # Serialize Request
359
+ request_mapper = Azure::GraphRbac::V1_6::Models::GroupCreateParameters.mapper()
360
+ request_content = @client.serialize(request_mapper, parameters)
361
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
362
+
363
+ path_template = '{tenantID}/groups'
364
+
365
+ request_url = @base_url || @client.base_url
366
+
367
+ options = {
368
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
369
+ path_params: {'tenantID' => @client.tenant_id},
370
+ query_params: {'api-version' => @client.api_version},
371
+ body: request_content,
372
+ headers: request_headers.merge(custom_headers || {}),
373
+ base_url: request_url
374
+ }
375
+ promise = @client.make_request_async(:post, path_template, options)
376
+
377
+ promise = promise.then do |result|
378
+ http_response = result.response
379
+ status_code = http_response.status
380
+ response_content = http_response.body
381
+ unless status_code == 201
382
+ error_model = JSON.load(response_content)
383
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
384
+ end
385
+
386
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
387
+ # Deserialize Response
388
+ if status_code == 201
389
+ begin
390
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
391
+ result_mapper = Azure::GraphRbac::V1_6::Models::ADGroup.mapper()
392
+ result.body = @client.deserialize(result_mapper, parsed_response)
393
+ rescue Exception => e
394
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
395
+ end
396
+ end
397
+
398
+ result
399
+ end
400
+
401
+ promise.execute
402
+ end
403
+
404
+ #
405
+ # Gets list of groups for the current tenant.
406
+ #
407
+ # @param filter [String] The filter to apply to the operation.
408
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
409
+ # will be added to the HTTP request.
410
+ #
411
+ # @return [Array<ADGroup>] operation results.
412
+ #
413
+ def list(filter:nil, custom_headers:nil)
414
+ first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
415
+ first_page.get_all_items
416
+ end
417
+
418
+ #
419
+ # Gets list of groups for the current tenant.
420
+ #
421
+ # @param filter [String] The filter to apply to the operation.
422
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
423
+ # will be added to the HTTP request.
424
+ #
425
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
426
+ #
427
+ def list_with_http_info(filter:nil, custom_headers:nil)
428
+ list_async(filter:filter, custom_headers:custom_headers).value!
429
+ end
430
+
431
+ #
432
+ # Gets list of groups for the current tenant.
433
+ #
434
+ # @param filter [String] The filter to apply to the operation.
435
+ # @param [Hash{String => String}] A hash of custom headers that will be added
436
+ # to the HTTP request.
437
+ #
438
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
439
+ #
440
+ def list_async(filter:nil, custom_headers:nil)
441
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
442
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
443
+
444
+
445
+ request_headers = {}
446
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
447
+
448
+ # Set Headers
449
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
450
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
451
+ path_template = '{tenantID}/groups'
452
+
453
+ request_url = @base_url || @client.base_url
454
+
455
+ options = {
456
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
457
+ path_params: {'tenantID' => @client.tenant_id},
458
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
459
+ headers: request_headers.merge(custom_headers || {}),
460
+ base_url: request_url
461
+ }
462
+ promise = @client.make_request_async(:get, path_template, options)
463
+
464
+ promise = promise.then do |result|
465
+ http_response = result.response
466
+ status_code = http_response.status
467
+ response_content = http_response.body
468
+ unless status_code == 200
469
+ error_model = JSON.load(response_content)
470
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
471
+ end
472
+
473
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
474
+ # Deserialize Response
475
+ if status_code == 200
476
+ begin
477
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
478
+ result_mapper = Azure::GraphRbac::V1_6::Models::GroupListResult.mapper()
479
+ result.body = @client.deserialize(result_mapper, parsed_response)
480
+ rescue Exception => e
481
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
482
+ end
483
+ end
484
+
485
+ result
486
+ end
487
+
488
+ promise.execute
489
+ end
490
+
491
+ #
492
+ # Gets the members of a group.
493
+ #
494
+ # @param object_id [String] The object ID of the group whose members should be
495
+ # retrieved.
496
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
497
+ # will be added to the HTTP request.
498
+ #
499
+ # @return [Array<AADObject>] operation results.
500
+ #
501
+ def get_group_members(object_id, custom_headers:nil)
502
+ first_page = get_group_members_as_lazy(object_id, custom_headers:custom_headers)
503
+ first_page.get_all_items
504
+ end
505
+
506
+ #
507
+ # Gets the members of a group.
508
+ #
509
+ # @param object_id [String] The object ID of the group whose members should be
510
+ # retrieved.
511
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
512
+ # will be added to the HTTP request.
513
+ #
514
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
515
+ #
516
+ def get_group_members_with_http_info(object_id, custom_headers:nil)
517
+ get_group_members_async(object_id, custom_headers:custom_headers).value!
518
+ end
519
+
520
+ #
521
+ # Gets the members of a group.
522
+ #
523
+ # @param object_id [String] The object ID of the group whose members should be
524
+ # retrieved.
525
+ # @param [Hash{String => String}] A hash of custom headers that will be added
526
+ # to the HTTP request.
527
+ #
528
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
529
+ #
530
+ def get_group_members_async(object_id, custom_headers:nil)
531
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
532
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
533
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
534
+
535
+
536
+ request_headers = {}
537
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
538
+
539
+ # Set Headers
540
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
541
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
542
+ path_template = '{tenantID}/groups/{objectId}/members'
543
+
544
+ request_url = @base_url || @client.base_url
545
+
546
+ options = {
547
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
548
+ path_params: {'objectId' => object_id,'tenantID' => @client.tenant_id},
549
+ query_params: {'api-version' => @client.api_version},
550
+ headers: request_headers.merge(custom_headers || {}),
551
+ base_url: request_url
552
+ }
553
+ promise = @client.make_request_async(:get, path_template, options)
554
+
555
+ promise = promise.then do |result|
556
+ http_response = result.response
557
+ status_code = http_response.status
558
+ response_content = http_response.body
559
+ unless status_code == 200
560
+ error_model = JSON.load(response_content)
561
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
562
+ end
563
+
564
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
565
+ # Deserialize Response
566
+ if status_code == 200
567
+ begin
568
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
569
+ result_mapper = Azure::GraphRbac::V1_6::Models::GetObjectsResult.mapper()
570
+ result.body = @client.deserialize(result_mapper, parsed_response)
571
+ rescue Exception => e
572
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
573
+ end
574
+ end
575
+
576
+ result
577
+ end
578
+
579
+ promise.execute
580
+ end
581
+
582
+ #
583
+ # Gets group information from the directory.
584
+ #
585
+ # @param object_id [String] The object ID of the user for which to get group
586
+ # information.
587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
588
+ # will be added to the HTTP request.
589
+ #
590
+ # @return [ADGroup] operation results.
591
+ #
592
+ def get(object_id, custom_headers:nil)
593
+ response = get_async(object_id, custom_headers:custom_headers).value!
594
+ response.body unless response.nil?
595
+ end
596
+
597
+ #
598
+ # Gets group information from the directory.
599
+ #
600
+ # @param object_id [String] The object ID of the user for which to get group
601
+ # information.
602
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
603
+ # will be added to the HTTP request.
604
+ #
605
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
606
+ #
607
+ def get_with_http_info(object_id, custom_headers:nil)
608
+ get_async(object_id, custom_headers:custom_headers).value!
609
+ end
610
+
611
+ #
612
+ # Gets group information from the directory.
613
+ #
614
+ # @param object_id [String] The object ID of the user for which to get group
615
+ # information.
616
+ # @param [Hash{String => String}] A hash of custom headers that will be added
617
+ # to the HTTP request.
618
+ #
619
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
620
+ #
621
+ def get_async(object_id, custom_headers:nil)
622
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
623
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
624
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
625
+
626
+
627
+ request_headers = {}
628
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
629
+
630
+ # Set Headers
631
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
632
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
633
+ path_template = '{tenantID}/groups/{objectId}'
634
+
635
+ request_url = @base_url || @client.base_url
636
+
637
+ options = {
638
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
639
+ path_params: {'objectId' => object_id,'tenantID' => @client.tenant_id},
640
+ query_params: {'api-version' => @client.api_version},
641
+ headers: request_headers.merge(custom_headers || {}),
642
+ base_url: request_url
643
+ }
644
+ promise = @client.make_request_async(:get, path_template, options)
645
+
646
+ promise = promise.then do |result|
647
+ http_response = result.response
648
+ status_code = http_response.status
649
+ response_content = http_response.body
650
+ unless status_code == 200
651
+ error_model = JSON.load(response_content)
652
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
653
+ end
654
+
655
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
656
+ # Deserialize Response
657
+ if status_code == 200
658
+ begin
659
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
660
+ result_mapper = Azure::GraphRbac::V1_6::Models::ADGroup.mapper()
661
+ result.body = @client.deserialize(result_mapper, parsed_response)
662
+ rescue Exception => e
663
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
664
+ end
665
+ end
666
+
667
+ result
668
+ end
669
+
670
+ promise.execute
671
+ end
672
+
673
+ #
674
+ # Delete a group from the directory.
675
+ #
676
+ # @param object_id [String] The object ID of the group to delete.
677
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
678
+ # will be added to the HTTP request.
679
+ #
680
+ #
681
+ def delete(object_id, custom_headers:nil)
682
+ response = delete_async(object_id, custom_headers:custom_headers).value!
683
+ nil
684
+ end
685
+
686
+ #
687
+ # Delete a group from the directory.
688
+ #
689
+ # @param object_id [String] The object ID of the group to delete.
690
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
691
+ # will be added to the HTTP request.
692
+ #
693
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
694
+ #
695
+ def delete_with_http_info(object_id, custom_headers:nil)
696
+ delete_async(object_id, custom_headers:custom_headers).value!
697
+ end
698
+
699
+ #
700
+ # Delete a group from the directory.
701
+ #
702
+ # @param object_id [String] The object ID of the group to delete.
703
+ # @param [Hash{String => String}] A hash of custom headers that will be added
704
+ # to the HTTP request.
705
+ #
706
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
707
+ #
708
+ def delete_async(object_id, custom_headers:nil)
709
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
710
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
711
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
712
+
713
+
714
+ request_headers = {}
715
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
716
+
717
+ # Set Headers
718
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
719
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
720
+ path_template = '{tenantID}/groups/{objectId}'
721
+
722
+ request_url = @base_url || @client.base_url
723
+
724
+ options = {
725
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
726
+ path_params: {'objectId' => object_id,'tenantID' => @client.tenant_id},
727
+ query_params: {'api-version' => @client.api_version},
728
+ headers: request_headers.merge(custom_headers || {}),
729
+ base_url: request_url
730
+ }
731
+ promise = @client.make_request_async(:delete, path_template, options)
732
+
733
+ promise = promise.then do |result|
734
+ http_response = result.response
735
+ status_code = http_response.status
736
+ response_content = http_response.body
737
+ unless status_code == 204
738
+ error_model = JSON.load(response_content)
739
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
740
+ end
741
+
742
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
743
+
744
+ result
745
+ end
746
+
747
+ promise.execute
748
+ end
749
+
750
+ #
751
+ # Gets a collection of object IDs of groups of which the specified group is a
752
+ # member.
753
+ #
754
+ # @param object_id [String] The object ID of the group for which to get group
755
+ # membership.
756
+ # @param parameters [GroupGetMemberGroupsParameters] Group filtering
757
+ # parameters.
758
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
759
+ # will be added to the HTTP request.
760
+ #
761
+ # @return [GroupGetMemberGroupsResult] operation results.
762
+ #
763
+ def get_member_groups(object_id, parameters, custom_headers:nil)
764
+ response = get_member_groups_async(object_id, parameters, custom_headers:custom_headers).value!
765
+ response.body unless response.nil?
766
+ end
767
+
768
+ #
769
+ # Gets a collection of object IDs of groups of which the specified group is a
770
+ # member.
771
+ #
772
+ # @param object_id [String] The object ID of the group for which to get group
773
+ # membership.
774
+ # @param parameters [GroupGetMemberGroupsParameters] Group filtering
775
+ # parameters.
776
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
777
+ # will be added to the HTTP request.
778
+ #
779
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
780
+ #
781
+ def get_member_groups_with_http_info(object_id, parameters, custom_headers:nil)
782
+ get_member_groups_async(object_id, parameters, custom_headers:custom_headers).value!
783
+ end
784
+
785
+ #
786
+ # Gets a collection of object IDs of groups of which the specified group is a
787
+ # member.
788
+ #
789
+ # @param object_id [String] The object ID of the group for which to get group
790
+ # membership.
791
+ # @param parameters [GroupGetMemberGroupsParameters] Group filtering
792
+ # parameters.
793
+ # @param [Hash{String => String}] A hash of custom headers that will be added
794
+ # to the HTTP request.
795
+ #
796
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
797
+ #
798
+ def get_member_groups_async(object_id, parameters, custom_headers:nil)
799
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
800
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
801
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
802
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
803
+
804
+
805
+ request_headers = {}
806
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
807
+
808
+ # Set Headers
809
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
810
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
811
+
812
+ # Serialize Request
813
+ request_mapper = Azure::GraphRbac::V1_6::Models::GroupGetMemberGroupsParameters.mapper()
814
+ request_content = @client.serialize(request_mapper, parameters)
815
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
816
+
817
+ path_template = '{tenantID}/groups/{objectId}/getMemberGroups'
818
+
819
+ request_url = @base_url || @client.base_url
820
+
821
+ options = {
822
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
823
+ path_params: {'objectId' => object_id,'tenantID' => @client.tenant_id},
824
+ query_params: {'api-version' => @client.api_version},
825
+ body: request_content,
826
+ headers: request_headers.merge(custom_headers || {}),
827
+ base_url: request_url
828
+ }
829
+ promise = @client.make_request_async(:post, path_template, options)
830
+
831
+ promise = promise.then do |result|
832
+ http_response = result.response
833
+ status_code = http_response.status
834
+ response_content = http_response.body
835
+ unless status_code == 200
836
+ error_model = JSON.load(response_content)
837
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
838
+ end
839
+
840
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
841
+ # Deserialize Response
842
+ if status_code == 200
843
+ begin
844
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
845
+ result_mapper = Azure::GraphRbac::V1_6::Models::GroupGetMemberGroupsResult.mapper()
846
+ result.body = @client.deserialize(result_mapper, parsed_response)
847
+ rescue Exception => e
848
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
849
+ end
850
+ end
851
+
852
+ result
853
+ end
854
+
855
+ promise.execute
856
+ end
857
+
858
+ #
859
+ # Gets a list of groups for the current tenant.
860
+ #
861
+ # @param next_link [String] Next link for the list operation.
862
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
863
+ # will be added to the HTTP request.
864
+ #
865
+ # @return [Array<ADGroup>] operation results.
866
+ #
867
+ def list_next(next_link, custom_headers:nil)
868
+ response = list_next_async(next_link, custom_headers:custom_headers).value!
869
+ response.body unless response.nil?
870
+ end
871
+
872
+ #
873
+ # Gets a list of groups for the current tenant.
874
+ #
875
+ # @param next_link [String] Next link for the list operation.
876
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
877
+ # will be added to the HTTP request.
878
+ #
879
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
880
+ #
881
+ def list_next_with_http_info(next_link, custom_headers:nil)
882
+ list_next_async(next_link, custom_headers:custom_headers).value!
883
+ end
884
+
885
+ #
886
+ # Gets a list of groups for the current tenant.
887
+ #
888
+ # @param next_link [String] Next link for the list operation.
889
+ # @param [Hash{String => String}] A hash of custom headers that will be added
890
+ # to the HTTP request.
891
+ #
892
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
893
+ #
894
+ def list_next_async(next_link, custom_headers:nil)
895
+ fail ArgumentError, 'next_link is nil' if next_link.nil?
896
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
897
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
898
+
899
+
900
+ request_headers = {}
901
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
902
+
903
+ # Set Headers
904
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
905
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
906
+ path_template = '{tenantID}/{nextLink}'
907
+
908
+ request_url = @base_url || @client.base_url
909
+
910
+ options = {
911
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
912
+ path_params: {'tenantID' => @client.tenant_id},
913
+ skip_encoding_path_params: {'nextLink' => next_link},
914
+ query_params: {'api-version' => @client.api_version},
915
+ headers: request_headers.merge(custom_headers || {}),
916
+ base_url: request_url
917
+ }
918
+ promise = @client.make_request_async(:get, path_template, options)
919
+
920
+ promise = promise.then do |result|
921
+ http_response = result.response
922
+ status_code = http_response.status
923
+ response_content = http_response.body
924
+ unless status_code == 200
925
+ error_model = JSON.load(response_content)
926
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
927
+ end
928
+
929
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
930
+ # Deserialize Response
931
+ if status_code == 200
932
+ begin
933
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
934
+ result_mapper = Azure::GraphRbac::V1_6::Models::GroupListResult.mapper()
935
+ result.body = @client.deserialize(result_mapper, parsed_response)
936
+ rescue Exception => e
937
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
938
+ end
939
+ end
940
+
941
+ result
942
+ end
943
+
944
+ promise.execute
945
+ end
946
+
947
+ #
948
+ # Gets the members of a group.
949
+ #
950
+ # @param next_link [String] Next link for the list operation.
951
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
952
+ # will be added to the HTTP request.
953
+ #
954
+ # @return [Array<AADObject>] operation results.
955
+ #
956
+ def get_group_members_next(next_link, custom_headers:nil)
957
+ response = get_group_members_next_async(next_link, custom_headers:custom_headers).value!
958
+ response.body unless response.nil?
959
+ end
960
+
961
+ #
962
+ # Gets the members of a group.
963
+ #
964
+ # @param next_link [String] Next link for the list operation.
965
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
966
+ # will be added to the HTTP request.
967
+ #
968
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
969
+ #
970
+ def get_group_members_next_with_http_info(next_link, custom_headers:nil)
971
+ get_group_members_next_async(next_link, custom_headers:custom_headers).value!
972
+ end
973
+
974
+ #
975
+ # Gets the members of a group.
976
+ #
977
+ # @param next_link [String] Next link for the list operation.
978
+ # @param [Hash{String => String}] A hash of custom headers that will be added
979
+ # to the HTTP request.
980
+ #
981
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
982
+ #
983
+ def get_group_members_next_async(next_link, custom_headers:nil)
984
+ fail ArgumentError, 'next_link is nil' if next_link.nil?
985
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
986
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
987
+
988
+
989
+ request_headers = {}
990
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
991
+
992
+ # Set Headers
993
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
994
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
995
+ path_template = '{tenantID}/{nextLink}'
996
+
997
+ request_url = @base_url || @client.base_url
998
+
999
+ options = {
1000
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1001
+ path_params: {'tenantID' => @client.tenant_id},
1002
+ skip_encoding_path_params: {'nextLink' => next_link},
1003
+ query_params: {'api-version' => @client.api_version},
1004
+ headers: request_headers.merge(custom_headers || {}),
1005
+ base_url: request_url
1006
+ }
1007
+ promise = @client.make_request_async(:get, path_template, options)
1008
+
1009
+ promise = promise.then do |result|
1010
+ http_response = result.response
1011
+ status_code = http_response.status
1012
+ response_content = http_response.body
1013
+ unless status_code == 200
1014
+ error_model = JSON.load(response_content)
1015
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1016
+ end
1017
+
1018
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1019
+ # Deserialize Response
1020
+ if status_code == 200
1021
+ begin
1022
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1023
+ result_mapper = Azure::GraphRbac::V1_6::Models::GetObjectsResult.mapper()
1024
+ result.body = @client.deserialize(result_mapper, parsed_response)
1025
+ rescue Exception => e
1026
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1027
+ end
1028
+ end
1029
+
1030
+ result
1031
+ end
1032
+
1033
+ promise.execute
1034
+ end
1035
+
1036
+ #
1037
+ # Gets list of groups for the current tenant.
1038
+ #
1039
+ # @param filter [String] The filter to apply to the operation.
1040
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1041
+ # will be added to the HTTP request.
1042
+ #
1043
+ # @return [GroupListResult] which provide lazy access to pages of the response.
1044
+ #
1045
+ def list_as_lazy(filter:nil, custom_headers:nil)
1046
+ response = list_async(filter:filter, custom_headers:custom_headers).value!
1047
+ unless response.nil?
1048
+ page = response.body
1049
+ page.next_method = Proc.new do |next_link|
1050
+ list_next_async(next_link, custom_headers:custom_headers)
1051
+ end
1052
+ page
1053
+ end
1054
+ end
1055
+
1056
+ #
1057
+ # Gets the members of a group.
1058
+ #
1059
+ # @param object_id [String] The object ID of the group whose members should be
1060
+ # retrieved.
1061
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1062
+ # will be added to the HTTP request.
1063
+ #
1064
+ # @return [GetObjectsResult] which provide lazy access to pages of the
1065
+ # response.
1066
+ #
1067
+ def get_group_members_as_lazy(object_id, custom_headers:nil)
1068
+ response = get_group_members_async(object_id, custom_headers:custom_headers).value!
1069
+ unless response.nil?
1070
+ page = response.body
1071
+ page.next_method = Proc.new do |next_link|
1072
+ get_group_members_next_async(next_link, custom_headers:custom_headers)
1073
+ end
1074
+ page
1075
+ end
1076
+ end
1077
+
1078
+ end
1079
+ end