azure_mgmt_graph 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_graph.gemspec +35 -0
  6. data/lib/azure_mgmt_graph.rb +55 -0
  7. data/lib/azure_mgmt_graph/application_operations.rb +336 -0
  8. data/lib/azure_mgmt_graph/graph_rbac_management_client.rb +82 -0
  9. data/lib/azure_mgmt_graph/group_operations.rb +647 -0
  10. data/lib/azure_mgmt_graph/models/aadobject.rb +138 -0
  11. data/lib/azure_mgmt_graph/models/adgroup.rb +92 -0
  12. data/lib/azure_mgmt_graph/models/application.rb +122 -0
  13. data/lib/azure_mgmt_graph/models/application_create_parameters.rb +160 -0
  14. data/lib/azure_mgmt_graph/models/application_filter.rb +74 -0
  15. data/lib/azure_mgmt_graph/models/application_list_result.rb +76 -0
  16. data/lib/azure_mgmt_graph/models/get_objects_parameters.rb +77 -0
  17. data/lib/azure_mgmt_graph/models/get_objects_result.rb +85 -0
  18. data/lib/azure_mgmt_graph/models/group_add_member_parameters.rb +56 -0
  19. data/lib/azure_mgmt_graph/models/group_create_parameters.rb +86 -0
  20. data/lib/azure_mgmt_graph/models/group_get_member_groups_parameters.rb +58 -0
  21. data/lib/azure_mgmt_graph/models/group_get_member_groups_result.rb +56 -0
  22. data/lib/azure_mgmt_graph/models/group_list_result.rb +85 -0
  23. data/lib/azure_mgmt_graph/models/key_credential.rb +105 -0
  24. data/lib/azure_mgmt_graph/models/password_credential.rb +87 -0
  25. data/lib/azure_mgmt_graph/models/service_principal.rb +92 -0
  26. data/lib/azure_mgmt_graph/models/service_principal_create_parameters.rb +66 -0
  27. data/lib/azure_mgmt_graph/models/service_principal_list_result.rb +86 -0
  28. data/lib/azure_mgmt_graph/models/user.rb +101 -0
  29. data/lib/azure_mgmt_graph/models/user_create_parameters.rb +103 -0
  30. data/lib/azure_mgmt_graph/models/user_create_parameters_password_profile.rb +65 -0
  31. data/lib/azure_mgmt_graph/models/user_get_member_groups_parameters.rb +58 -0
  32. data/lib/azure_mgmt_graph/models/user_get_member_groups_result.rb +56 -0
  33. data/lib/azure_mgmt_graph/models/user_list_result.rb +85 -0
  34. data/lib/azure_mgmt_graph/module_definition.rb +8 -0
  35. data/lib/azure_mgmt_graph/object_operations.rb +217 -0
  36. data/lib/azure_mgmt_graph/service_principal_operations.rb +331 -0
  37. data/lib/azure_mgmt_graph/user_operations.rb +408 -0
  38. data/lib/azure_mgmt_graph/version.rb +8 -0
  39. metadata +166 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d9f30896e5fda1b89106bca8cef644355dd36c64
