azure_mgmt_locks 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZGM3Y2RmNGRkZWVmZjBmNTE0ZWRkZDdkZDkzNTliYzc5ZTRiOWU1Yg==
5
- data.tar.gz: !binary |-
6
- N2FjMDRlMWU0YjEwYTlkNWIwMzEzY2M2MTM1MzMzYTRlZWIyOWMwZA==
2
+ SHA1:
3
+ metadata.gz: f84c3c4a62db57e4b146a49e23b0fa8fcc9d96df
4
+ data.tar.gz: 5fa6bf9caf58602b35ce152f2fc0102a82ba8e7a
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MDcwZWRiMjVhOGUxM2YxMzM4YWE0YmJkMThiNWRkNThjZDZjMjg5YmRjNDcz
10
- NDljOTE3MjU1NDYwMmUxZTNlMmRmMjU5NTgzNmRhNmRmNmY4ZmI1NzQ1MTA2
11
- MTJmMTkyNTRjMTdkMWE1YTUxNTU3NjVhOTQwZTZkMDg2YTBkMmY=
12
- data.tar.gz: !binary |-
13
- Mzk3OTgzZTgyZTljYWEyNzQ4ODFlMjI2NDY4MWQ4ZDEyODEzMjNlZGQ4ZWM0
14
- ZmU1ZDUwYzEwODI0OWNkZTk5ZjdkZTkyYWNiNDcwNjMyMDlkNTE1MWE3MTJl
15
- MDQxZTExZDYzOWU4NjZjOGQ5M2E4NjRkYTZiNDliYzRjZTg0ZDA=
6
+ metadata.gz: 6a269844d2c6274d50f301d85bee9dd5bfbf11f647ed73d50d812d07b666ce6b99423704403a6b187631f96022bbeec88452d1d8d1a80997062fcd9fe14af6a3
7
+ data.tar.gz: 5411d9f113bd9b26091399bc637e83e393db1394dbb879bf5f830ec650841198c6058b73f4d7c6f2c9d3c0260ec06b9fa69e1217fc8dfb8ae3bbf56b199021f6
@@ -5,8 +5,8 @@
5
5
  lib = File.expand_path('../lib', __FILE__)
6
6
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
7
 
8
- require 'azure_mgmt_locks/module_definition'
9
- require 'azure_mgmt_locks/version'
8
+ require 'generated/azure_mgmt_locks/module_definition'
9
+ require 'generated/azure_mgmt_locks/version'
10
10
 
11
11
  Gem::Specification.new do |spec|
12
12
  spec.name = 'azure_mgmt_locks'
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.email = 'azrubyteam@microsoft.com'
16
16
  spec.description = 'Microsoft Azure Resource Lock Management Client Library for Ruby'
17
17
  spec.summary = 'Official Ruby client library to consume Microsoft Azure Resource Lock Management services.'
18
- spec.homepage = 'http://github.com/azure/azure-sdk-ruby'
18
+ spec.homepage = 'https://aka.ms/azure-sdk-for-ruby'
19
19
  spec.license = 'MIT'
20
20
 
21
21
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -29,7 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'rake', '~> 10'
30
30
  spec.add_development_dependency 'rspec', '~> 3'
31
31
  spec.add_development_dependency 'dotenv', '~> 2'
32
- spec.add_development_dependency 'azure_mgmt_resources', '~> 0.3'
33
32
 
34
- spec.add_runtime_dependency 'ms_rest_azure', '~> 0.2.3'
33
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.3.0'
35
34
  end
