azure_mgmt_authorization 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 (51) hide show
  1. checksums.yaml +5 -13
  2. data/azure_mgmt_authorization.gemspec +4 -4
  3. data/lib/azure_mgmt_authorization.rb +3 -49
  4. data/lib/{azure_mgmt_authorization → generated/azure_mgmt_authorization}/authorization_management_client.rb +8 -7
  5. data/lib/{azure_mgmt_authorization → generated/azure_mgmt_authorization}/classic_administrators.rb +32 -11
  6. data/lib/generated/azure_mgmt_authorization/models/classic_administrator.rb +76 -0
  7. data/lib/generated/azure_mgmt_authorization/models/classic_administrator_list_result.rb +84 -0
  8. data/lib/generated/azure_mgmt_authorization/models/classic_administrator_properties.rb +54 -0
  9. data/lib/generated/azure_mgmt_authorization/models/permission.rb +68 -0
  10. data/lib/generated/azure_mgmt_authorization/models/permission_get_result.rb +83 -0
  11. data/lib/generated/azure_mgmt_authorization/models/provider_operation.rb +84 -0
  12. data/lib/generated/azure_mgmt_authorization/models/provider_operations_metadata.rb +110 -0
  13. data/lib/generated/azure_mgmt_authorization/models/provider_operations_metadata_list_result.rb +84 -0
  14. data/lib/generated/azure_mgmt_authorization/models/resource_type.rb +73 -0
  15. data/lib/generated/azure_mgmt_authorization/models/role_assignment.rb +76 -0
  16. data/lib/generated/azure_mgmt_authorization/models/role_assignment_create_parameters.rb +46 -0
  17. data/lib/generated/azure_mgmt_authorization/models/role_assignment_filter.rb +44 -0
  18. data/lib/generated/azure_mgmt_authorization/models/role_assignment_list_result.rb +94 -0
  19. data/lib/generated/azure_mgmt_authorization/models/role_assignment_properties.rb +54 -0
  20. data/lib/generated/azure_mgmt_authorization/models/role_assignment_properties_with_scope.rb +64 -0
  21. data/lib/generated/azure_mgmt_authorization/models/role_definition.rb +76 -0
  22. data/lib/generated/azure_mgmt_authorization/models/role_definition_filter.rb +44 -0
  23. data/lib/generated/azure_mgmt_authorization/models/role_definition_list_result.rb +83 -0
  24. data/lib/generated/azure_mgmt_authorization/models/role_definition_properties.rb +99 -0
  25. data/lib/{azure_mgmt_authorization → generated/azure_mgmt_authorization}/module_definition.rb +0 -0
  26. data/lib/{azure_mgmt_authorization → generated/azure_mgmt_authorization}/permissions.rb +70 -22
  27. data/lib/{azure_mgmt_authorization → generated/azure_mgmt_authorization}/provider_operations_metadata_operations.rb +37 -15
  28. data/lib/{azure_mgmt_authorization → generated/azure_mgmt_authorization}/role_assignments.rb +171 -80
  29. data/lib/{azure_mgmt_authorization → generated/azure_mgmt_authorization}/role_definitions.rb +56 -33
  30. data/lib/{azure_mgmt_authorization → generated/azure_mgmt_authorization}/version.rb +1 -1
  31. data/lib/generated/azure_mgmt_authorization.rb +51 -0
  32. metadata +49 -53
  33. data/lib/azure_mgmt_authorization/models/classic_administrator.rb +0 -90
  34. data/lib/azure_mgmt_authorization/models/classic_administrator_list_result.rb +0 -77
  35. data/lib/azure_mgmt_authorization/models/classic_administrator_properties.rb +0 -65
  36. data/lib/azure_mgmt_authorization/models/permission.rb +0 -66
  37. data/lib/azure_mgmt_authorization/models/permission_get_result.rb +0 -76
  38. data/lib/azure_mgmt_authorization/models/provider_operation.rb +0 -92
  39. data/lib/azure_mgmt_authorization/models/provider_operations_metadata.rb +0 -142
  40. data/lib/azure_mgmt_authorization/models/provider_operations_metadata_list_result.rb +0 -77
  41. data/lib/azure_mgmt_authorization/models/resource_type.rb +0 -95
  42. data/lib/azure_mgmt_authorization/models/role_assignment.rb +0 -90
  43. data/lib/azure_mgmt_authorization/models/role_assignment_create_parameters.rb +0 -63
  44. data/lib/azure_mgmt_authorization/models/role_assignment_filter.rb +0 -56
  45. data/lib/azure_mgmt_authorization/models/role_assignment_list_result.rb +0 -86
  46. data/lib/azure_mgmt_authorization/models/role_assignment_properties.rb +0 -65
  47. data/lib/azure_mgmt_authorization/models/role_assignment_properties_with_scope.rb +0 -74
  48. data/lib/azure_mgmt_authorization/models/role_definition.rb +0 -90
  49. data/lib/azure_mgmt_authorization/models/role_definition_filter.rb +0 -56
  50. data/lib/azure_mgmt_authorization/models/role_definition_list_result.rb +0 -76
  51. data/lib/azure_mgmt_authorization/models/role_definition_properties.rb +0 -113