4
+ data.tar.gz: a1fbfc76aa519903b41552a1b7ff4b6d794dc09b
5
+ SHA512:
6
+ metadata.gz: e7f3da34e9694252d9b79e332f839e5317906eadf4dd26e8262f15ba0f1c4d9cb46b425678d1da3317135dff33084a61d5052a5624507dafe2dfa5ae84971353
7
+ data.tar.gz: 5a71b8684ce6733fb0b2eedcc7acc864f68223bcffbf70a80b3cc9b9df5fff3ce93b48447b2977c893971f466c90e909643f0f632f0dc0c7414e972d2ecfefa9
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require "bundler/gem_tasks"
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ lib = File.expand_path('../lib', __FILE__)
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+
8
+ require 'azure_mgmt_graph/module_definition'
9
+ require 'azure_mgmt_graph/version'
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = 'azure_mgmt_graph'
13
+ spec.version = Azure::ARM::Graph::VERSION
14
+ spec.authors = 'Microsoft Corporation'
15
+ spec.email = 'azrubyteam@microsoft.com'
16
+ spec.description = 'Microsoft Azure Active Directory Graph Management Client Library for Ruby'
17
+ spec.summary = 'Official Ruby client library to consume Microsoft Azure Active Directory Graph Management services.'
18
+ spec.homepage = 'http://github.com/azure/azure-sdk-for-ruby'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = 'bin'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.required_ruby_version = '>= 1.9.3'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.9'
29
+ spec.add_development_dependency 'rake', '~> 10'
30
+ spec.add_development_dependency 'rspec', '~> 3'
31
+ spec.add_development_dependency 'dotenv', '~> 2'
32
+ spec.add_development_dependency 'azure_mgmt_resources', '~> 0.2'
33
+
34
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.2.0'
35
+ end
@@ -0,0 +1,55 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ 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 'ms_rest_azure'
20
+
21
+ module Azure::ARM::Graph
22
+ autoload :ApplicationOperations, 'azure_mgmt_graph/application_operations.rb'
23
+ autoload :ObjectOperations, 'azure_mgmt_graph/object_operations.rb'
24
+ autoload :GroupOperations, 'azure_mgmt_graph/group_operations.rb'
25
+ autoload :ServicePrincipalOperations, 'azure_mgmt_graph/service_principal_operations.rb'
26
+ autoload :UserOperations, 'azure_mgmt_graph/user_operations.rb'
27
+ autoload :GraphRbacManagementClient, 'azure_mgmt_graph/graph_rbac_management_client.rb'
28
+
29
+ module Models
30
+ autoload :KeyCredential, 'azure_mgmt_graph/models/key_credential.rb'
31
+ autoload :PasswordCredential, 'azure_mgmt_graph/models/password_credential.rb'
32
+ autoload :ApplicationCreateParameters, 'azure_mgmt_graph/models/application_create_parameters.rb'
33
+ autoload :ApplicationFilter, 'azure_mgmt_graph/models/application_filter.rb'
34
+ autoload :Application, 'azure_mgmt_graph/models/application.rb'
35
+ autoload :ApplicationListResult, 'azure_mgmt_graph/models/application_list_result.rb'
36
+ autoload :GetObjectsParameters, 'azure_mgmt_graph/models/get_objects_parameters.rb'
37
+ autoload :AADObject, 'azure_mgmt_graph/models/aadobject.rb'
38
+ autoload :GetObjectsResult, 'azure_mgmt_graph/models/get_objects_result.rb'
39
+ autoload :GroupAddMemberParameters, 'azure_mgmt_graph/models/group_add_member_parameters.rb'
40
+ autoload :GroupCreateParameters, 'azure_mgmt_graph/models/group_create_parameters.rb'
41
+ autoload :ADGroup, 'azure_mgmt_graph/models/adgroup.rb'
42
+ autoload :GroupListResult, 'azure_mgmt_graph/models/group_list_result.rb'
43
+ autoload :GroupGetMemberGroupsParameters, 'azure_mgmt_graph/models/group_get_member_groups_parameters.rb'
44
+ autoload :GroupGetMemberGroupsResult, 'azure_mgmt_graph/models/group_get_member_groups_result.rb'
45
+ autoload :ServicePrincipalCreateParameters, 'azure_mgmt_graph/models/service_principal_create_parameters.rb'
46
+ autoload :ServicePrincipal, 'azure_mgmt_graph/models/service_principal.rb'
47
+ autoload :ServicePrincipalListResult, 'azure_mgmt_graph/models/service_principal_list_result.rb'
48
+ autoload :UserCreateParametersPasswordProfile, 'azure_mgmt_graph/models/user_create_parameters_password_profile.rb'
49
+ autoload :UserCreateParameters, 'azure_mgmt_graph/models/user_create_parameters.rb'
50
+ autoload :User, 'azure_mgmt_graph/models/user.rb'
51
+ autoload :UserGetMemberGroupsParameters, 'azure_mgmt_graph/models/user_get_member_groups_parameters.rb'
52
+ autoload :UserGetMemberGroupsResult, 'azure_mgmt_graph/models/user_get_member_groups_result.rb'
53
+ autoload :UserListResult, 'azure_mgmt_graph/models/user_list_result.rb'
54
+ end
55
+ end
@@ -0,0 +1,336 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Graph
7
+ #
8
+ # ApplicationOperations
9
+ #
10
+ class ApplicationOperations
11
+ include Azure::ARM::Graph::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ApplicationOperations class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the GraphRbacManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Create a new application. Reference:
27
+ # http://msdn.microsoft.com/en-us/library/azure/hh974476.aspx
28
+ #
29
+ # @param parameters [ApplicationCreateParameters] Parameters to create an
30
+ # application.
31
+ # @param [Hash{String => String}] The hash of custom headers need to be
32
+ # applied to HTTP request.
33
+ #
34
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
35
+ # response.
36
+ #
37
+ def create(parameters, custom_headers = nil)
38
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
39
+ parameters.validate unless parameters.nil?
40
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
41
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
42
+ request_headers = {}
43
+
44
+ # Set Headers
45
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
46
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
47
+
48
+ # Serialize Request
49
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
50
+ unless parameters.nil?
51
+ parameters = ApplicationCreateParameters.serialize_object(parameters)
52
+ end
53
+ request_content = JSON.generate(parameters, quirks_mode: true)
54
+ path_template = '/{tenantID}/applications'
55
+ options = {
56
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
57
+ path_params: {'tenantID' => @client.tenant_id},
58
+ query_params: {'api-version' => @client.api_version},
59
+ body: request_content,
60
+ headers: request_headers.merge(custom_headers || {})
61
+ }
62
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
63
+ promise = request.run_promise do |req|
64
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
65
+ end
66
+
67
+ promise = promise.then do |http_response|
68
+ status_code = http_response.status
69
+ response_content = http_response.body
70
+ unless status_code == 201
71
+ error_model = JSON.load(response_content)
72
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
73
+ end
74
+
75
+ # Create Result
76
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
77
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
78
+ # Deserialize Response
79
+ if status_code == 201
80
+ begin
81
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
82
+ unless parsed_response.nil?
83
+ parsed_response = Application.deserialize_object(parsed_response)
84
+ end
85
+ result.body = parsed_response
86
+ rescue Exception => e
87
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
88
+ end
89
+ end
90
+
91
+ result
92
+ end
93
+
94
+ promise.execute
95
+ end
96
+
97
+ #
98
+ # Lists applications by filter parameters. Reference:
99
+ # http://msdn.microsoft.com/en-us/library/azure/hh974476.aspx
100
+ #
101
+ # @param filter [String] The filters to apply on the operation
102
+ # @param [Hash{String => String}] The hash of custom headers need to be
103
+ # applied to HTTP request.
104
+ #
105
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
106
+ # response.
107
+ #
108
+ def list(filter = nil, custom_headers = nil)
109
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
110
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
111
+ request_headers = {}
112
+
113
+ # Set Headers
114
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
115
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
116
+ path_template = '/{tenantID}/applications'
117
+ options = {
118
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
119
+ path_params: {'tenantID' => @client.tenant_id},
120
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
121
+ headers: request_headers.merge(custom_headers || {})
122
+ }
123
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
124
+ promise = request.run_promise do |req|
125
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
126
+ end
127
+
128
+ promise = promise.then do |http_response|
129
+ status_code = http_response.status
130
+ response_content = http_response.body
131
+ unless status_code == 200
132
+ error_model = JSON.load(response_content)
133
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
134
+ end
135
+
136
+ # Create Result
137
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
138
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
139
+ # Deserialize Response
140
+ if status_code == 200
141
+ begin
142
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
143
+ unless parsed_response.nil?
144
+ parsed_response = ApplicationListResult.deserialize_object(parsed_response)
145
+ end
146
+ result.body = parsed_response
147
+ rescue Exception => e
148
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
149
+ end
150
+ end
151
+
152
+ result
153
+ end
154
+
155
+ promise.execute
156
+ end
157
+
158
+ #
159
+ # Delete an application. Reference:
160
+ # http://msdn.microsoft.com/en-us/library/azure/hh974476.aspx
161
+ #
162
+ # @param application_object_id [String] Application object id
163
+ # @param [Hash{String => String}] The hash of custom headers need to be
164
+ # applied to HTTP request.
165
+ #
166
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
167
+ # response.
168
+ #
169
+ def delete(application_object_id, custom_headers = nil)
170
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
171
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
172
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
173
+ request_headers = {}
174
+
175
+ # Set Headers
176
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
177
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
178
+ path_template = '/{tenantID}/applications/{applicationObjectId}'
179
+ options = {
180
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
181
+ path_params: {'tenantID' => @client.tenant_id},
182
+ skip_encoding_path_params: {'applicationObjectId' => application_object_id},
183
+ query_params: {'api-version' => @client.api_version},
184
+ headers: request_headers.merge(custom_headers || {})
185
+ }
186
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
187
+ promise = request.run_promise do |req|
188
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
189
+ end
190
+
191
+ promise = promise.then do |http_response|
192
+ status_code = http_response.status
193
+ response_content = http_response.body
194
+ unless status_code == 204
195
+ error_model = JSON.load(response_content)
196
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
197
+ end
198
+
199
+ # Create Result
200
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
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
+ # Get an application by object Id. Reference:
211
+ # http://msdn.microsoft.com/en-us/library/azure/hh974476.aspx
212
+ #
213
+ # @param application_object_id [String] Application object id
214
+ # @param [Hash{String => String}] The hash of custom headers need to be
215
+ # applied to HTTP request.
216
+ #
217
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
218
+ # response.
219
+ #
220
+ def get(application_object_id, custom_headers = nil)
221
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
222
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
223
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
224
+ request_headers = {}
225
+
226
+ # Set Headers
227
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
228
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
229
+ path_template = '/{tenantID}/applications/{applicationObjectId}'
230
+ options = {
231
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
232
+ path_params: {'tenantID' => @client.tenant_id},
233
+ skip_encoding_path_params: {'applicationObjectId' => application_object_id},
234
+ query_params: {'api-version' => @client.api_version},
235
+ headers: request_headers.merge(custom_headers || {})
236
+ }
237
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
238
+ promise = request.run_promise do |req|
239
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
240
+ end
241
+
242
+ promise = promise.then do |http_response|
243
+ status_code = http_response.status
244
+ response_content = http_response.body
245
+ unless status_code == 200
246
+ error_model = JSON.load(response_content)
247
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
248
+ end
249
+
250
+ # Create Result
251
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
252
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
253
+ # Deserialize Response
254
+ if status_code == 200
255
+ begin
256
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
257
+ unless parsed_response.nil?
258
+ parsed_response = Application.deserialize_object(parsed_response)
259
+ end
260
+ result.body = parsed_response
261
+ rescue Exception => e
262
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
263
+ end
264
+ end
265
+
266
+ result
267
+ end
268
+
269
+ promise.execute
270
+ end
271
+
272
+ #
273
+ # Update existing application. Reference:
274
+ # http://msdn.microsoft.com/en-us/library/azure/hh974476.aspx
275
+ #
276
+ # @param application_object_id [String] Application object id
277
+ # @param parameters [ApplicationCreateParameters] Parameters to create an
278
+ # application.
279
+ # @param [Hash{String => String}] The hash of custom headers need to be
280
+ # applied to HTTP request.
281
+ #
282
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
283
+ # response.
284
+ #
285
+ def patch(application_object_id, parameters, custom_headers = nil)
286
+ fail ArgumentError, 'application_object_id is nil' if application_object_id.nil?
287
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
288
+ parameters.validate unless parameters.nil?
289
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
290
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
291
+ request_headers = {}
292
+
293
+ # Set Headers
294
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
295
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
296
+
297
+ # Serialize Request
298
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
299
+ unless parameters.nil?
300
+ parameters = ApplicationCreateParameters.serialize_object(parameters)
301
+ end
302
+ request_content = JSON.generate(parameters, quirks_mode: true)
303
+ path_template = '/{tenantID}/applications/{applicationObjectId}'
304
+ options = {
305
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
306
+ path_params: {'tenantID' => @client.tenant_id},
307
+ skip_encoding_path_params: {'applicationObjectId' => application_object_id},
308
+ query_params: {'api-version' => @client.api_version},
309
+ body: request_content,
310
+ headers: request_headers.merge(custom_headers || {})
311
+ }
312
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
313
+ promise = request.run_promise do |req|
314
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
315
+ end
316
+
317
+ promise = promise.then do |http_response|
318
+ status_code = http_response.status
319
+ response_content = http_response.body
320
+ unless status_code == 204
321
+ error_model = JSON.load(response_content)
322
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
323
+ end
324
+
325
+ # Create Result
326
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
327
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
328
+
329
+ result
330
+ end
331
+
332
+ promise.execute
333
+ end
334
+
335
+ end
336
+ end