azure_mgmt_graph 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +5 -13
  2. data/azure_mgmt_graph.gemspec +4 -5
  3. data/lib/azure_mgmt_graph.rb +3 -54
  4. data/lib/generated/azure_mgmt_graph.rb +58 -0
  5. data/lib/{azure_mgmt_graph/application_operations.rb → generated/azure_mgmt_graph/applications.rb} +37 -33
  6. data/lib/{azure_mgmt_graph → generated/azure_mgmt_graph}/graph_rbac_management_client.rb +18 -18
  7. data/lib/{azure_mgmt_graph/group_operations.rb → generated/azure_mgmt_graph/groups.rb} +214 -62
  8. data/lib/generated/azure_mgmt_graph/models/aadobject.rb +142 -0
  9. data/lib/generated/azure_mgmt_graph/models/adgroup.rb +84 -0
  10. data/lib/generated/azure_mgmt_graph/models/application.rb +146 -0
  11. data/lib/generated/azure_mgmt_graph/models/application_create_parameters.rb +137 -0
  12. data/lib/generated/azure_mgmt_graph/models/application_list_result.rb +52 -0
  13. data/lib/generated/azure_mgmt_graph/models/application_update_parameters.rb +126 -0
  14. data/lib/generated/azure_mgmt_graph/models/check_group_membership_parameters.rb +55 -0
  15. data/lib/generated/azure_mgmt_graph/models/check_group_membership_result.rb +46 -0
  16. data/lib/generated/azure_mgmt_graph/models/get_objects_result.rb +93 -0
  17. data/lib/generated/azure_mgmt_graph/models/group_add_member_parameters.rb +48 -0
  18. data/lib/generated/azure_mgmt_graph/models/group_create_parameters.rb +82 -0
  19. data/lib/generated/azure_mgmt_graph/models/group_get_member_groups_parameters.rb +46 -0
  20. data/lib/generated/azure_mgmt_graph/models/group_get_member_groups_result.rb +51 -0
  21. data/lib/generated/azure_mgmt_graph/models/group_list_result.rb +93 -0
  22. data/lib/generated/azure_mgmt_graph/models/key_credential.rb +94 -0
  23. data/lib/generated/azure_mgmt_graph/models/password_credential.rb +74 -0
  24. data/lib/generated/azure_mgmt_graph/models/password_profile.rb +54 -0
  25. data/lib/generated/azure_mgmt_graph/models/service_principal.rb +91 -0
  26. data/lib/generated/azure_mgmt_graph/models/service_principal_create_parameters.rb +54 -0
  27. data/lib/generated/azure_mgmt_graph/models/service_principal_list_result.rb +94 -0
  28. data/lib/generated/azure_mgmt_graph/models/user.rb +104 -0
  29. data/lib/generated/azure_mgmt_graph/models/user_create_parameters.rb +100 -0
  30. data/lib/generated/azure_mgmt_graph/models/user_get_member_groups_parameters.rb +46 -0
  31. data/lib/generated/azure_mgmt_graph/models/user_get_member_groups_result.rb +51 -0
  32. data/lib/generated/azure_mgmt_graph/models/user_list_result.rb +93 -0
  33. data/lib/generated/azure_mgmt_graph/models/user_update_parameters.rb +76 -0
  34. data/lib/{azure_mgmt_graph → generated/azure_mgmt_graph}/module_definition.rb +0 -0
  35. data/lib/generated/azure_mgmt_graph/objects.rb +112 -0
  36. data/lib/{azure_mgmt_graph/service_principal_operations.rb → generated/azure_mgmt_graph/service_principals.rb} +50 -27
  37. data/lib/{azure_mgmt_graph/user_operations.rb → generated/azure_mgmt_graph/users.rb} +243 -115
  38. data/lib/{azure_mgmt_graph → generated/azure_mgmt_graph}/version.rb +1 -1
  39. metadata +56 -74
  40. data/lib/azure_mgmt_graph/models/aadobject.rb +0 -138
  41. data/lib/azure_mgmt_graph/models/adgroup.rb +0 -92
  42. data/lib/azure_mgmt_graph/models/application.rb +0 -122
  43. data/lib/azure_mgmt_graph/models/application_create_parameters.rb +0 -160
  44. data/lib/azure_mgmt_graph/models/application_filter.rb +0 -74
  45. data/lib/azure_mgmt_graph/models/application_list_result.rb +0 -76
  46. data/lib/azure_mgmt_graph/models/get_objects_parameters.rb +0 -77
  47. data/lib/azure_mgmt_graph/models/get_objects_result.rb +0 -85
  48. data/lib/azure_mgmt_graph/models/group_add_member_parameters.rb +0 -56
  49. data/lib/azure_mgmt_graph/models/group_create_parameters.rb +0 -86
  50. data/lib/azure_mgmt_graph/models/group_get_member_groups_parameters.rb +0 -58
  51. data/lib/azure_mgmt_graph/models/group_get_member_groups_result.rb +0 -56
  52. data/lib/azure_mgmt_graph/models/group_list_result.rb +0 -85
  53. data/lib/azure_mgmt_graph/models/key_credential.rb +0 -105
  54. data/lib/azure_mgmt_graph/models/password_credential.rb +0 -87
  55. data/lib/azure_mgmt_graph/models/service_principal.rb +0 -92
  56. data/lib/azure_mgmt_graph/models/service_principal_create_parameters.rb +0 -66
  57. data/lib/azure_mgmt_graph/models/service_principal_list_result.rb +0 -86
  58. data/lib/azure_mgmt_graph/models/user.rb +0 -101
  59. data/lib/azure_mgmt_graph/models/user_create_parameters.rb +0 -103
  60. data/lib/azure_mgmt_graph/models/user_create_parameters_password_profile.rb +0 -65
  61. data/lib/azure_mgmt_graph/models/user_get_member_groups_parameters.rb +0 -58
  62. data/lib/azure_mgmt_graph/models/user_get_member_groups_result.rb +0 -56
  63. data/lib/azure_mgmt_graph/models/user_list_result.rb +0 -85
  64. data/lib/azure_mgmt_graph/object_operations.rb +0 -302