@@ -34,11 +34,37 @@ module Azure::ARM::Authorization
34
34
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
35
  # will be added to the HTTP request.
36
36
  #
37
- # @return [RoleAssignmentListResult] operation results.
37
+ # @return [RoleAssignmentListResult] which provide lazy access to pages of the
38
+ # response.
38
39
  #
39
- def list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
40
+ def list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
40
41
  response = list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers).value!
41
- response.body unless response.nil?
42
+ unless response.nil?
43
+ page = response.body
44
+ page.next_method = Proc.new do |next_link|
45
+ list_for_resource_next_async(next_link, custom_headers)
46
+ end
47
+ page
48
+ end
49
+ end
50
+
51
+ #
52
+ # Gets role assignments of the resource.
53
+ #
54
+ # @param resource_group_name [String] The name of the resource group.
55
+ # @param resource_provider_namespace [String] Resource identity.
56
+ # @param parent_resource_path [String] Resource identity.
57
+ # @param resource_type [String] Resource identity.
58
+ # @param resource_name [String] Resource identity.
59
+ # @param filter [String] The filter to apply on the operation.
60
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
61
+ # will be added to the HTTP request.
62
+ #
63
+ # @return [Array<RoleAssignment>] operation results.
64
+ #
65
+ def list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
66
+ first_page = list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers)
67
+ first_page.get_all_items
42
68
  end
43
69
 
44
70
  #
@@ -81,6 +107,8 @@ module Azure::ARM::Authorization
81
107
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
82
108
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
83
109
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
110
+
111
+
84
112
  request_headers = {}
85
113
 
86
114
  # Set Headers
@@ -117,10 +145,8 @@ module Azure::ARM::Authorization
117
145
  if status_code == 200
118
146
  begin
119
147
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
120
- unless parsed_response.nil?
121
- parsed_response = RoleAssignmentListResult.deserialize_object(parsed_response)
122
- end
123
- result.body = parsed_response
148
+ result_mapper = RoleAssignmentListResult.mapper()
149
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
124
150
  rescue Exception => e
125
151
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
126
152
  end
@@ -140,11 +166,33 @@ module Azure::ARM::Authorization
140
166
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
167
  # will be added to the HTTP request.
142
168
  #
143
- # @return [RoleAssignmentListResult] operation results.
169
+ # @return [RoleAssignmentListResult] which provide lazy access to pages of the
170
+ # response.
144
171
  #
145
- def list_for_resource_group(resource_group_name, filter = nil, custom_headers = nil)
172
+ def list_for_resource_group_as_lazy(resource_group_name, filter = nil, custom_headers = nil)
146
173
  response = list_for_resource_group_async(resource_group_name, filter, custom_headers).value!
147
- response.body unless response.nil?
174
+ unless response.nil?
175
+ page = response.body
176
+ page.next_method = Proc.new do |next_link|
177
+ list_for_resource_group_next_async(next_link, custom_headers)
178
+ end
179
+ page
180
+ end
181
+ end
182
+
183
+ #
184
+ # Gets role assignments of the resource group.
185
+ #
186
+ # @param resource_group_name [String] Resource group name.
187
+ # @param filter [String] The filter to apply on the operation.
188
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
189
+ # will be added to the HTTP request.
190
+ #
191
+ # @return [Array<RoleAssignment>] operation results.
192
+ #
193
+ def list_for_resource_group(resource_group_name, filter = nil, custom_headers = nil)
194
+ first_page = list_for_resource_group_as_lazy(resource_group_name, filter, custom_headers)
195
+ first_page.get_all_items
148
196
  end