@@ -1,35 +1,5 @@
1
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.
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
5
4
 
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 'azure_mgmt_locks/module_definition'
20
- require 'ms_rest_azure'
21
-
22
- module Azure::ARM::Locks
23
- autoload :ManagementLocks, 'azure_mgmt_locks/management_locks.rb'
24
- autoload :ManagementLockClient, 'azure_mgmt_locks/management_lock_client.rb'
25
-
26
- module Models
27
- autoload :DeploymentExtendedFilter, 'azure_mgmt_locks/models/deployment_extended_filter.rb'
28
- autoload :GenericResourceFilter, 'azure_mgmt_locks/models/generic_resource_filter.rb'
29
- autoload :ResourceGroupFilter, 'azure_mgmt_locks/models/resource_group_filter.rb'
30
- autoload :ManagementLockProperties, 'azure_mgmt_locks/models/management_lock_properties.rb'
31
- autoload :ManagementLockObject, 'azure_mgmt_locks/models/management_lock_object.rb'
32
- autoload :ManagementLockListResult, 'azure_mgmt_locks/models/management_lock_list_result.rb'
33
- autoload :LockLevel, 'azure_mgmt_locks/models/lock_level.rb'
34
- end
35
- end
5
+ require 'generated/azure_mgmt_locks'
@@ -0,0 +1,34 @@
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
+ 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 'generated/azure_mgmt_locks/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::Locks
23
+ autoload :ManagementLocks, 'generated/azure_mgmt_locks/management_locks.rb'
24
+ autoload :ManagementLockClient, 'generated/azure_mgmt_locks/management_lock_client.rb'
25
+
26
+ module Models
27
+ autoload :DeploymentExtendedFilter, 'generated/azure_mgmt_locks/models/deployment_extended_filter.rb'
28
+ autoload :GenericResourceFilter, 'generated/azure_mgmt_locks/models/generic_resource_filter.rb'
29
+ autoload :ResourceGroupFilter, 'generated/azure_mgmt_locks/models/resource_group_filter.rb'
30
+ autoload :ManagementLockObject, 'generated/azure_mgmt_locks/models/management_lock_object.rb'
31
+ autoload :ManagementLockListResult, 'generated/azure_mgmt_locks/models/management_lock_list_result.rb'
32
+ autoload :LockLevel, 'generated/azure_mgmt_locks/models/lock_level.rb'
33
+ end
34
+ end
@@ -8,13 +8,13 @@ module Azure::ARM::Locks
8
8
  # A service client - single point of access to the REST API.
9
9
  #
10
10
  class ManagementLockClient < MsRestAzure::AzureServiceClient
11
- include Azure::ARM::Locks::Models
11
+ include MsRest::Serialization
12
12
  include MsRestAzure
13
13
 
14
14
  # @return [String] the base URI of the service.
15
15
  attr_accessor :base_url
16
16
 
17
- # @return Gets Azure subscription credentials.
17
+ # @return Credentials needed for the client to connect to Azure.
18
18
  attr_reader :credentials
19
19
 
20
20
  # @return [String] Gets subscription credentials which uniquely identify
@@ -40,7 +40,7 @@ module Azure::ARM::Locks
40
40
  # subscription.
41
41
  attr_accessor :credentials
42
42
 
43
- # @return management_locks
43
+ # @return [ManagementLocks] management_locks
44
44
  attr_reader :management_locks
45
45
 
46
46
  #
@@ -68,21 +68,23 @@ module Azure::ARM::Locks
68
68
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
69
69
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
70
70
  fail ArgumentError, 'parameters is nil' if parameters.nil?
71
- parameters.validate unless parameters.nil?
72
71
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
73
72
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
73
+
74
+
74
75
  request_headers = {}
75
76
 
76
77
  # Set Headers
77
78
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
78
79
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
79
80
 
