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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 62d304e31d7169484ca3302edc97b8cd5c735bfb
4
+ data.tar.gz: e4391020103b6cf36b29eeaa6c2b8950e7593a75
5
+ SHA512:
6
+ metadata.gz: 7e08f947f25b69b638bbae33243937ee9e04c9b7003c31b370505cb2513563d7a81cd79da4b20cfa4a55d9c87046680565fb7605bbe10c59471084b0678977ad
7
+ data.tar.gz: 713837ec976c30bf59c3644d94edf0de963ac841280210350eae69d7bf7a99a4021cd269c1690e08e61b4f94e1cb63fc3cdfd0a7fe6ca560a67569713234ad23
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,75 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '1.6/generated/azure_graph_rbac/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::GraphRbac::V1_6
23
+ autoload :Objects, '1.6/generated/azure_graph_rbac/objects.rb'
24
+ autoload :Applications, '1.6/generated/azure_graph_rbac/applications.rb'
25
+ autoload :Groups, '1.6/generated/azure_graph_rbac/groups.rb'
26
+ autoload :ServicePrincipals, '1.6/generated/azure_graph_rbac/service_principals.rb'
27
+ autoload :Users, '1.6/generated/azure_graph_rbac/users.rb'
28
+ autoload :Domains, '1.6/generated/azure_graph_rbac/domains.rb'
29
+ autoload :GraphRbacClient, '1.6/generated/azure_graph_rbac/graph_rbac_client.rb'
30
+
31
+ module Models
32
+ autoload :GroupAddMemberParameters, '1.6/generated/azure_graph_rbac/models/group_add_member_parameters.rb'
33
+ autoload :GraphError, '1.6/generated/azure_graph_rbac/models/graph_error.rb'
34
+ autoload :GroupCreateParameters, '1.6/generated/azure_graph_rbac/models/group_create_parameters.rb'
35
+ autoload :KeyCredential, '1.6/generated/azure_graph_rbac/models/key_credential.rb'
36
+ autoload :ResourceAccess, '1.6/generated/azure_graph_rbac/models/resource_access.rb'
37
+ autoload :GroupListResult, '1.6/generated/azure_graph_rbac/models/group_list_result.rb'
38
+ autoload :ApplicationCreateParameters, '1.6/generated/azure_graph_rbac/models/application_create_parameters.rb'
39
+ autoload :GroupGetMemberGroupsParameters, '1.6/generated/azure_graph_rbac/models/group_get_member_groups_parameters.rb'
40
+ autoload :UserGetMemberGroupsResult, '1.6/generated/azure_graph_rbac/models/user_get_member_groups_result.rb'
41
+ autoload :ApplicationListResult, '1.6/generated/azure_graph_rbac/models/application_list_result.rb'
42
+ autoload :GroupGetMemberGroupsResult, '1.6/generated/azure_graph_rbac/models/group_get_member_groups_result.rb'
43
+ autoload :KeyCredentialListResult, '1.6/generated/azure_graph_rbac/models/key_credential_list_result.rb'
44
+ autoload :CheckGroupMembershipParameters, '1.6/generated/azure_graph_rbac/models/check_group_membership_parameters.rb'
45
+ autoload :KeyCredentialsUpdateParameters, '1.6/generated/azure_graph_rbac/models/key_credentials_update_parameters.rb'
46
+ autoload :CheckGroupMembershipResult, '1.6/generated/azure_graph_rbac/models/check_group_membership_result.rb'
47
+ autoload :PasswordCredentialsUpdateParameters, '1.6/generated/azure_graph_rbac/models/password_credentials_update_parameters.rb'
48
+ autoload :ServicePrincipalCreateParameters, '1.6/generated/azure_graph_rbac/models/service_principal_create_parameters.rb'
49
+ autoload :GetObjectsResult, '1.6/generated/azure_graph_rbac/models/get_objects_result.rb'
50
+ autoload :DomainListResult, '1.6/generated/azure_graph_rbac/models/domain_list_result.rb'
51
+ autoload :PasswordCredential, '1.6/generated/azure_graph_rbac/models/password_credential.rb'
52
+ autoload :ServicePrincipalListResult, '1.6/generated/azure_graph_rbac/models/service_principal_list_result.rb'
53
+ autoload :ApplicationUpdateParameters, '1.6/generated/azure_graph_rbac/models/application_update_parameters.rb'
54
+ autoload :PasswordProfile, '1.6/generated/azure_graph_rbac/models/password_profile.rb'
55
+ autoload :DirectoryObjectListResult, '1.6/generated/azure_graph_rbac/models/directory_object_list_result.rb'
56
+ autoload :UserBase, '1.6/generated/azure_graph_rbac/models/user_base.rb'
57
+ autoload :AADObject, '1.6/generated/azure_graph_rbac/models/aadobject.rb'
58
+ autoload :Domain, '1.6/generated/azure_graph_rbac/models/domain.rb'
59
+ autoload :RequiredResourceAccess, '1.6/generated/azure_graph_rbac/models/required_resource_access.rb'
60
+ autoload :GetObjectsParameters, '1.6/generated/azure_graph_rbac/models/get_objects_parameters.rb'
61
+ autoload :PasswordCredentialListResult, '1.6/generated/azure_graph_rbac/models/password_credential_list_result.rb'
62
+ autoload :SignInName, '1.6/generated/azure_graph_rbac/models/sign_in_name.rb'
63
+ autoload :ApplicationAddOwnerParameters, '1.6/generated/azure_graph_rbac/models/application_add_owner_parameters.rb'
64
+ autoload :UserListResult, '1.6/generated/azure_graph_rbac/models/user_list_result.rb'
65
+ autoload :DirectoryObject, '1.6/generated/azure_graph_rbac/models/directory_object.rb'
66
+ autoload :UserGetMemberGroupsParameters, '1.6/generated/azure_graph_rbac/models/user_get_member_groups_parameters.rb'
67
+ autoload :Application, '1.6/generated/azure_graph_rbac/models/application.rb'
68
+ autoload :ADGroup, '1.6/generated/azure_graph_rbac/models/adgroup.rb'
69
+ autoload :ServicePrincipal, '1.6/generated/azure_graph_rbac/models/service_principal.rb'
70
+ autoload :UserCreateParameters, '1.6/generated/azure_graph_rbac/models/user_create_parameters.rb'
71
+ autoload :UserUpdateParameters, '1.6/generated/azure_graph_rbac/models/user_update_parameters.rb'
72
+ autoload :User, '1.6/generated/azure_graph_rbac/models/user.rb'
73
+ autoload :UserType, '1.6/generated/azure_graph_rbac/models/user_type.rb'
74
+ end
75
+ end
@@ -0,0 +1,1131 @@
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 Applications
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Applications 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
+ # Create a new application.
26
+ #
27
+ # @param parameters [ApplicationCreateParameters] The parameters for creating
28
+ # an application.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [Application] operation results.
33
+ #
34
+ def create(parameters, custom_headers:nil)
35
+ response = create_async(parameters, custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Create a new application.
41
+ #
42
+ # @param parameters [ApplicationCreateParameters] The parameters for creating
43
+ # an application.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def create_with_http_info(parameters, custom_headers:nil)
50
+ create_async(parameters, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Create a new application.
55
+ #
56
+ # @param parameters [ApplicationCreateParameters] The parameters for creating
57
+ # an application.
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def create_async(parameters, custom_headers:nil)
64
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
65
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
66
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
67
+
68
+
69
+ request_headers = {}
70
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
71
+
72
+ # Set Headers
73
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
74
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
75
+
76
+ # Serialize Request
77
+ request_mapper = Azure::GraphRbac::V1_6::Models::ApplicationCreateParameters.mapper()
78
+ request_content = @client.serialize(request_mapper, parameters)
79
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
80
+
81
+ path_template = '{tenantID}/applications'
82
+
83
+ request_url = @base_url || @client.base_url
84
+
85
+ options = {
86
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
87
+ path_params: {'tenantID' => @client.tenant_id},
88
+ query_params: {'api-version' => @client.api_version},
89
+ body: request_content,
90
+ headers: request_headers.merge(custom_headers || {}),
91
+ base_url: request_url
92
+ }
93
+ promise = @client.make_request_async(:post, path_template, options)
94
+
95
+ promise = promise.then do |result|
96
+ http_response = result.response
97
+ status_code = http_response.status
98
+ response_content = http_response.body
99
+ unless status_code == 201
100
+ error_model = JSON.load(response_content)
101
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
102
+ end
103
+
104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
105
+ # Deserialize Response
106
+ if status_code == 201
107
+ begin
108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
109
+ result_mapper = Azure::GraphRbac::V1_6::Models::Application.mapper()
110
+ result.body = @client.deserialize(result_mapper, parsed_response)
111
+ rescue Exception => e
112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
113
+ end
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ #
123
+ # Lists applications by filter parameters.
124
+ #
125
+ # @param filter [String] The filters to apply to the operation.
126
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
127
+ # will be added to the HTTP request.
128
+ #
129
+ # @return [Array<Application>] operation results.
130
+ #
131
+ def list(filter:nil, custom_headers:nil)
132
+ first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
133
+ first_page.get_all_items
134
+ end
135
+
136
+ #
137
+ # Lists applications by filter parameters.
138
+ #
139
+ # @param filter [String] The filters to apply to the operation.
140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
+ # will be added to the HTTP request.
142
+ #
143
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
144
+ #
145
+ def list_with_http_info(filter:nil, custom_headers:nil)
146
+ list_async(filter:filter, custom_headers:custom_headers).value!
147
+ end
148
+
149
+ #
150
+ # Lists applications by filter parameters.
151
+ #
152
+ # @param filter [String] The filters to apply to the operation.
153
+ # @param [Hash{String => String}] A hash of custom headers that will be added
154
+ # to the HTTP request.
155
+ #
156
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
157
+ #
158
+ def list_async(filter:nil, custom_headers:nil)
159
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
160
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
161
+
162
+
163
+ request_headers = {}
164
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
165
+
166
+ # Set Headers
167
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
168
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
169
+ path_template = '{tenantID}/applications'
170
+
171
+ request_url = @base_url || @client.base_url
172
+
173
+ options = {
174
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
175
+ path_params: {'tenantID' => @client.tenant_id},
176
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
177
+ headers: request_headers.merge(custom_headers || {}),
178
+ base_url: request_url
179
+ }
180
+ promise = @client.make_request_async(:get, path_template, options)
181
+
182
+ promise = promise.then do |result|
183
+ http_response = result.response
184
+ status_code = http_response.status
185
+ response_content = http_response.body
186
+ unless status_code == 200
187
+ error_model = JSON.load(response_content)
188
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
189
+ end
190
+
191
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
192
+ # Deserialize Response
193
+ if status_code == 200
194
+ begin
195
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
196
+ result_mapper = Azure::GraphRbac::V1_6::Models::ApplicationListResult.mapper()
197
+ result.body = @client.deserialize(result_mapper, parsed_response)
198
+ rescue Exception => e
199
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
200
+ end
201
+ end
202
+
203
+ result
204
+ end
205
+
206
+ promise.execute
207
+ end
208
+
209
+ #
210
+ # Delete an application.
211
+ #
212
+ # @param application_object_id [String] Application object ID.
213
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
214
+ # will be added to the HTTP request.
215
+ #
216
+ #
217
+ def delete(application_object_id, custom_headers:nil)
218
+ response = delete_async(application_object_id, custom_headers:custom_headers).value!
219
+ nil
220
+ end
221
+
222
+ #
223
+ # Delete an application.
224
+ #
225
+ # @param application_object_id [String] Application object ID.
226
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
227
+ # will be added to the HTTP request.
228
+ #
229
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
230
+ #
231
+ def delete_with_http_info(application_object_id, custom_headers:nil)
232
+ delete_async(application_object_id, custom_headers:custom_headers).value!
233
+ end
234
+
235
+ #
236
+ # Delete an application.
237
+ #
238
+ # @param application_object_id [String] Application object ID.
239
+ # @param [Hash{String => String}] A hash of custom headers that will be added
240
+ # to the HTTP request.
241
+ #
242
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
243
+ #
244
+ def delete_async(application_object_id, custom_headers:nil)
245
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
246
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
247
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
248
+
249
+
250
+ request_headers = {}
251
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
252
+
253
+ # Set Headers
254
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
255
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
256
+ path_template = '{tenantID}/applications/{applicationObjectId}'
257
+
258
+ request_url = @base_url || @client.base_url
259
+
260
+ options = {
261
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
262
+ path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_id},
263
+ query_params: {'api-version' => @client.api_version},
264
+ headers: request_headers.merge(custom_headers || {}),
265
+ base_url: request_url
266
+ }
267
+ promise = @client.make_request_async(:delete, path_template, options)
268
+
269
+ promise = promise.then do |result|
270
+ http_response = result.response
271
+ status_code = http_response.status
272
+ response_content = http_response.body
273
+ unless status_code == 204
274
+ error_model = JSON.load(response_content)
275
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
276
+ end
277
+
278
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
279
+
280
+ result
281
+ end
282
+
283
+ promise.execute
284
+ end
285
+
286
+ #
287
+ # Get an application by object ID.
288
+ #
289
+ # @param application_object_id [String] Application object ID.
290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
291
+ # will be added to the HTTP request.
292
+ #
293
+ # @return [Application] operation results.
294
+ #
295
+ def get(application_object_id, custom_headers:nil)
296
+ response = get_async(application_object_id, custom_headers:custom_headers).value!
297
+ response.body unless response.nil?
298
+ end
299
+
300
+ #
301
+ # Get an application by object ID.
302
+ #
303
+ # @param application_object_id [String] Application object ID.
304
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
305
+ # will be added to the HTTP request.
306
+ #
307
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
308
+ #
309
+ def get_with_http_info(application_object_id, custom_headers:nil)
310
+ get_async(application_object_id, custom_headers:custom_headers).value!
311
+ end
312
+
313
+ #
314
+ # Get an application by object ID.
315
+ #
316
+ # @param application_object_id [String] Application object ID.
317
+ # @param [Hash{String => String}] A hash of custom headers that will be added
318
+ # to the HTTP request.
319
+ #
320
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
321
+ #
322
+ def get_async(application_object_id, custom_headers:nil)
323
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
324
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
325
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
326
+
327
+
328
+ request_headers = {}
329
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
330
+
331
+ # Set Headers
332
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
333
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
334
+ path_template = '{tenantID}/applications/{applicationObjectId}'
335
+
336
+ request_url = @base_url || @client.base_url
337
+
338
+ options = {
339
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
340
+ path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_id},
341
+ query_params: {'api-version' => @client.api_version},
342
+ headers: request_headers.merge(custom_headers || {}),
343
+ base_url: request_url
344
+ }
345
+ promise = @client.make_request_async(:get, path_template, options)
346
+
347
+ promise = promise.then do |result|
348
+ http_response = result.response
349
+ status_code = http_response.status
350
+ response_content = http_response.body
351
+ unless status_code == 200
352
+ error_model = JSON.load(response_content)
353
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
354
+ end
355
+
356
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
357
+ # Deserialize Response
358
+ if status_code == 200
359
+ begin
360
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
361
+ result_mapper = Azure::GraphRbac::V1_6::Models::Application.mapper()
362
+ result.body = @client.deserialize(result_mapper, parsed_response)
363
+ rescue Exception => e
364
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
365
+ end
366
+ end
367
+
368
+ result
369
+ end
370
+
371
+ promise.execute
372
+ end
373
+
374
+ #
375
+ # Update an existing application.
376
+ #
377
+ # @param application_object_id [String] Application object ID.
378
+ # @param parameters [ApplicationUpdateParameters] Parameters to update an
379
+ # existing application.
380
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
381
+ # will be added to the HTTP request.
382
+ #
383
+ #
384
+ def patch(application_object_id, parameters, custom_headers:nil)
385
+ response = patch_async(application_object_id, parameters, custom_headers:custom_headers).value!
386
+ nil
387
+ end
388
+
389
+ #
390
+ # Update an existing application.
391
+ #
392
+ # @param application_object_id [String] Application object ID.
393
+ # @param parameters [ApplicationUpdateParameters] Parameters to update an
394
+ # existing application.
395
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
396
+ # will be added to the HTTP request.
397
+ #
398
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
399
+ #
400
+ def patch_with_http_info(application_object_id, parameters, custom_headers:nil)
401
+ patch_async(application_object_id, parameters, custom_headers:custom_headers).value!
402
+ end
403
+
404
+ #
405
+ # Update an existing application.
406
+ #
407
+ # @param application_object_id [String] Application object ID.
408
+ # @param parameters [ApplicationUpdateParameters] Parameters to update an
409
+ # existing application.
410
+ # @param [Hash{String => String}] A hash of custom headers that will be added
411
+ # to the HTTP request.
412
+ #
413
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
414
+ #
415
+ def patch_async(application_object_id, parameters, custom_headers:nil)
416
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
417
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
418
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
419
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
420
+
421
+
422
+ request_headers = {}
423
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
424
+
425
+ # Set Headers
426
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
427
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
428
+
429
+ # Serialize Request
430
+ request_mapper = Azure::GraphRbac::V1_6::Models::ApplicationUpdateParameters.mapper()
431
+ request_content = @client.serialize(request_mapper, parameters)
432
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
433
+
434
+ path_template = '{tenantID}/applications/{applicationObjectId}'
435
+
436
+ request_url = @base_url || @client.base_url
437
+
438
+ options = {
439
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
440
+ path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_id},
441
+ query_params: {'api-version' => @client.api_version},
442
+ body: request_content,
443
+ headers: request_headers.merge(custom_headers || {}),
444
+ base_url: request_url
445
+ }
446
+ promise = @client.make_request_async(:patch, path_template, options)
447
+
448
+ promise = promise.then do |result|
449
+ http_response = result.response
450
+ status_code = http_response.status
451
+ response_content = http_response.body
452
+ unless status_code == 204
453
+ error_model = JSON.load(response_content)
454
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
455
+ end
456
+
457
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
458
+
459
+ result
460
+ end
461
+
462
+ promise.execute
463
+ end
464
+
465
+ #
466
+ # Directory objects that are owners of the application.
467
+ #
468
+ # The owners are a set of non-admin users who are allowed to modify this
469
+ # object.
470
+ #
471
+ # @param application_object_id [String] The object ID of the application for
472
+ # which to get owners.
473
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
474
+ # will be added to the HTTP request.
475
+ #
476
+ # @return [DirectoryObjectListResult] operation results.
477
+ #
478
+ def list_owners(application_object_id, custom_headers:nil)
479
+ response = list_owners_async(application_object_id, custom_headers:custom_headers).value!
480
+ response.body unless response.nil?
481
+ end
482
+
483
+ #
484
+ # Directory objects that are owners of the application.
485
+ #
486
+ # The owners are a set of non-admin users who are allowed to modify this
487
+ # object.
488
+ #
489
+ # @param application_object_id [String] The object ID of the application for
490
+ # which to get owners.
491
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
492
+ # will be added to the HTTP request.
493
+ #
494
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
495
+ #
496
+ def list_owners_with_http_info(application_object_id, custom_headers:nil)
497
+ list_owners_async(application_object_id, custom_headers:custom_headers).value!
498
+ end
499
+
500
+ #
501
+ # Directory objects that are owners of the application.
502
+ #
503
+ # The owners are a set of non-admin users who are allowed to modify this
504
+ # object.
505
+ #
506
+ # @param application_object_id [String] The object ID of the application for
507
+ # which to get owners.
508
+ # @param [Hash{String => String}] A hash of custom headers that will be added
509
+ # to the HTTP request.
510
+ #
511
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
512
+ #
513
+ def list_owners_async(application_object_id, custom_headers:nil)
514
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
515
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
516
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
517
+
518
+
519
+ request_headers = {}
520
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
521
+
522
+ # Set Headers
523
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
524
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
525
+ path_template = '{tenantID}/applications/{applicationObjectId}/owners'
526
+
527
+ request_url = @base_url || @client.base_url
528
+
529
+ options = {
530
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
531
+ path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_id},
532
+ query_params: {'api-version' => @client.api_version},
533
+ headers: request_headers.merge(custom_headers || {}),
534
+ base_url: request_url
535
+ }
536
+ promise = @client.make_request_async(:get, path_template, options)
537
+
538
+ promise = promise.then do |result|
539
+ http_response = result.response
540
+ status_code = http_response.status
541
+ response_content = http_response.body
542
+ unless status_code == 200
543
+ error_model = JSON.load(response_content)
544
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
545
+ end
546
+
547
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
548
+ # Deserialize Response
549
+ if status_code == 200
550
+ begin
551
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
552
+ result_mapper = Azure::GraphRbac::V1_6::Models::DirectoryObjectListResult.mapper()
553
+ result.body = @client.deserialize(result_mapper, parsed_response)
554
+ rescue Exception => e
555
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
556
+ end
557
+ end
558
+
559
+ result
560
+ end
561
+
562
+ promise.execute
563
+ end
564
+
565
+ #
566
+ # Add an owner to an application.
567
+ #
568
+ # @param application_object_id [String] The object ID of the application to
569
+ # which to add the owner.
570
+ # @param parameters [ApplicationAddOwnerParameters] The URL of the owner
571
+ # object, such as
572
+ # https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
573
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
574
+ # will be added to the HTTP request.
575
+ #
576
+ #
577
+ def add_owner(application_object_id, parameters, custom_headers:nil)
578
+ response = add_owner_async(application_object_id, parameters, custom_headers:custom_headers).value!
579
+ nil
580
+ end
581
+
582
+ #
583
+ # Add an owner to an application.
584
+ #
585
+ # @param application_object_id [String] The object ID of the application to
586
+ # which to add the owner.
587
+ # @param parameters [ApplicationAddOwnerParameters] The URL of the owner
588
+ # object, such as
589
+ # https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
590
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
591
+ # will be added to the HTTP request.
592
+ #
593
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
594
+ #
595
+ def add_owner_with_http_info(application_object_id, parameters, custom_headers:nil)
596
+ add_owner_async(application_object_id, parameters, custom_headers:custom_headers).value!
597
+ end
598
+
599
+ #
600
+ # Add an owner to an application.
601
+ #
602
+ # @param application_object_id [String] The object ID of the application to
603
+ # which to add the owner.
604
+ # @param parameters [ApplicationAddOwnerParameters] The URL of the owner
605
+ # object, such as
606
+ # https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
607
+ # @param [Hash{String => String}] A hash of custom headers that will be added
608
+ # to the HTTP request.
609
+ #
610
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
611
+ #
612
+ def add_owner_async(application_object_id, parameters, custom_headers:nil)
613
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
614
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
615
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
616
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
617
+
618
+
619
+ request_headers = {}
620
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
621
+
622
+ # Set Headers
623
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
624
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
625
+
626
+ # Serialize Request
627
+ request_mapper = Azure::GraphRbac::V1_6::Models::ApplicationAddOwnerParameters.mapper()
628
+ request_content = @client.serialize(request_mapper, parameters)
629
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
630
+
631
+ path_template = '{tenantID}/applications/{applicationObjectId}/$links/owners'
632
+
633
+ request_url = @base_url || @client.base_url
634
+
635
+ options = {
636
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
637
+ path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_id},
638
+ query_params: {'api-version' => @client.api_version},
639
+ body: request_content,
640
+ headers: request_headers.merge(custom_headers || {}),
641
+ base_url: request_url
642
+ }
643
+ promise = @client.make_request_async(:post, path_template, options)
644
+
645
+ promise = promise.then do |result|
646
+ http_response = result.response
647
+ status_code = http_response.status
648
+ response_content = http_response.body
649
+ unless status_code == 204
650
+ error_model = JSON.load(response_content)
651
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
652
+ end
653
+
654
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
655
+
656
+ result
657
+ end
658
+
659
+ promise.execute
660
+ end
661
+
662
+ #
663
+ # Get the keyCredentials associated with an application.
664
+ #
665
+ # @param application_object_id [String] Application object ID.
666
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
667
+ # will be added to the HTTP request.
668
+ #
669
+ # @return [KeyCredentialListResult] operation results.
670
+ #
671
+ def list_key_credentials(application_object_id, custom_headers:nil)
672
+ response = list_key_credentials_async(application_object_id, custom_headers:custom_headers).value!
673
+ response.body unless response.nil?
674
+ end
675
+
676
+ #
677
+ # Get the keyCredentials associated with an application.
678
+ #
679
+ # @param application_object_id [String] Application object ID.
680
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
681
+ # will be added to the HTTP request.
682
+ #
683
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
684
+ #
685
+ def list_key_credentials_with_http_info(application_object_id, custom_headers:nil)
686
+ list_key_credentials_async(application_object_id, custom_headers:custom_headers).value!
687
+ end
688
+
689
+ #
690
+ # Get the keyCredentials associated with an application.
691
+ #
692
+ # @param application_object_id [String] Application object ID.
693
+ # @param [Hash{String => String}] A hash of custom headers that will be added
694
+ # to the HTTP request.
695
+ #
696
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
697
+ #
698
+ def list_key_credentials_async(application_object_id, custom_headers:nil)
699
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
700
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
701
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
702
+
703
+
704
+ request_headers = {}
705
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
706
+
707
+ # Set Headers
708
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
709
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
710
+ path_template = '{tenantID}/applications/{applicationObjectId}/keyCredentials'
711
+
712
+ request_url = @base_url || @client.base_url
713
+
714
+ options = {
715
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
716
+ path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_id},
717
+ query_params: {'api-version' => @client.api_version},
718
+ headers: request_headers.merge(custom_headers || {}),
719
+ base_url: request_url
720
+ }
721
+ promise = @client.make_request_async(:get, path_template, options)
722
+
723
+ promise = promise.then do |result|
724
+ http_response = result.response
725
+ status_code = http_response.status
726
+ response_content = http_response.body
727
+ unless status_code == 200
728
+ error_model = JSON.load(response_content)
729
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
730
+ end
731
+
732
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
733
+ # Deserialize Response
734
+ if status_code == 200
735
+ begin
736
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
737
+ result_mapper = Azure::GraphRbac::V1_6::Models::KeyCredentialListResult.mapper()
738
+ result.body = @client.deserialize(result_mapper, parsed_response)
739
+ rescue Exception => e
740
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
741
+ end
742
+ end
743
+
744
+ result
745
+ end
746
+
747
+ promise.execute
748
+ end
749
+
750
+ #
751
+ # Update the keyCredentials associated with an application.
752
+ #
753
+ # @param application_object_id [String] Application object ID.
754
+ # @param parameters [KeyCredentialsUpdateParameters] Parameters to update the
755
+ # keyCredentials of an existing application.
756
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
757
+ # will be added to the HTTP request.
758
+ #
759
+ #
760
+ def update_key_credentials(application_object_id, parameters, custom_headers:nil)
761
+ response = update_key_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value!
762
+ nil
763
+ end
764
+
765
+ #
766
+ # Update the keyCredentials associated with an application.
767
+ #
768
+ # @param application_object_id [String] Application object ID.
769
+ # @param parameters [KeyCredentialsUpdateParameters] Parameters to update the
770
+ # keyCredentials of an existing application.
771
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
772
+ # will be added to the HTTP request.
773
+ #
774
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
775
+ #
776
+ def update_key_credentials_with_http_info(application_object_id, parameters, custom_headers:nil)
777
+ update_key_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value!
778
+ end
779
+
780
+ #
781
+ # Update the keyCredentials associated with an application.
782
+ #
783
+ # @param application_object_id [String] Application object ID.
784
+ # @param parameters [KeyCredentialsUpdateParameters] Parameters to update the
785
+ # keyCredentials of an existing application.
786
+ # @param [Hash{String => String}] A hash of custom headers that will be added
787
+ # to the HTTP request.
788
+ #
789
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
790
+ #
791
+ def update_key_credentials_async(application_object_id, parameters, custom_headers:nil)
792
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
793
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
794
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
795
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
796
+
797
+
798
+ request_headers = {}
799
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
800
+
801
+ # Set Headers
802
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
803
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
804
+
805
+ # Serialize Request
806
+ request_mapper = Azure::GraphRbac::V1_6::Models::KeyCredentialsUpdateParameters.mapper()
807
+ request_content = @client.serialize(request_mapper, parameters)
808
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
809
+
810
+ path_template = '{tenantID}/applications/{applicationObjectId}/keyCredentials'
811
+
812
+ request_url = @base_url || @client.base_url
813
+
814
+ options = {
815
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
816
+ path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_id},
817
+ query_params: {'api-version' => @client.api_version},
818
+ body: request_content,
819
+ headers: request_headers.merge(custom_headers || {}),
820
+ base_url: request_url
821
+ }
822
+ promise = @client.make_request_async(:patch, path_template, options)
823
+
824
+ promise = promise.then do |result|
825
+ http_response = result.response
826
+ status_code = http_response.status
827
+ response_content = http_response.body
828
+ unless status_code == 204
829
+ error_model = JSON.load(response_content)
830
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
831
+ end
832
+
833
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
834
+
835
+ result
836
+ end
837
+
838
+ promise.execute
839
+ end
840
+
841
+ #
842
+ # Get the passwordCredentials associated with an application.
843
+ #
844
+ # @param application_object_id [String] Application object ID.
845
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
846
+ # will be added to the HTTP request.
847
+ #
848
+ # @return [PasswordCredentialListResult] operation results.
849
+ #
850
+ def list_password_credentials(application_object_id, custom_headers:nil)
851
+ response = list_password_credentials_async(application_object_id, custom_headers:custom_headers).value!
852
+ response.body unless response.nil?
853
+ end
854
+
855
+ #
856
+ # Get the passwordCredentials associated with an application.
857
+ #
858
+ # @param application_object_id [String] Application object ID.
859
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
860
+ # will be added to the HTTP request.
861
+ #
862
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
863
+ #
864
+ def list_password_credentials_with_http_info(application_object_id, custom_headers:nil)
865
+ list_password_credentials_async(application_object_id, custom_headers:custom_headers).value!
866
+ end
867
+
868
+ #
869
+ # Get the passwordCredentials associated with an application.
870
+ #
871
+ # @param application_object_id [String] Application object ID.
872
+ # @param [Hash{String => String}] A hash of custom headers that will be added
873
+ # to the HTTP request.
874
+ #
875
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
876
+ #
877
+ def list_password_credentials_async(application_object_id, custom_headers:nil)
878
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
879
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
880
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
881
+
882
+
883
+ request_headers = {}
884
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
885
+
886
+ # Set Headers
887
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
888
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
889
+ path_template = '{tenantID}/applications/{applicationObjectId}/passwordCredentials'
890
+
891
+ request_url = @base_url || @client.base_url
892
+
893
+ options = {
894
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
895
+ path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_id},
896
+ query_params: {'api-version' => @client.api_version},
897
+ headers: request_headers.merge(custom_headers || {}),
898
+ base_url: request_url
899
+ }
900
+ promise = @client.make_request_async(:get, path_template, options)
901
+
902
+ promise = promise.then do |result|
903
+ http_response = result.response
904
+ status_code = http_response.status
905
+ response_content = http_response.body
906
+ unless status_code == 200
907
+ error_model = JSON.load(response_content)
908
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
909
+ end
910
+
911
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
912
+ # Deserialize Response
913
+ if status_code == 200
914
+ begin
915
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
916
+ result_mapper = Azure::GraphRbac::V1_6::Models::PasswordCredentialListResult.mapper()
917
+ result.body = @client.deserialize(result_mapper, parsed_response)
918
+ rescue Exception => e
919
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
920
+ end
921
+ end
922
+
923
+ result
924
+ end
925
+
926
+ promise.execute
927
+ end
928
+
929
+ #
930
+ # Update passwordCredentials associated with an application.
931
+ #
932
+ # @param application_object_id [String] Application object ID.
933
+ # @param parameters [PasswordCredentialsUpdateParameters] Parameters to update
934
+ # passwordCredentials of an existing application.
935
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
936
+ # will be added to the HTTP request.
937
+ #
938
+ #
939
+ def update_password_credentials(application_object_id, parameters, custom_headers:nil)
940
+ response = update_password_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value!
941
+ nil
942
+ end
943
+
944
+ #
945
+ # Update passwordCredentials associated with an application.
946
+ #
947
+ # @param application_object_id [String] Application object ID.
948
+ # @param parameters [PasswordCredentialsUpdateParameters] Parameters to update
949
+ # passwordCredentials of an existing application.
950
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
951
+ # will be added to the HTTP request.
952
+ #
953
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
954
+ #
955
+ def update_password_credentials_with_http_info(application_object_id, parameters, custom_headers:nil)
956
+ update_password_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value!
957
+ end
958
+
959
+ #
960
+ # Update passwordCredentials associated with an application.
961
+ #
962
+ # @param application_object_id [String] Application object ID.
963
+ # @param parameters [PasswordCredentialsUpdateParameters] Parameters to update
964
+ # passwordCredentials of an existing application.
965
+ # @param [Hash{String => String}] A hash of custom headers that will be added
966
+ # to the HTTP request.
967
+ #
968
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
969
+ #
970
+ def update_password_credentials_async(application_object_id, parameters, custom_headers:nil)
971
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
972
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
973
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
974
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
975
+
976
+
977
+ request_headers = {}
978
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
979
+
980
+ # Set Headers
981
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
982
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
983
+
984
+ # Serialize Request
985
+ request_mapper = Azure::GraphRbac::V1_6::Models::PasswordCredentialsUpdateParameters.mapper()
986
+ request_content = @client.serialize(request_mapper, parameters)
987
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
988
+
989
+ path_template = '{tenantID}/applications/{applicationObjectId}/passwordCredentials'
990
+
991
+ request_url = @base_url || @client.base_url
992
+
993
+ options = {
994
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
995
+ path_params: {'applicationObjectId' => application_object_id,'tenantID' => @client.tenant_id},
996
+ query_params: {'api-version' => @client.api_version},
997
+ body: request_content,
998
+ headers: request_headers.merge(custom_headers || {}),
999
+ base_url: request_url
1000
+ }
1001
+ promise = @client.make_request_async(:patch, path_template, options)
1002
+
1003
+ promise = promise.then do |result|
1004
+ http_response = result.response
1005
+ status_code = http_response.status
1006
+ response_content = http_response.body
1007
+ unless status_code == 204
1008
+ error_model = JSON.load(response_content)
1009
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1010
+ end
1011
+
1012
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1013
+
1014
+ result
1015
+ end
1016
+
1017
+ promise.execute
1018
+ end
1019
+
1020
+ #
1021
+ # Gets a list of applications from the current tenant.
1022
+ #
1023
+ # @param next_link [String] Next link for the list operation.
1024
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1025
+ # will be added to the HTTP request.
1026
+ #
1027
+ # @return [Array<Application>] operation results.
1028
+ #
1029
+ def list_next(next_link, custom_headers:nil)
1030
+ response = list_next_async(next_link, custom_headers:custom_headers).value!
1031
+ response.body unless response.nil?
1032
+ end
1033
+
1034
+ #
1035
+ # Gets a list of applications from the current tenant.
1036
+ #
1037
+ # @param next_link [String] Next link for the list operation.
1038
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1039
+ # will be added to the HTTP request.
1040
+ #
1041
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1042
+ #
1043
+ def list_next_with_http_info(next_link, custom_headers:nil)
1044
+ list_next_async(next_link, custom_headers:custom_headers).value!
1045
+ end
1046
+
1047
+ #
1048
+ # Gets a list of applications from the current tenant.
1049
+ #
1050
+ # @param next_link [String] Next link for the list operation.
1051
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1052
+ # to the HTTP request.
1053
+ #
1054
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1055
+ #
1056
+ def list_next_async(next_link, custom_headers:nil)
1057
+ fail ArgumentError, 'next_link is nil' if next_link.nil?
1058
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1059
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
1060
+
1061
+
1062
+ request_headers = {}
1063
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1064
+
1065
+ # Set Headers
1066
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1067
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1068
+ path_template = '{tenantID}/{nextLink}'
1069
+
1070
+ request_url = @base_url || @client.base_url
1071
+
1072
+ options = {
1073
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1074
+ path_params: {'tenantID' => @client.tenant_id},
1075
+ skip_encoding_path_params: {'nextLink' => next_link},
1076
+ query_params: {'api-version' => @client.api_version},
1077
+ headers: request_headers.merge(custom_headers || {}),
1078
+ base_url: request_url
1079
+ }
1080
+ promise = @client.make_request_async(:get, path_template, options)
1081
+
1082
+ promise = promise.then do |result|
1083
+ http_response = result.response
1084
+ status_code = http_response.status
1085
+ response_content = http_response.body
1086
+ unless status_code == 200
1087
+ error_model = JSON.load(response_content)
1088
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1089
+ end
1090
+
1091
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1092
+ # Deserialize Response
1093
+ if status_code == 200
1094
+ begin
1095
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1096
+ result_mapper = Azure::GraphRbac::V1_6::Models::ApplicationListResult.mapper()
1097
+ result.body = @client.deserialize(result_mapper, parsed_response)
1098
+ rescue Exception => e
1099
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1100
+ end
1101
+ end
1102
+
1103
+ result
1104
+ end
1105
+
1106
+ promise.execute
1107
+ end
1108
+
1109
+ #
1110
+ # Lists applications by filter parameters.
1111
+ #
1112
+ # @param filter [String] The filters to apply to the operation.
1113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1114
+ # will be added to the HTTP request.
1115
+ #
1116
+ # @return [ApplicationListResult] which provide lazy access to pages of the
1117
+ # response.
1118
+ #
1119
+ def list_as_lazy(filter:nil, custom_headers:nil)
1120
+ response = list_async(filter:filter, custom_headers:custom_headers).value!
1121
+ unless response.nil?
1122
+ page = response.body
1123
+ page.next_method = Proc.new do |next_link|
1124
+ list_next_async(next_link, custom_headers:custom_headers)
1125
+ end
1126
+ page
1127
+ end
1128
+ end
1129
+
1130
+ end
1131
+ end