149
197
 
150
198
  #
@@ -175,6 +223,8 @@ module Azure::ARM::Authorization
175
223
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
176
224
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
177
225
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
226
+
227
+
178
228
  request_headers = {}
179
229
 
180
230
  # Set Headers
@@ -210,10 +260,8 @@ module Azure::ARM::Authorization
210
260
  if status_code == 200
211
261
  begin
212
262
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
213
- unless parsed_response.nil?
214
- parsed_response = RoleAssignmentListResult.deserialize_object(parsed_response)
215
- end
216
- result.body = parsed_response
263
+ result_mapper = RoleAssignmentListResult.mapper()
264
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
217
265
  rescue Exception => e
218
266
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
219
267
  end
@@ -268,6 +316,8 @@ module Azure::ARM::Authorization
268
316
  fail ArgumentError, 'scope is nil' if scope.nil?
269
317
  fail ArgumentError, 'role_assignment_name is nil' if role_assignment_name.nil?
270
318
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
319
+
320
+
271
321
  request_headers = {}
272
322
 
273
323
  # Set Headers
@@ -304,10 +354,8 @@ module Azure::ARM::Authorization
304
354
  if status_code == 200
305
355
  begin
306
356
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
307
- unless parsed_response.nil?
308
- parsed_response = RoleAssignment.deserialize_object(parsed_response)
309
- end
310
- result.body = parsed_response
357
+ result_mapper = RoleAssignment.mapper()
358
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
311
359
  rescue Exception => e
312
360
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
313
361
  end
@@ -365,20 +413,22 @@ module Azure::ARM::Authorization
365
413
  fail ArgumentError, 'scope is nil' if scope.nil?
366
414
  fail ArgumentError, 'role_assignment_name is nil' if role_assignment_name.nil?
367
415
  fail ArgumentError, 'parameters is nil' if parameters.nil?
368
- parameters.validate unless parameters.nil?
369
416
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
417
+
418
+
370
419
  request_headers = {}
371
420
 
372
421
  # Set Headers
373
422
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
374
423
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
375
424
 
376
- # Serialize Request
377
425
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
378
- unless parameters.nil?
379
- parameters = RoleAssignmentCreateParameters.serialize_object(parameters)
380
- end
381
- request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
426
+
427
+ # Serialize Request
428
+ request_mapper = RoleAssignmentCreateParameters.mapper()
429
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
430
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
431
+
382
432
  path_template = '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'