80
- # Serialize Request
81
81
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
82
- unless parameters.nil?
83
- parameters = ManagementLockObject.serialize_object(parameters)
84
- end
85
- request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
82
+
83
+ # Serialize Request
84
+ request_mapper = ManagementLockObject.mapper()
85
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
86
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
87
+
86
88
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}'
87
89
  options = {
88
90
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -114,10 +116,8 @@ module Azure::ARM::Locks
114
116
  if status_code == 200
115
117
  begin
116
118
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
117
- unless parsed_response.nil?
118
- parsed_response = ManagementLockObject.deserialize_object(parsed_response)
119
- end
120
- result.body = parsed_response
119
+ result_mapper = ManagementLockObject.mapper()
120
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
121
121
  rescue Exception => e
122
122
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
123
123
  end
@@ -126,10 +126,8 @@ module Azure::ARM::Locks
126
126
  if status_code == 201
127
127
  begin
128
128
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
129
- unless parsed_response.nil?
130
- parsed_response = ManagementLockObject.deserialize_object(parsed_response)
131
- end
132
- result.body = parsed_response
129
+ result_mapper = ManagementLockObject.mapper()
130
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
133
131
  rescue Exception => e
134
132
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
135
133
  end
@@ -209,21 +207,23 @@ module Azure::ARM::Locks
209
207
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
210
208
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
211
209
  fail ArgumentError, 'parameters is nil' if parameters.nil?
212
- parameters.validate unless parameters.nil?
213
210
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
214
211
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
212
+
213
+
215
214
  request_headers = {}
216
215
 
217
216
  # Set Headers
218
217
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
219
218
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
220
219
 
221
- # Serialize Request
222
220
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
223
- unless parameters.nil?
224
- parameters = ManagementLockObject.serialize_object(parameters)
225
- end
226
- request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
221
+
222
+ # Serialize Request
223
+ request_mapper = ManagementLockObject.mapper()
224
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
225
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
226
+
227
227
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
228
228
  options = {
229
229
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -256,10 +256,8 @@ module Azure::ARM::Locks
256
256
  if status_code == 200
257
257
  begin
258
258
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
259
- unless parsed_response.nil?
260
- parsed_response = ManagementLockObject.deserialize_object(parsed_response)
261
- end
262
- result.body = parsed_response
259
+ result_mapper = ManagementLockObject.mapper()
260
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
263
261
  rescue Exception => e
264
262
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
265
263
  end
@@ -268,10 +266,8 @@ module Azure::ARM::Locks
268
266
  if status_code == 201
269
267
  begin
270
268
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
271
- unless parsed_response.nil?
272
- parsed_response = ManagementLockObject.deserialize_object(parsed_response)
273
- end
274
- result.body = parsed_response
269
+ result_mapper = ManagementLockObject.mapper()
270
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
275
271
  rescue Exception => e
276
272
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
277
273
  end
@@ -342,6 +338,8 @@ module Azure::ARM::Locks
342
338
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
343
339
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
344
340
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
341
+
342
+
345
343
  request_headers = {}
346
344
 
347
345
  # Set Headers
@@ -423,21 +421,23 @@ module Azure::ARM::Locks
423
421
  def create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers = nil)
424
422
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
425
423
  fail ArgumentError, 'parameters is nil' if parameters.nil?
426
- parameters.validate unless parameters.nil?
427
424
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
428
425
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
426
+
427
+
429
428
  request_headers = {}
430
429
 
431
430
  # Set Headers
432
431
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
433
432
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
434
433
 
435
- # Serialize Request
436
434
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
437
- unless parameters.nil?
438
- parameters = ManagementLockObject.serialize_object(parameters)
439
- end
440
- request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
435
+
436
+ # Serialize Request
437
+ request_mapper = ManagementLockObject.mapper()
438
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
439
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
440
+
441
441
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
442
442
  options = {
443
443
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -469,10 +469,8 @@ module Azure::ARM::Locks
469
469
  if status_code == 201
470
470
  begin
471
471
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
472
- unless parsed_response.nil?
473
- parsed_response = ManagementLockObject.deserialize_object(parsed_response)
474
- end
475
- result.body = parsed_response
472
+ result_mapper = ManagementLockObject.mapper()
473
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
476
474
  rescue Exception => e
477
475
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
478
476
  end
@@ -481,10 +479,8 @@ module Azure::ARM::Locks
481
479
  if status_code == 200
482
480
  begin
483
481
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
484
- unless parsed_response.nil?
485
- parsed_response = ManagementLockObject.deserialize_object(parsed_response)
486
- end
487
- result.body = parsed_response
482
+ result_mapper = ManagementLockObject.mapper()
483
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
488
484
  rescue Exception => e
489
485
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
490
486
  end
@@ -535,6 +531,8 @@ module Azure::ARM::Locks
535
531
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
536
532
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
537
533
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
534
+
535
+
538
536
  request_headers = {}
539
537
 
540
538
  # Set Headers
@@ -613,6 +611,8 @@ module Azure::ARM::Locks
613
611
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
614
612
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
615
613
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
614
+
615
+
616
616
  request_headers = {}
617
617
 
618
618
  # Set Headers
@@ -648,10 +648,8 @@ module Azure::ARM::Locks
648
648
  if status_code == 200
649
649
  begin
650
650
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
651
- unless parsed_response.nil?
652
- parsed_response = ManagementLockObject.deserialize_object(parsed_response)
653
- end
654
- result.body = parsed_response
651
+ result_mapper = ManagementLockObject.mapper()
652
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
655
653
  rescue Exception => e
656
654
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
657
655
  end
@@ -660,10 +658,8 @@ module Azure::ARM::Locks
660
658
  if status_code == 204
661
659
  begin
662
660
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
663
- unless parsed_response.nil?
664
- parsed_response = ManagementLockObject.deserialize_object(parsed_response)
665
- end
666
- result.body = parsed_response
661
+ result_mapper = ManagementLockObject.mapper()
662
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
667
663
  rescue Exception => e
668
664
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
669
665
  end
@@ -718,6 +714,8 @@ module Azure::ARM::Locks
718
714
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
719
715
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
720
716
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
717
+
718
+
721
719
  request_headers = {}
722
720
 
723
721
  # Set Headers
@@ -764,11 +762,33 @@ module Azure::ARM::Locks
764
762
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
765
763
  # will be added to the HTTP request.
766
764
  #
767
- # @return [ManagementLockListResult] operation results.
765
+ # @return [ManagementLockListResult] which provide lazy access to pages of the
766
+ # response.
768
767
  #
769
- def list_at_resource_group_level(resource_group_name, filter = nil, custom_headers = nil)
768
+ def list_at_resource_group_level_as_lazy(resource_group_name, filter = nil, custom_headers = nil)
770
769
  response = list_at_resource_group_level_async(resource_group_name, filter, custom_headers).value!
771
- response.body unless response.nil?
770
+ unless response.nil?
771
+ page = response.body
772
+ page.next_method = Proc.new do |next_link|
773
+ list_at_resource_group_level_next_async(next_link, custom_headers)
774
+ end
775
+ page
776
+ end
777
+ end
778
+
779
+ #
780
+ # Gets all the management locks of a resource group.
781
+ #
782
+ # @param resource_group_name [String] Resource group name.
783
+ # @param filter [String] The filter to apply on the operation.
784
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
785
+ # will be added to the HTTP request.
786
+ #
787
+ # @return [Array<ManagementLockObject>] operation results.
788
+ #
789
+ def list_at_resource_group_level(resource_group_name, filter = nil, custom_headers = nil)
790
+ first_page = list_at_resource_group_level_as_lazy(resource_group_name, filter, custom_headers)
791
+ first_page.get_all_items
772
792
  end
773
793
 
774
794
  #
@@ -799,6 +819,8 @@ module Azure::ARM::Locks
799
819
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
800
820
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
801
821
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
822
+
823
+
802
824
  request_headers = {}
803
825
 
804
826
  # Set Headers
@@ -834,10 +856,8 @@ module Azure::ARM::Locks
834
856
  if status_code == 200
835
857
  begin
836
858
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
837
- unless parsed_response.nil?
838
- parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
839
- end
840
- result.body = parsed_response
859
+ result_mapper = ManagementLockListResult.mapper()
860
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
841
861
  rescue Exception => e
842
862
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
843
863
  end
@@ -862,11 +882,38 @@ module Azure::ARM::Locks
862
882
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
863
883
  # will be added to the HTTP request.
864
884
  #
865
- # @return [ManagementLockListResult] operation results.
885
+ # @return [ManagementLockListResult] which provide lazy access to pages of the
886
+ # response.
866
887
  #
867
- def list_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
888
+ def list_at_resource_level_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
868
889
  response = list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers).value!
869
- response.body unless response.nil?
890
+ unless response.nil?
891
+ page = response.body
892
+ page.next_method = Proc.new do |next_link|
893
+ list_at_resource_level_next_async(next_link, custom_headers)
894
+ end
895
+ page
896
+ end
897
+ end
898
+
899
+ #
900
+ # Gets all the management locks of a resource or any level below resource.
901
+ #
902
+ # @param resource_group_name [String] The name of the resource group. The name
903
+ # is case insensitive.
904
+ # @param resource_provider_namespace [String] Resource identity.
905
+ # @param parent_resource_path [String] Resource identity.
906
+ # @param resource_type [String] Resource identity.
907
+ # @param resource_name [String] Resource identity.
908
+ # @param filter [String] The filter to apply on the operation.
909
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
910
+ # will be added to the HTTP request.
911
+ #
912
+ # @return [Array<ManagementLockObject>] operation results.
913
+ #
914
+ def list_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
915
+ first_page = list_at_resource_level_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers)
916
+ first_page.get_all_items
870
917
  end