@@ -0,0 +1,93 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.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
+ module Models
8
+ #
9
+ # Server response for Get tenant users API call
10
+ #
11
+ class UserListResult
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<User>] Gets or sets the list of users.
16
+ attr_accessor :value
17
+
18
+ # @return [String] Gets or sets the URL to get the next set of results.
19
+ attr_accessor :odatanext_link
20
+
21
+ # return [Proc] with next page method call.
22
+ attr_accessor :next_method
23
+
24
+ #
25
+ # Gets the rest of the items for the request, enabling auto-pagination.
26
+ #
27
+ # @return [Array<User>] operation results.
28
+ #
29
+ def get_all_items
30
+ items = @value
31
+ page = self
32
+ while page.odatanext_link != nil do
33
+ page = page.get_next_page
34
+ items.concat(page.value)
35
+ end
36
+ items
37
+ end
38
+
39
+ #
40
+ # Gets the next page of results.
41
+ #
42
+ # @return [UserListResult] with next page content.
43
+ #
44
+ def get_next_page
45
+ response = @next_method.call(@odatanext_link).value! unless @next_method.nil?
46
+ unless response.nil?
47
+ @odatanext_link = response.body.odatanext_link
48
+ @value = response.body.value
49
+ self
50
+ end
51
+ end
52
+
53
+ #
54
+ # Mapper for UserListResult class as Ruby Hash.
55
+ # This will be used for serialization/deserialization.
56
+ #
57
+ def self.mapper()
58
+ {
59
+ required: false,
60
+ serialized_name: 'UserListResult',
61
+ type: {
62
+ name: 'Composite',
63
+ class_name: 'UserListResult',
64
+ model_properties: {
65
+ value: {
66
+ required: false,
67
+ serialized_name: 'value',
68
+ type: {
69
+ name: 'Sequence',
70
+ element: {
71
+ required: false,
72
+ serialized_name: 'UserElementType',
73
+ type: {
74
+ name: 'Composite',
75
+ class_name: 'User'
76
+ }
77
+ }
78
+ }
79
+ },
80
+ odatanext_link: {
81
+ required: false,
82
+ serialized_name: 'odata\\.nextLink',
83
+ type: {
84
+ name: 'String'
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,76 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.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
+ module Models
8
+ #
9
+ # Request parameters for updating an existing work or school account user
10
+ #
11
+ class UserUpdateParameters
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Boolean] Enable the account. If it is enabled then true else
16
+ # false.
17
+ attr_accessor :account_enabled
18
+
19
+ # @return [String] User display name
20
+ attr_accessor :display_name
21
+
22
+ # @return [PasswordProfile] Password Profile
23
+ attr_accessor :password_profile
24
+
25
+ # @return [String] The mail alias for the user
26
+ attr_accessor :mail_nickname
27
+
28
+
29
+ #
30
+ # Mapper for UserUpdateParameters class as Ruby Hash.
31
+ # This will be used for serialization/deserialization.
32
+ #
33
+ def self.mapper()
34
+ {
35
+ required: false,
36
+ serialized_name: 'UserUpdateParameters',
37
+ type: {
38
+ name: 'Composite',
39
+ class_name: 'UserUpdateParameters',
40
+ model_properties: {
41
+ account_enabled: {
42
+ required: false,
43
+ serialized_name: 'accountEnabled',
44
+ type: {
45
+ name: 'Boolean'
46
+ }
47
+ },
48
+ display_name: {
49
+ required: false,
50
+ serialized_name: 'displayName',
51
+ type: {
52
+ name: 'String'
53
+ }
54
+ },
55
+ password_profile: {
56
+ required: false,
57
+ serialized_name: 'passwordProfile',
58
+ type: {
59
+ name: 'Composite',
60
+ class_name: 'PasswordProfile'
61
+ }
62
+ },
63
+ mail_nickname: {
64
+ required: false,
65
+ serialized_name: 'mailNickname',
66
+ type: {
67
+ name: 'String'
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,112 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.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
+ # The Graph RBAC Management Client
9
+ #
10
+ class Objects
11
+ include Azure::ARM::Graph::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Objects 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
+ # Gets the details for current logged in user
27
+ #
28
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
29
+ # will be added to the HTTP request.
30
+ #
31
+ # @return [AADObject] operation results.
32
+ #
33
+ def get_current_user(custom_headers = nil)
34
+ response = get_current_user_async(custom_headers).value!
35
+ response.body unless response.nil?
36
+ end
37
+
38
+ #
39
+ # Gets the details for current logged in user
40
+ #
41
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
42
+ # will be added to the HTTP request.
43
+ #
44
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
45
+ #
46
+ def get_current_user_with_http_info(custom_headers = nil)
47
+ get_current_user_async(custom_headers).value!
48
+ end
49
+
50
+ #
51
+ # Gets the details for current logged in user
52
+ #
53
+ # @param [Hash{String => String}] A hash of custom headers that will be added
54
+ # to the HTTP request.
55
+ #
56
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
57
+ #
58
+ def get_current_user_async(custom_headers = nil)
59
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
60
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
61
+
62
+
63
+ request_headers = {}
64
+
65
+ # Set Headers
66
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
67
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
68
+ path_template = '/{tenantID}/me'
69
+ options = {
70
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
71
+ path_params: {'tenantID' => @client.tenant_id},
72
+ query_params: {'api-version' => @client.api_version},
73
+ headers: request_headers.merge(custom_headers || {})
74
+ }
75
+
76
+ request_url = @base_url || @client.base_url
77
+
78
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
79
+ promise = request.run_promise do |req|
80
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
81
+ end
82
+
83
+ promise = promise.then do |http_response|
84
+ status_code = http_response.status
85
+ response_content = http_response.body
86
+ unless status_code == 200
87
+ error_model = JSON.load(response_content)
88
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
89
+ end
90
+
91
+ # Create Result
92
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
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 = AADObject.mapper()
99
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
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
+ end
112
+ end
@@ -5,14 +5,14 @@
5
5
 
6
6
  module Azure::ARM::Graph
7
7
  #
8
- # ServicePrincipalOperations
8
+ # The Graph RBAC Management Client
9
9
  #
10
- class ServicePrincipalOperations
10
+ class ServicePrincipals
11
11
  include Azure::ARM::Graph::Models
12
12
  include MsRestAzure
13
13
 
14
14
  #
15
- # Creates and initializes a new instance of the ServicePrincipalOperations class.
15
+ # Creates and initializes a new instance of the ServicePrincipals class.
16
16
  # @param client service class for accessing basic functionality.
17
17
  #
18
18
  def initialize(client)
@@ -63,21 +63,23 @@ module Azure::ARM::Graph
63
63
  #
64
64
  def create_async(parameters, custom_headers = nil)
65
65
  fail ArgumentError, 'parameters is nil' if parameters.nil?
66
- parameters.validate unless parameters.nil?
67
66
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
67
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
68
+
69
+
69
70
  request_headers = {}
70
71
 
71
72
  # Set Headers
72
73
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
73
74
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
74
75
 
75
- # Serialize Request
76
76
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
77
- unless parameters.nil?
78
- parameters = ServicePrincipalCreateParameters.serialize_object(parameters)
79
- end
80
- request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
77
+
78
+ # Serialize Request
79
+ request_mapper = ServicePrincipalCreateParameters.mapper()
80
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
81
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
82
+
81
83
  path_template = '/{tenantID}/servicePrincipals'
82
84
  options = {
83
85
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -109,10 +111,8 @@ module Azure::ARM::Graph
109
111
  if status_code == 201
110
112
  begin
111
113
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
- unless parsed_response.nil?
113
- parsed_response = ServicePrincipal.deserialize_object(parsed_response)
114
- end
115
- result.body = parsed_response
114
+ result_mapper = ServicePrincipal.mapper()
115
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
116
116
  rescue Exception => e
117
117
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
118
118
  end
@@ -124,6 +124,27 @@ module Azure::ARM::Graph
124
124
  promise.execute
125
125
  end
126
126
 
127
+ #
128
+ # Gets list of service principals from the current tenant.
129
+ #
130
+ # @param filter [String] The filter to apply on the operation.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [ServicePrincipalListResult] which provide lazy access to pages of
135
+ # the response.
136
+ #
137
+ def list_as_lazy(filter = nil, custom_headers = nil)
138
+ response = list_async(filter, custom_headers).value!
139
+ unless response.nil?
140
+ page = response.body
141
+ page.next_method = Proc.new do |next_link|
142
+ list_next_async(next_link, custom_headers)
143
+ end
144
+ page
145
+ end
146
+ end
147
+
127
148
  #
128
149
  # Gets list of service principals from the current tenant.
129
150
  #
@@ -134,8 +155,8 @@ module Azure::ARM::Graph
134
155
  # @return [ServicePrincipalListResult] operation results.
135
156
  #
136
157
  def list(filter = nil, custom_headers = nil)
137
- response = list_async(filter, custom_headers).value!
138
- response.body unless response.nil?
158
+ first_page = list_as_lazy(filter, custom_headers)
159
+ first_page.get_all_items
139
160
  end
140
161
 
141
162
  #
@@ -163,6 +184,8 @@ module Azure::ARM::Graph
163
184
  def list_async(filter = nil, custom_headers = nil)
164
185
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
165
186
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
187
+
188
+
166
189
  request_headers = {}
167
190
 
168
191
  # Set Headers
@@ -198,10 +221,8 @@ module Azure::ARM::Graph
198
221
  if status_code == 200
199
222
  begin
200
223
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
201
- unless parsed_response.nil?
202
- parsed_response = ServicePrincipalListResult.deserialize_object(parsed_response)
203
- end
204
- result.body = parsed_response
224
+ result_mapper = ServicePrincipalListResult.mapper()
225
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
205
226
  rescue Exception => e
206
227
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
207
228
  end
@@ -252,6 +273,8 @@ module Azure::ARM::Graph
252
273
  fail ArgumentError, 'object_id is nil' if object_id.nil?
253
274
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
254
275
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
276
+
277
+
255
278
  request_headers = {}
256
279
 
257
280
  # Set Headers
@@ -331,6 +354,8 @@ module Azure::ARM::Graph
331
354
  fail ArgumentError, 'object_id is nil' if object_id.nil?
332
355
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
333
356
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
357
+
358
+
334
359
  request_headers = {}
335
360
 
336
361
  # Set Headers
@@ -367,10 +392,8 @@ module Azure::ARM::Graph
367
392
  if status_code == 200
368
393
  begin
369
394
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
370
- unless parsed_response.nil?
371
- parsed_response = ServicePrincipal.deserialize_object(parsed_response)
372
- end
373
- result.body = parsed_response
395
+ result_mapper = ServicePrincipal.mapper()
396
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
374
397
  rescue Exception => e
375
398
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
376
399
  end
@@ -422,6 +445,8 @@ module Azure::ARM::Graph
422
445
  fail ArgumentError, 'next_link is nil' if next_link.nil?
423
446
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
424
447
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
448
+
449
+
425
450
  request_headers = {}
426
451
 
427
452
  # Set Headers
@@ -458,10 +483,8 @@ module Azure::ARM::Graph
458
483
  if status_code == 200
459
484
  begin
460
485
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
461
- unless parsed_response.nil?
462
- parsed_response = ServicePrincipalListResult.deserialize_object(parsed_response)
463
- end
464
- result.body = parsed_response
486
+ result_mapper = ServicePrincipalListResult.mapper()
487
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
465
488
  rescue Exception => e
466
489
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
467
490
  end