383
433
  options = {
384
434
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -411,10 +461,8 @@ module Azure::ARM::Authorization
411
461
  if status_code == 201
412
462
  begin
413
463
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
414
- unless parsed_response.nil?
415
- parsed_response = RoleAssignment.deserialize_object(parsed_response)
416
- end
417
- result.body = parsed_response
464
+ result_mapper = RoleAssignment.mapper()
465
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
418
466
  rescue Exception => e
419
467
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
420
468
  end
@@ -469,6 +517,8 @@ module Azure::ARM::Authorization
469
517
  fail ArgumentError, 'scope is nil' if scope.nil?
470
518
  fail ArgumentError, 'role_assignment_name is nil' if role_assignment_name.nil?
471
519
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
520
+
521
+
472
522
  request_headers = {}
473
523
 
474
524
  # Set Headers
@@ -505,10 +555,8 @@ module Azure::ARM::Authorization
505
555
  if status_code == 200
506
556
  begin
507
557
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
508
- unless parsed_response.nil?
509
- parsed_response = RoleAssignment.deserialize_object(parsed_response)
510
- end
511
- result.body = parsed_response
558
+ result_mapper = RoleAssignment.mapper()
559
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
512
560
  rescue Exception => e
513
561
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
514
562
  end
@@ -559,6 +607,8 @@ module Azure::ARM::Authorization
559
607
  def delete_by_id_async(role_assignment_id, custom_headers = nil)
560
608
  fail ArgumentError, 'role_assignment_id is nil' if role_assignment_id.nil?
561
609
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
610
+
611
+
562
612
  request_headers = {}
563
613
 
564
614
  # Set Headers
@@ -594,10 +644,8 @@ module Azure::ARM::Authorization
594
644
  if status_code == 200
595
645
  begin
596
646
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
597
- unless parsed_response.nil?
598
- parsed_response = RoleAssignment.deserialize_object(parsed_response)
599
- end
600
- result.body = parsed_response
647
+ result_mapper = RoleAssignment.mapper()
648
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
601
649
  rescue Exception => e
602
650
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
603
651
  end
@@ -651,20 +699,22 @@ module Azure::ARM::Authorization
651
699
  def create_by_id_async(role_assignment_id, parameters, custom_headers = nil)
652
700
  fail ArgumentError, 'role_assignment_id is nil' if role_assignment_id.nil?
653
701
  fail ArgumentError, 'parameters is nil' if parameters.nil?
654
- parameters.validate unless parameters.nil?
655
702
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
703
+
704
+
656
705
  request_headers = {}
657
706
 
658
707
  # Set Headers
659
708
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
660
709
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
661
710
 
662
- # Serialize Request
663
711
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
664
- unless parameters.nil?
665
- parameters = RoleAssignmentCreateParameters.serialize_object(parameters)
666
- end
667
- request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
712
+
713
+ # Serialize Request
714
+ request_mapper = RoleAssignmentCreateParameters.mapper()
715
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
716
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
717
+
668
718
  path_template = '/{roleAssignmentId}'
669
719
  options = {
670
720
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -696,10 +746,8 @@ module Azure::ARM::Authorization
696
746
  if status_code == 201
697
747
  begin
698
748
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
699
- unless parsed_response.nil?
700
- parsed_response = RoleAssignment.deserialize_object(parsed_response)
701
- end
702
- result.body = parsed_response
749
+ result_mapper = RoleAssignment.mapper()
750
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
703
751
  rescue Exception => e
704
752
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
705
753
  end
@@ -750,6 +798,8 @@ module Azure::ARM::Authorization
750
798
  def get_by_id_async(role_assignment_id, custom_headers = nil)
751
799
  fail ArgumentError, 'role_assignment_id is nil' if role_assignment_id.nil?
752
800
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
801
+
802
+
753
803
  request_headers = {}
754
804
 
755
805
  # Set Headers
@@ -785,10 +835,8 @@ module Azure::ARM::Authorization
785
835
  if status_code == 200
786
836
  begin
787
837
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
788
- unless parsed_response.nil?
789
- parsed_response = RoleAssignment.deserialize_object(parsed_response)
790
- end
791
- result.body = parsed_response
838
+ result_mapper = RoleAssignment.mapper()
839
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
792
840
  rescue Exception => e
793
841
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
794
842
  end
@@ -807,11 +855,32 @@ module Azure::ARM::Authorization
807
855
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
808
856
  # will be added to the HTTP request.
809
857
  #
810
- # @return [RoleAssignmentListResult] operation results.
858
+ # @return [RoleAssignmentListResult] which provide lazy access to pages of the
859
+ # response.
811
860
  #
812
- def list(filter = nil, custom_headers = nil)
861
+ def list_as_lazy(filter = nil, custom_headers = nil)
813
862
  response = list_async(filter, custom_headers).value!
814
- response.body unless response.nil?
863
+ unless response.nil?
864
+ page = response.body
865
+ page.next_method = Proc.new do |next_link|
866
+ list_next_async(next_link, custom_headers)
867
+ end
868
+ page
869
+ end
870
+ end
871
+
872
+ #
873
+ # Gets role assignments of the subscription.
874
+ #
875
+ # @param filter [String] The filter to apply on the operation.
876
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
877
+ # will be added to the HTTP request.
878
+ #
879
+ # @return [Array<RoleAssignment>] operation results.
880
+ #
881
+ def list(filter = nil, custom_headers = nil)
882
+ first_page = list_as_lazy(filter, custom_headers)
883
+ first_page.get_all_items
815
884
  end
816
885
 
817
886
  #
@@ -839,6 +908,8 @@ module Azure::ARM::Authorization
839
908
  def list_async(filter = nil, custom_headers = nil)
840
909
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
841
910
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
911
+
912
+
842
913
  request_headers = {}
843
914
 
844
915
  # Set Headers
@@ -874,10 +945,8 @@ module Azure::ARM::Authorization
874
945
  if status_code == 200
875
946
  begin
876
947
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
877
- unless parsed_response.nil?
878
- parsed_response = RoleAssignmentListResult.deserialize_object(parsed_response)
879
- end
880
- result.body = parsed_response
948
+ result_mapper = RoleAssignmentListResult.mapper()
949
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
881
950
  rescue Exception => e
882
951
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
883
952
  end
@@ -897,11 +966,33 @@ module Azure::ARM::Authorization
897
966
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
898
967
  # will be added to the HTTP request.
899
968
  #
900
- # @return [RoleAssignmentListResult] operation results.
969
+ # @return [RoleAssignmentListResult] which provide lazy access to pages of the
970
+ # response.
901
971
  #
902
- def list_for_scope(scope, filter = nil, custom_headers = nil)
972
+ def list_for_scope_as_lazy(scope, filter = nil, custom_headers = nil)
903
973
  response = list_for_scope_async(scope, filter, custom_headers).value!
904
- response.body unless response.nil?
974
+ unless response.nil?
975
+ page = response.body
976
+ page.next_method = Proc.new do |next_link|
977
+ list_for_scope_next_async(next_link, custom_headers)
978
+ end
979
+ page
980
+ end
981
+ end
982
+
983
+ #
984
+ # Gets role assignments of the scope.
985
+ #
986
+ # @param scope [String] Scope.
987
+ # @param filter [String] The filter to apply on the operation.
988
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
989
+ # will be added to the HTTP request.
990
+ #
991
+ # @return [Array<RoleAssignment>] operation results.
992
+ #
993
+ def list_for_scope(scope, filter = nil, custom_headers = nil)
994
+ first_page = list_for_scope_as_lazy(scope, filter, custom_headers)
995
+ first_page.get_all_items
905
996
  end
906
997
 
907
998
  #
@@ -931,6 +1022,8 @@ module Azure::ARM::Authorization
931
1022
  def list_for_scope_async(scope, filter = nil, custom_headers = nil)
932
1023
  fail ArgumentError, 'scope is nil' if scope.nil?
933
1024
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1025
+
1026
+
934
1027
  request_headers = {}
935
1028
 
936
1029
  # Set Headers
@@ -966,10 +1059,8 @@ module Azure::ARM::Authorization
966
1059
  if status_code == 200
967
1060
  begin
968
1061
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
969
- unless parsed_response.nil?
970
- parsed_response = RoleAssignmentListResult.deserialize_object(parsed_response)
971
- end
972
- result.body = parsed_response
1062
+ result_mapper = RoleAssignmentListResult.mapper()
1063
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
973
1064
  rescue Exception => e
974
1065
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
975
1066
  end
@@ -1022,6 +1113,8 @@ module Azure::ARM::Authorization
1022
1113
  #
1023
1114
  def list_for_resource_next_async(next_page_link, custom_headers = nil)
1024
1115
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1116
+
1117
+
1025
1118
  request_headers = {}
1026
1119
 
1027
1120
  # Set Headers
@@ -1056,10 +1149,8 @@ module Azure::ARM::Authorization
1056
1149
  if status_code == 200
1057
1150
  begin
1058
1151
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1059
- unless parsed_response.nil?
1060
- parsed_response = RoleAssignmentListResult.deserialize_object(parsed_response)
1061
- end
1062
- result.body = parsed_response
1152
+ result_mapper = RoleAssignmentListResult.mapper()
1153
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1063
1154
  rescue Exception => e
1064
1155
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1065
1156
  end
@@ -1112,6 +1203,8 @@ module Azure::ARM::Authorization
1112
1203
  #
1113
1204
  def list_for_resource_group_next_async(next_page_link, custom_headers = nil)
1114
1205
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1206
+
1207
+
1115
1208
  request_headers = {}
1116
1209
 
1117
1210
  # Set Headers
@@ -1146,10 +1239,8 @@ module Azure::ARM::Authorization
1146
1239
  if status_code == 200
1147
1240
  begin
1148
1241
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1149
- unless parsed_response.nil?
1150
- parsed_response = RoleAssignmentListResult.deserialize_object(parsed_response)
1151
- end
1152
- result.body = parsed_response
1242
+ result_mapper = RoleAssignmentListResult.mapper()
1243
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1153
1244
  rescue Exception => e
1154
1245
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1155
1246
  end
@@ -1202,6 +1293,8 @@ module Azure::ARM::Authorization
1202
1293
  #
1203
1294
  def list_next_async(next_page_link, custom_headers = nil)
1204
1295
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1296
+
1297
+
1205
1298
  request_headers = {}
1206
1299
 
1207
1300
  # Set Headers
@@ -1236,10 +1329,8 @@ module Azure::ARM::Authorization
1236
1329
  if status_code == 200
1237
1330
  begin
1238
1331
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1239
- unless parsed_response.nil?
1240
- parsed_response = RoleAssignmentListResult.deserialize_object(parsed_response)
1241
- end
1242
- result.body = parsed_response
1332
+ result_mapper = RoleAssignmentListResult.mapper()
1333
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1243
1334
  rescue Exception => e
1244
1335
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1245
1336
  end
@@ -1292,6 +1383,8 @@ module Azure::ARM::Authorization
1292
1383
  #
1293
1384
  def list_for_scope_next_async(next_page_link, custom_headers = nil)
1294
1385
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1386
+
1387
+
1295
1388
  request_headers = {}
1296
1389
 
1297
1390
  # Set Headers
@@ -1326,10 +1419,8 @@ module Azure::ARM::Authorization
1326
1419
  if status_code == 200
1327
1420
  begin
1328
1421
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1329
- unless parsed_response.nil?
1330
- parsed_response = RoleAssignmentListResult.deserialize_object(parsed_response)
1331
- end
1332
- result.body = parsed_response
1422
+ result_mapper = RoleAssignmentListResult.mapper()
1423
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1333
1424
  rescue Exception => e
1334
1425
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1335
1426
  end
@@ -65,6 +65,8 @@ module Azure::ARM::Authorization
65
65
  fail ArgumentError, 'scope is nil' if scope.nil?
66
66
  fail ArgumentError, 'role_definition_id is nil' if role_definition_id.nil?
67
67
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+
69
+
68
70
  request_headers = {}
69
71
 
70
72
  # Set Headers
@@ -101,10 +103,8 @@ module Azure::ARM::Authorization
101
103
  if status_code == 200
102
104
  begin
103
105
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
104
- unless parsed_response.nil?
105
- parsed_response = RoleDefinition.deserialize_object(parsed_response)
106
- end
107
- result.body = parsed_response
106
+ result_mapper = RoleDefinition.mapper()
107
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
108
108
  rescue Exception => e
109
109
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
110
110
  end
@@ -159,6 +159,8 @@ module Azure::ARM::Authorization
159
159
  fail ArgumentError, 'scope is nil' if scope.nil?
160
160
  fail ArgumentError, 'role_definition_id is nil' if role_definition_id.nil?
161
161
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
162
+
163
+
162
164
  request_headers = {}
163
165
 
164
166
  # Set Headers
@@ -195,10 +197,8 @@ module Azure::ARM::Authorization
195
197
  if status_code == 200
196
198
  begin
197
199
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
198
- unless parsed_response.nil?
199
- parsed_response = RoleDefinition.deserialize_object(parsed_response)
200
- end
201
- result.body = parsed_response
200
+ result_mapper = RoleDefinition.mapper()
201
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
202
202
  rescue Exception => e
203
203
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
204
204
  end
@@ -256,20 +256,22 @@ module Azure::ARM::Authorization
256
256
  fail ArgumentError, 'scope is nil' if scope.nil?
257
257
  fail ArgumentError, 'role_definition_id is nil' if role_definition_id.nil?
258
258
  fail ArgumentError, 'role_definition is nil' if role_definition.nil?
259
- role_definition.validate unless role_definition.nil?
260
259
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
260
+
261
+
261
262
  request_headers = {}
262
263
 
263
264
  # Set Headers
264
265
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
265
266
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
266
267
 
267
- # Serialize Request
268
268
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
269
- unless role_definition.nil?
270
- role_definition = RoleDefinition.serialize_object(role_definition)
271
- end
272
- request_content = role_definition != nil ? JSON.generate(role_definition, quirks_mode: true) : nil
269
+
270
+ # Serialize Request
271
+ request_mapper = RoleDefinition.mapper()
272
+ request_content = @client.serialize(request_mapper, role_definition, 'role_definition')
273
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
274
+
273
275
  path_template = '/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}'
274
276
  options = {
275
277
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -302,10 +304,8 @@ module Azure::ARM::Authorization
302
304
  if status_code == 201
303
305
  begin
304
306
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
305
- unless parsed_response.nil?
306
- parsed_response = RoleDefinition.deserialize_object(parsed_response)
307
- end
308
- result.body = parsed_response
307
+ result_mapper = RoleDefinition.mapper()
308
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
309
309
  rescue Exception => e
310
310
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
311
311
  end
@@ -356,6 +356,8 @@ module Azure::ARM::Authorization
356
356
  def get_by_id_async(role_definition_id, custom_headers = nil)
357
357
  fail ArgumentError, 'role_definition_id is nil' if role_definition_id.nil?
358
358
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
359
+
360
+
359
361
  request_headers = {}
360
362
 
361
363
  # Set Headers
@@ -391,10 +393,8 @@ module Azure::ARM::Authorization
391
393
  if status_code == 200
392
394
  begin
393
395
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
394
- unless parsed_response.nil?
395
- parsed_response = RoleDefinition.deserialize_object(parsed_response)
396
- end
397
- result.body = parsed_response
396
+ result_mapper = RoleDefinition.mapper()
397
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
398
398
  rescue Exception => e
399
399
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
400
400
  end
@@ -415,11 +415,34 @@ module Azure::ARM::Authorization
415
415
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
416
416
  # will be added to the HTTP request.
417
417
  #
418
- # @return [RoleDefinitionListResult] operation results.
418
+ # @return [RoleDefinitionListResult] which provide lazy access to pages of the
419
+ # response.
419
420
  #
420
- def list(scope, filter = nil, custom_headers = nil)
421
+ def list_as_lazy(scope, filter = nil, custom_headers = nil)
421
422
  response = list_async(scope, filter, custom_headers).value!
422
- response.body unless response.nil?
423
+ unless response.nil?
424
+ page = response.body
425
+ page.next_method = Proc.new do |next_link|
426
+ list_next_async(next_link, custom_headers)
427
+ end
428
+ page
429
+ end
430
+ end
431
+
432
+ #
433
+ # Get all role definitions that are applicable at scope and above. Use
434
+ # atScopeAndBelow filter to search below the given scope as well
435
+ #
436
+ # @param scope [String] Scope
437
+ # @param filter [String] The filter to apply on the operation.
438
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
439
+ # will be added to the HTTP request.
440
+ #
441
+ # @return [Array<RoleDefinition>] operation results.
442
+ #
443
+ def list(scope, filter = nil, custom_headers = nil)
444
+ first_page = list_as_lazy(scope, filter, custom_headers)
445
+ first_page.get_all_items
423
446
  end
424
447
 
425
448
  #
@@ -451,6 +474,8 @@ module Azure::ARM::Authorization
451
474
  def list_async(scope, filter = nil, custom_headers = nil)
452
475
  fail ArgumentError, 'scope is nil' if scope.nil?
453
476
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
477
+
478
+
454
479
  request_headers = {}
455
480
 
456
481
  # Set Headers
@@ -486,10 +511,8 @@ module Azure::ARM::Authorization
486
511
  if status_code == 200
487
512
  begin
488
513
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
489
- unless parsed_response.nil?
490
- parsed_response = RoleDefinitionListResult.deserialize_object(parsed_response)
491
- end
492
- result.body = parsed_response
514
+ result_mapper = RoleDefinitionListResult.mapper()
515
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
493
516
  rescue Exception => e
494
517
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
495
518
  end
@@ -545,6 +568,8 @@ module Azure::ARM::Authorization
545
568
  #
546
569
  def list_next_async(next_page_link, custom_headers = nil)
547
570
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
571
+
572
+
548
573
  request_headers = {}
549
574
 
550
575
  # Set Headers
@@ -579,10 +604,8 @@ module Azure::ARM::Authorization
579
604
  if status_code == 200
580
605
  begin
581
606
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
582
- unless parsed_response.nil?
583
- parsed_response = RoleDefinitionListResult.deserialize_object(parsed_response)
584
- end
585
- result.body = parsed_response
607
+ result_mapper = RoleDefinitionListResult.mapper()
608
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
586
609
  rescue Exception => e
587
610
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
588
611
  end