871
918
 
872
919
  #
@@ -911,6 +958,8 @@ module Azure::ARM::Locks
911
958
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
912
959
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
913
960
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
961
+
962
+
914
963
  request_headers = {}
915
964
 
916
965
  # Set Headers
@@ -947,10 +996,8 @@ module Azure::ARM::Locks
947
996
  if status_code == 200
948
997
  begin
949
998
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
950
- unless parsed_response.nil?
951
- parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
952
- end
953
- result.body = parsed_response
999
+ result_mapper = ManagementLockListResult.mapper()
1000
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
954
1001
  rescue Exception => e
955
1002
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
956
1003
  end
@@ -970,11 +1017,33 @@ module Azure::ARM::Locks
970
1017
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
971
1018
  # will be added to the HTTP request.
972
1019
  #
973
- # @return [ManagementLockListResult] operation results.
1020
+ # @return [ManagementLockListResult] which provide lazy access to pages of the
1021
+ # response.
974
1022
  #
975
- def list_next(next_link, custom_headers = nil)
1023
+ def list_next_as_lazy(next_link, custom_headers = nil)
976
1024
  response = list_next_async(next_link, custom_headers).value!
977
- response.body unless response.nil?
1025
+ unless response.nil?
1026
+ page = response.body
1027
+ page.next_method = Proc.new do |next_link|
1028
+ list_next_next_async(next_link, custom_headers)
1029
+ end
1030
+ page
1031
+ end
1032
+ end
1033
+
1034
+ #
1035
+ # Get a list of management locks at resource level or below.
1036
+ #
1037
+ # @param next_link [String] NextLink from the previous successful call to List
1038
+ # operation.
1039
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1040
+ # will be added to the HTTP request.
1041
+ #
1042
+ # @return [Array<ManagementLockObject>] operation results.
1043
+ #
1044
+ def list_next(next_link, custom_headers = nil)
1045
+ first_page = list_next_as_lazy(next_link, custom_headers)
1046
+ first_page.get_all_items
978
1047
  end
979
1048
 
980
1049
  #
@@ -1004,6 +1073,8 @@ module Azure::ARM::Locks
1004
1073
  def list_next_async(next_link, custom_headers = nil)
1005
1074
  fail ArgumentError, 'next_link is nil' if next_link.nil?
1006
1075
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1076
+
1077
+
1007
1078
  request_headers = {}
1008
1079
 
1009
1080
  # Set Headers
@@ -1039,10 +1110,8 @@ module Azure::ARM::Locks
1039
1110
  if status_code == 200
1040
1111
  begin
1041
1112
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1042
- unless parsed_response.nil?
1043
- parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
1044
- end
1045
- result.body = parsed_response
1113
+ result_mapper = ManagementLockListResult.mapper()
1114
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1046
1115
  rescue Exception => e
1047
1116
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1048
1117
  end
@@ -1061,11 +1130,32 @@ module Azure::ARM::Locks
1061
1130
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1062
1131
  # will be added to the HTTP request.
1063
1132
  #
1064
- # @return [ManagementLockListResult] operation results.
1133
+ # @return [ManagementLockListResult] which provide lazy access to pages of the
1134
+ # response.
1065
1135
  #
1066
- def list_at_subscription_level(filter = nil, custom_headers = nil)
1136
+ def list_at_subscription_level_as_lazy(filter = nil, custom_headers = nil)
1067
1137
  response = list_at_subscription_level_async(filter, custom_headers).value!
1068
- response.body unless response.nil?
1138
+ unless response.nil?
1139
+ page = response.body
1140
+ page.next_method = Proc.new do |next_link|
1141
+ list_at_subscription_level_next_async(next_link, custom_headers)
1142
+ end
1143
+ page
1144
+ end
1145
+ end
1146
+
1147
+ #
1148
+ # Gets all the management locks of a subscription.
1149
+ #
1150
+ # @param filter [String] The filter to apply on the operation.
1151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1152
+ # will be added to the HTTP request.
1153
+ #
1154
+ # @return [Array<ManagementLockObject>] operation results.
1155
+ #
1156
+ def list_at_subscription_level(filter = nil, custom_headers = nil)
1157
+ first_page = list_at_subscription_level_as_lazy(filter, custom_headers)
1158
+ first_page.get_all_items
1069
1159
  end
1070
1160
 
1071
1161
  #
@@ -1093,6 +1183,8 @@ module Azure::ARM::Locks
1093
1183
  def list_at_subscription_level_async(filter = nil, custom_headers = nil)
1094
1184
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1095
1185
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1186
+
1187
+
1096
1188
  request_headers = {}
1097
1189
 
1098
1190
  # Set Headers
@@ -1128,10 +1220,8 @@ module Azure::ARM::Locks
1128
1220
  if status_code == 200
1129
1221
  begin
1130
1222
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1131
- unless parsed_response.nil?
1132
- parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
1133
- end
1134
- result.body = parsed_response
1223
+ result_mapper = ManagementLockListResult.mapper()
1224
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1135
1225
  rescue Exception => e
1136
1226
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1137
1227
  end
@@ -1184,6 +1274,8 @@ module Azure::ARM::Locks
1184
1274
  #
1185
1275
  def list_at_resource_group_level_next_async(next_page_link, custom_headers = nil)
1186
1276
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1277
+
1278
+
1187
1279
  request_headers = {}
1188
1280
 
1189
1281
  # Set Headers
@@ -1218,10 +1310,8 @@ module Azure::ARM::Locks
1218
1310
  if status_code == 200
1219
1311
  begin
1220
1312
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1221
- unless parsed_response.nil?
1222
- parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
1223
- end
1224
- result.body = parsed_response
1313
+ result_mapper = ManagementLockListResult.mapper()
1314
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1225
1315
  rescue Exception => e
1226
1316
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1227
1317
  end
@@ -1274,6 +1364,8 @@ module Azure::ARM::Locks
1274
1364
  #
1275
1365
  def list_at_resource_level_next_async(next_page_link, custom_headers = nil)
1276
1366
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1367
+
1368
+
1277
1369
  request_headers = {}
1278
1370
 
1279
1371
  # Set Headers
@@ -1308,10 +1400,8 @@ module Azure::ARM::Locks
1308
1400
  if status_code == 200
1309
1401
  begin
1310
1402
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1311
- unless parsed_response.nil?
1312
- parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
1313
- end
1314
- result.body = parsed_response
1403
+ result_mapper = ManagementLockListResult.mapper()
1404
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1315
1405
  rescue Exception => e
1316
1406
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1317
1407
  end
@@ -1364,6 +1454,8 @@ module Azure::ARM::Locks
1364
1454
  #
1365
1455
  def list_next_next_async(next_page_link, custom_headers = nil)
1366
1456
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1457
+
1458
+
1367
1459
  request_headers = {}
1368
1460
 
1369
1461
  # Set Headers
@@ -1398,10 +1490,8 @@ module Azure::ARM::Locks
1398
1490
  if status_code == 200
1399
1491
  begin
1400
1492
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1401
- unless parsed_response.nil?
1402
- parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
1403
- end
1404
- result.body = parsed_response
1493
+ result_mapper = ManagementLockListResult.mapper()
1494
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1405
1495
  rescue Exception => e
1406
1496
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1407
1497
  end
@@ -1454,6 +1544,8 @@ module Azure::ARM::Locks
1454
1544
  #
1455
1545
  def list_at_subscription_level_next_async(next_page_link, custom_headers = nil)
1456
1546
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1547
+
1548
+
1457
1549
  request_headers = {}
1458
1550
 
1459
1551
  # Set Headers
@@ -1488,10 +1580,8 @@ module Azure::ARM::Locks
1488
1580
  if status_code == 200
1489
1581
  begin
1490
1582
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1491
- unless parsed_response.nil?
1492
- parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
1493
- end
1494
- result.body = parsed_response
1583
+ result_mapper = ManagementLockListResult.mapper()
1584
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1495
1585
  rescue Exception => e
1496
1586
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1497
1587
  end