azure_mgmt_locks 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36eae213b9f81f854b0d90ead4b328f9baafd2df
4
- data.tar.gz: c709fcea1b31c900bcf094dd899519d1e8920a40
3
+ metadata.gz: 76ceb4041b73d99118226412142ff8b559a8c2c8
4
+ data.tar.gz: 339d2425092bb14988a8e488405b246d00ed8bb7
5
5
  SHA512:
6
- metadata.gz: c9c6c6c8b1d315b7743c4a1f9889264a8e6a6c8f2b68ba227d8e9657ff947d554d105ff58045ccaf62ed6872245a88e89875e3e8683f126988c9980133cfea59
7
- data.tar.gz: 983f0323dc953582dd3db447ea7e4093556992db9c3a2bbef1e072fbdf8caee4601682b1a4de0400176f086b25292c7c83cbeca8a6be7ae8a71337c11ede8b84
6
+ metadata.gz: 46c6eaf39fa2499cd31d96a5014909fbdf74acb659d08075169ec3a3be4a219bd1c57c4e53a61121526de13ae2afa71615a9d531c0dfdab0dc1bbd16c5f95495
7
+ data.tar.gz: 3592a8896b45e06f3b5f4a05334476210ae3e4b7af172472476a1f5926f2faef1e0e69907afa1920deb444939395e2011603db2ba5e481cb564d1943aa8be72a
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -24,11 +24,9 @@ module Azure::ARM::Locks
24
24
  autoload :ManagementLockClient, 'generated/azure_mgmt_locks/management_lock_client.rb'
25
25
 
26
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
27
  autoload :ManagementLockObject, 'generated/azure_mgmt_locks/models/management_lock_object.rb'
31
28
  autoload :ManagementLockListResult, 'generated/azure_mgmt_locks/models/management_lock_list_result.rb'
29
+ autoload :ManagementLockOwner, 'generated/azure_mgmt_locks/models/management_lock_owner.rb'
32
30
  autoload :LockLevel, 'generated/azure_mgmt_locks/models/lock_level.rb'
33
31
  end
34
32
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -17,12 +17,10 @@ module Azure::ARM::Locks
17
17
  # @return Credentials needed for the client to connect to Azure.
18
18
  attr_reader :credentials
19
19
 
20
- # @return [String] Gets subscription credentials which uniquely identify
21
- # Microsoft Azure subscription. The subscription ID forms part of the URI
22
- # for every service call.
20
+ # @return [String] The ID of the target subscription.
23
21
  attr_accessor :subscription_id
24
22
 
25
- # @return [String] Client Api Version.
23
+ # @return [String] The API version to use for the operation.
26
24
  attr_reader :api_version
27
25
 
28
26
  # @return [String] Gets or sets the preferred language for the response.
@@ -54,10 +52,11 @@ module Azure::ARM::Locks
54
52
  @credentials = credentials
55
53
 
56
54
  @management_locks = ManagementLocks.new(self)
57
- @api_version = '2015-01-01'
55
+ @api_version = '2016-09-01'
58
56
  @accept_language = 'en-US'
59
57
  @long_running_operation_retry_timeout = 30
60
58
  @generate_client_request_id = true
59
+ add_telemetry
61
60
  end
62
61
 
63
62
  #
@@ -115,5 +114,17 @@ module Azure::ARM::Locks
115
114
  super(request_url, method, path, options)
116
115
  end
117
116
 
117
+
118
+ private
119
+ #
120
+ # Adds telemetry information.
121
+ #
122
+ def add_telemetry
123
+ sdk_information = 'azure_mgmt_locks'
124
+ if defined? Azure::ARM::Locks::VERSION
125
+ sdk_information = "#{sdk_information}/#{Azure::ARM::Locks::VERSION}"
126
+ end
127
+ add_user_agent_information(sdk_information)
128
+ end
118
129
  end
119
130
  end
@@ -1,11 +1,12 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::Locks
7
7
  #
8
- # ManagementLocks
8
+ # Azure resources can be locked to prevent other users in your organization
9
+ # from deleting or modifying resources.
9
10
  #
10
11
  class ManagementLocks
11
12
  include Azure::ARM::Locks::Models
@@ -23,10 +24,18 @@ module Azure::ARM::Locks
23
24
  attr_reader :client
24
25
 
25
26
  #
26
- # Create or update a management lock at the resource group level.
27
+ # Creates or updates a management lock at the resource group level.
27
28
  #
28
- # @param resource_group_name [String] The resource group name.
29
- # @param lock_name [String] The lock name.
29
+ # When you apply a lock at a parent scope, all child resources inherit the same
30
+ # lock. To create management locks, you must have access to
31
+ # Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the
32
+ # built-in roles, only Owner and User Access Administrator are granted those
33
+ # actions.
34
+ #
35
+ # @param resource_group_name [String] The name of the resource group to lock.
36
+ # @param lock_name [String] The lock name. The lock name can be a maximum of
37
+ # 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control
38
+ # characters.
30
39
  # @param parameters [ManagementLockObject] The management lock parameters.
31
40
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
41
  # will be added to the HTTP request.
@@ -39,10 +48,18 @@ module Azure::ARM::Locks
39
48
  end
40
49
 
41
50
  #
42
- # Create or update a management lock at the resource group level.
51
+ # Creates or updates a management lock at the resource group level.
52
+ #
53
+ # When you apply a lock at a parent scope, all child resources inherit the same
54
+ # lock. To create management locks, you must have access to
55
+ # Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the
56
+ # built-in roles, only Owner and User Access Administrator are granted those
57
+ # actions.
43
58
  #
44
- # @param resource_group_name [String] The resource group name.
45
- # @param lock_name [String] The lock name.
59
+ # @param resource_group_name [String] The name of the resource group to lock.
60
+ # @param lock_name [String] The lock name. The lock name can be a maximum of
61
+ # 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control
62
+ # characters.
46
63
  # @param parameters [ManagementLockObject] The management lock parameters.
47
64
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
65
  # will be added to the HTTP request.
@@ -54,10 +71,18 @@ module Azure::ARM::Locks
54
71
  end
55
72
 
56
73
  #
57
- # Create or update a management lock at the resource group level.
74
+ # Creates or updates a management lock at the resource group level.
58
75
  #
59
- # @param resource_group_name [String] The resource group name.
60
- # @param lock_name [String] The lock name.
76
+ # When you apply a lock at a parent scope, all child resources inherit the same
77
+ # lock. To create management locks, you must have access to
78
+ # Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the
79
+ # built-in roles, only Owner and User Access Administrator are granted those
80
+ # actions.
81
+ #
82
+ # @param resource_group_name [String] The name of the resource group to lock.
83
+ # @param lock_name [String] The lock name. The lock name can be a maximum of
84
+ # 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control
85
+ # characters.
61
86
  # @param parameters [ManagementLockObject] The management lock parameters.
62
87
  # @param [Hash{String => String}] A hash of custom headers that will be added
63
88
  # to the HTTP request.
@@ -137,73 +162,61 @@ module Azure::ARM::Locks
137
162
  end
138
163
 
139
164
  #
140
- # Create or update a management lock at the resource level or any level below
141
- # resource.
165
+ # Deletes a management lock at the resource group level.
166
+ #
167
+ # To delete management locks, you must have access to Microsoft.Authorization/*
168
+ # or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner
169
+ # and User Access Administrator are granted those actions.
142
170
  #
143
- # @param resource_group_name [String] The name of the resource group.
144
- # @param resource_provider_namespace [String] Resource identity.
145
- # @param parent_resource_path [String] Resource identity.
146
- # @param resource_type [String] Resource identity.
147
- # @param resource_name [String] Resource identity.
148
- # @param lock_name [String] The name of lock.
149
- # @param parameters [ManagementLockObject] Create or update management lock
150
- # parameters.
171
+ # @param resource_group_name [String] The name of the resource group containing
172
+ # the lock.
173
+ # @param lock_name [String] The name of lock to delete.
151
174
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
152
175
  # will be added to the HTTP request.
153
176
  #
154
- # @return [ManagementLockObject] operation results.
155
177
  #
156
- def create_or_update_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers = nil)
157
- response = create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers).value!
158
- response.body unless response.nil?
178
+ def delete_at_resource_group_level(resource_group_name, lock_name, custom_headers = nil)
179
+ response = delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers).value!
180
+ nil
159
181
  end
160
182
 
161
183
  #
162
- # Create or update a management lock at the resource level or any level below
163
- # resource.
184
+ # Deletes a management lock at the resource group level.
164
185
  #
165
- # @param resource_group_name [String] The name of the resource group.
166
- # @param resource_provider_namespace [String] Resource identity.
167
- # @param parent_resource_path [String] Resource identity.
168
- # @param resource_type [String] Resource identity.
169
- # @param resource_name [String] Resource identity.
170
- # @param lock_name [String] The name of lock.
171
- # @param parameters [ManagementLockObject] Create or update management lock
172
- # parameters.
186
+ # To delete management locks, you must have access to Microsoft.Authorization/*
187
+ # or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner
188
+ # and User Access Administrator are granted those actions.
189
+ #
190
+ # @param resource_group_name [String] The name of the resource group containing
191
+ # the lock.
192
+ # @param lock_name [String] The name of lock to delete.
173
193
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
174
194
  # will be added to the HTTP request.
175
195
  #
176
196
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
177
197
  #
178
- def create_or_update_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers = nil)
179
- create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers).value!
198
+ def delete_at_resource_group_level_with_http_info(resource_group_name, lock_name, custom_headers = nil)
199
+ delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers).value!
180
200
  end
181
201
 
182
202
  #
183
- # Create or update a management lock at the resource level or any level below
184
- # resource.
203
+ # Deletes a management lock at the resource group level.
204
+ #
205
+ # To delete management locks, you must have access to Microsoft.Authorization/*
206
+ # or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner
207
+ # and User Access Administrator are granted those actions.
185
208
  #
186
- # @param resource_group_name [String] The name of the resource group.
187
- # @param resource_provider_namespace [String] Resource identity.
188
- # @param parent_resource_path [String] Resource identity.
189
- # @param resource_type [String] Resource identity.
190
- # @param resource_name [String] Resource identity.
191
- # @param lock_name [String] The name of lock.
192
- # @param parameters [ManagementLockObject] Create or update management lock
193
- # parameters.
209
+ # @param resource_group_name [String] The name of the resource group containing
210
+ # the lock.
211
+ # @param lock_name [String] The name of lock to delete.
194
212
  # @param [Hash{String => String}] A hash of custom headers that will be added
195
213
  # to the HTTP request.
196
214
  #
197
215
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
198
216
  #
199
- def create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers = nil)
217
+ def delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers = nil)
200
218
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
201
- fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
202
- fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
203
- fail ArgumentError, 'resource_type is nil' if resource_type.nil?
204
- fail ArgumentError, 'resource_name is nil' if resource_name.nil?
205
219
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
206
- fail ArgumentError, 'parameters is nil' if parameters.nil?
207
220
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
208
221
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
209
222
 
@@ -213,59 +226,29 @@ module Azure::ARM::Locks
213
226
  # Set Headers
214
227
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
215
228
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
216
-
217
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
218
-
219
- # Serialize Request
220
- request_mapper = ManagementLockObject.mapper()
221
- request_content = @client.serialize(request_mapper, parameters, 'parameters')
222
- request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
223
-
224
- path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
229
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}'
225
230
 
226
231
  request_url = @base_url || @client.base_url
227
232
 
228
233
  options = {
229
234
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
230
- path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
231
- skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
235
+ path_params: {'resourceGroupName' => resource_group_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
232
236
  query_params: {'api-version' => @client.api_version},
233
- body: request_content,
234
237
  headers: request_headers.merge(custom_headers || {}),
235
238
  base_url: request_url
236
239
  }
237
- promise = @client.make_request_async(:put, path_template, options)
240
+ promise = @client.make_request_async(:delete, path_template, options)
238
241
 
239
242
  promise = promise.then do |result|
240
243
  http_response = result.response
241
244
  status_code = http_response.status
242
245
  response_content = http_response.body
243
- unless status_code == 200 || status_code == 201
246
+ unless status_code == 204 || status_code == 200
244
247
  error_model = JSON.load(response_content)
245
248
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
246
249
  end
247
250
 
248
251
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
249
- # Deserialize Response
250
- if status_code == 200
251
- begin
252
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
253
- result_mapper = ManagementLockObject.mapper()
254
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
255
- rescue Exception => e
256
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
257
- end
258
- end
259
- # Deserialize Response
260
- if status_code == 201
261
- begin
262
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
263
- result_mapper = ManagementLockObject.mapper()
264
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
265
- rescue Exception => e
266
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
267
- end
268
- end
269
252
 
270
253
  result
271
254
  end
@@ -274,61 +257,46 @@ module Azure::ARM::Locks
274
257
  end
275
258
 
276
259
  #
277
- # Deletes the management lock of a resource or any level below resource.
260
+ # Gets a management lock at the resource group level.
278
261
  #
279
- # @param resource_group_name [String] The name of the resource group.
280
- # @param resource_provider_namespace [String] Resource identity.
281
- # @param parent_resource_path [String] Resource identity.
282
- # @param resource_type [String] Resource identity.
283
- # @param resource_name [String] Resource identity.
284
- # @param lock_name [String] The name of lock.
262
+ # @param resource_group_name [String] The name of the locked resource group.
263
+ # @param lock_name [String] The name of the lock to get.
285
264
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
286
265
  # will be added to the HTTP request.
287
266
  #
267
+ # @return [ManagementLockObject] operation results.
288
268
  #
289
- def delete_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers = nil)
290
- response = delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers).value!
291
- nil
269
+ def get_at_resource_group_level(resource_group_name, lock_name, custom_headers = nil)
270
+ response = get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers).value!
271
+ response.body unless response.nil?
292
272
  end
293
273
 
294
274
  #
295
- # Deletes the management lock of a resource or any level below resource.
275
+ # Gets a management lock at the resource group level.
296
276
  #
297
- # @param resource_group_name [String] The name of the resource group.
298
- # @param resource_provider_namespace [String] Resource identity.
299
- # @param parent_resource_path [String] Resource identity.
300
- # @param resource_type [String] Resource identity.
301
- # @param resource_name [String] Resource identity.
302
- # @param lock_name [String] The name of lock.
277
+ # @param resource_group_name [String] The name of the locked resource group.
278
+ # @param lock_name [String] The name of the lock to get.
303
279
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
304
280
  # will be added to the HTTP request.
305
281
  #
306
282
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
307
283
  #
308
- def delete_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers = nil)
309
- delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers).value!
284
+ def get_at_resource_group_level_with_http_info(resource_group_name, lock_name, custom_headers = nil)
285
+ get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers).value!
310
286
  end
311
287
 
312
288
  #
313
- # Deletes the management lock of a resource or any level below resource.
289
+ # Gets a management lock at the resource group level.
314
290
  #
315
- # @param resource_group_name [String] The name of the resource group.
316
- # @param resource_provider_namespace [String] Resource identity.
317
- # @param parent_resource_path [String] Resource identity.
318
- # @param resource_type [String] Resource identity.
319
- # @param resource_name [String] Resource identity.
320
- # @param lock_name [String] The name of lock.
291
+ # @param resource_group_name [String] The name of the locked resource group.
292
+ # @param lock_name [String] The name of the lock to get.
321
293
  # @param [Hash{String => String}] A hash of custom headers that will be added
322
294
  # to the HTTP request.
323
295
  #
324
296
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
325
297
  #
326
- def delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers = nil)
298
+ def get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers = nil)
327
299
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
328
- fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
329
- fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
330
- fail ArgumentError, 'resource_type is nil' if resource_type.nil?
331
- fail ArgumentError, 'resource_name is nil' if resource_name.nil?
332
300
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
333
301
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
334
302
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -339,30 +307,39 @@ module Azure::ARM::Locks
339
307
  # Set Headers
340
308
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
341
309
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
342
- path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
310
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}'
343
311
 
344
312
  request_url = @base_url || @client.base_url
345
313
 
346
314
  options = {
347
315
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
348
- path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
349
- skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
316
+ path_params: {'resourceGroupName' => resource_group_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
350
317
  query_params: {'api-version' => @client.api_version},
351
318
  headers: request_headers.merge(custom_headers || {}),
352
319
  base_url: request_url
353
320
  }
354
- promise = @client.make_request_async(:delete, path_template, options)
321
+ promise = @client.make_request_async(:get, path_template, options)
355
322
 
356
323
  promise = promise.then do |result|
357
324
  http_response = result.response
358
325
  status_code = http_response.status
359
326
  response_content = http_response.body
360
- unless status_code == 204 || status_code == 200 || status_code == 202
327
+ unless status_code == 200
361
328
  error_model = JSON.load(response_content)
362
329
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
363
330
  end
364
331
 
365
332
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
333
+ # Deserialize Response
334
+ if status_code == 200
335
+ begin
336
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
337
+ result_mapper = ManagementLockObject.mapper()
338
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
339
+ rescue Exception => e
340
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
341
+ end
342
+ end
366
343
 
367
344
  result
368
345
  end
@@ -371,45 +348,101 @@ module Azure::ARM::Locks
371
348
  end
372
349
 
373
350
  #
374
- # Create or update a management lock at the subscription level.
375
- #
376
- # @param lock_name [String] The name of lock.
377
- # @param parameters [ManagementLockObject] The management lock parameters.
351
+ # Creates or updates a management lock at the resource level or any level below
352
+ # the resource.
353
+ #
354
+ # When you apply a lock at a parent scope, all child resources inherit the same
355
+ # lock. To create management locks, you must have access to
356
+ # Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the
357
+ # built-in roles, only Owner and User Access Administrator are granted those
358
+ # actions.
359
+ #
360
+ # @param resource_group_name [String] The name of the resource group containing
361
+ # the resource to lock.
362
+ # @param resource_provider_namespace [String] The resource provider namespace
363
+ # of the resource to lock.
364
+ # @param parent_resource_path [String] The parent resource identity.
365
+ # @param resource_type [String] The resource type of the resource to lock.
366
+ # @param resource_name [String] The name of the resource to lock.
367
+ # @param lock_name [String] The name of lock. The lock name can be a maximum of
368
+ # 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control
369
+ # characters.
370
+ # @param parameters [ManagementLockObject] Parameters for creating or updating
371
+ # a management lock.
378
372
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
379
373
  # will be added to the HTTP request.
380
374
  #
381
375
  # @return [ManagementLockObject] operation results.
382
376
  #
383
- def create_or_update_at_subscription_level(lock_name, parameters, custom_headers = nil)
384
- response = create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers).value!
377
+ def create_or_update_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers = nil)
378
+ response = create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers).value!
385
379
  response.body unless response.nil?
386
380
  end
387
381
 
388
382
  #
389
- # Create or update a management lock at the subscription level.
390
- #
391
- # @param lock_name [String] The name of lock.
392
- # @param parameters [ManagementLockObject] The management lock parameters.
383
+ # Creates or updates a management lock at the resource level or any level below
384
+ # the resource.
385
+ #
386
+ # When you apply a lock at a parent scope, all child resources inherit the same
387
+ # lock. To create management locks, you must have access to
388
+ # Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the
389
+ # built-in roles, only Owner and User Access Administrator are granted those
390
+ # actions.
391
+ #
392
+ # @param resource_group_name [String] The name of the resource group containing
393
+ # the resource to lock.
394
+ # @param resource_provider_namespace [String] The resource provider namespace
395
+ # of the resource to lock.
396
+ # @param parent_resource_path [String] The parent resource identity.
397
+ # @param resource_type [String] The resource type of the resource to lock.
398
+ # @param resource_name [String] The name of the resource to lock.
399
+ # @param lock_name [String] The name of lock. The lock name can be a maximum of
400
+ # 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control
401
+ # characters.
402
+ # @param parameters [ManagementLockObject] Parameters for creating or updating
403
+ # a management lock.
393
404
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
394
405
  # will be added to the HTTP request.
395
406
  #
396
407
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
397
408
  #
398
- def create_or_update_at_subscription_level_with_http_info(lock_name, parameters, custom_headers = nil)
399
- create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers).value!
409
+ def create_or_update_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers = nil)
410
+ create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers).value!
400
411
  end
401
412
 
402
413
  #
403
- # Create or update a management lock at the subscription level.
404
- #
405
- # @param lock_name [String] The name of lock.
406
- # @param parameters [ManagementLockObject] The management lock parameters.
414
+ # Creates or updates a management lock at the resource level or any level below
415
+ # the resource.
416
+ #
417
+ # When you apply a lock at a parent scope, all child resources inherit the same
418
+ # lock. To create management locks, you must have access to
419
+ # Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the
420
+ # built-in roles, only Owner and User Access Administrator are granted those
421
+ # actions.
422
+ #
423
+ # @param resource_group_name [String] The name of the resource group containing
424
+ # the resource to lock.
425
+ # @param resource_provider_namespace [String] The resource provider namespace
426
+ # of the resource to lock.
427
+ # @param parent_resource_path [String] The parent resource identity.
428
+ # @param resource_type [String] The resource type of the resource to lock.
429
+ # @param resource_name [String] The name of the resource to lock.
430
+ # @param lock_name [String] The name of lock. The lock name can be a maximum of
431
+ # 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control
432
+ # characters.
433
+ # @param parameters [ManagementLockObject] Parameters for creating or updating
434
+ # a management lock.
407
435
  # @param [Hash{String => String}] A hash of custom headers that will be added
408
436
  # to the HTTP request.
409
437
  #
410
438
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
411
439
  #
412
- def create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers = nil)
440
+ def create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers = nil)
441
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
442
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
443
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
444
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
445
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
413
446
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
414
447
  fail ArgumentError, 'parameters is nil' if parameters.nil?
415
448
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
@@ -429,13 +462,14 @@ module Azure::ARM::Locks
429
462
  request_content = @client.serialize(request_mapper, parameters, 'parameters')
430
463
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
431
464
 
432
- path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
465
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
433
466
 
434
467
  request_url = @base_url || @client.base_url
435
468
 
436
469
  options = {
437
470
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
438
- path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
471
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
472
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
439
473
  query_params: {'api-version' => @client.api_version},
440
474
  body: request_content,
441
475
  headers: request_headers.merge(custom_headers || {}),
@@ -447,14 +481,14 @@ module Azure::ARM::Locks
447
481
  http_response = result.response
448
482
  status_code = http_response.status
449
483
  response_content = http_response.body
450
- unless status_code == 201 || status_code == 200
484
+ unless status_code == 200 || status_code == 201
451
485
  error_model = JSON.load(response_content)
452
486
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
453
487
  end
454
488
 
455
489
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
456
490
  # Deserialize Response
457
- if status_code == 201
491
+ if status_code == 200
458
492
  begin
459
493
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
460
494
  result_mapper = ManagementLockObject.mapper()
@@ -464,7 +498,7 @@ module Azure::ARM::Locks
464
498
  end
465
499
  end
466
500
  # Deserialize Response
467
- if status_code == 200
501
+ if status_code == 201
468
502
  begin
469
503
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
470
504
  result_mapper = ManagementLockObject.mapper()
@@ -481,41 +515,85 @@ module Azure::ARM::Locks
481
515
  end
482
516
 
483
517
  #
484
- # Deletes the management lock of a subscription.
518
+ # Deletes the management lock of a resource or any level below the resource.
519
+ #
520
+ # To delete management locks, you must have access to Microsoft.Authorization/*
521
+ # or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner
522
+ # and User Access Administrator are granted those actions.
485
523
  #
486
- # @param lock_name [String] The name of lock.
524
+ # @param resource_group_name [String] The name of the resource group containing
525
+ # the resource with the lock to delete.
526
+ # @param resource_provider_namespace [String] The resource provider namespace
527
+ # of the resource with the lock to delete.
528
+ # @param parent_resource_path [String] The parent resource identity.
529
+ # @param resource_type [String] The resource type of the resource with the lock
530
+ # to delete.
531
+ # @param resource_name [String] The name of the resource with the lock to
532
+ # delete.
533
+ # @param lock_name [String] The name of the lock to delete.
487
534
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
488
535
  # will be added to the HTTP request.
489
536
  #
490
537
  #
491
- def delete_at_subscription_level(lock_name, custom_headers = nil)
492
- response = delete_at_subscription_level_async(lock_name, custom_headers).value!
538
+ def delete_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers = nil)
539
+ response = delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers).value!
493
540
  nil
494
541
  end
495
542
 
496
543
  #
497
- # Deletes the management lock of a subscription.
544
+ # Deletes the management lock of a resource or any level below the resource.
498
545
  #
499
- # @param lock_name [String] The name of lock.
546
+ # To delete management locks, you must have access to Microsoft.Authorization/*
547
+ # or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner
548
+ # and User Access Administrator are granted those actions.
549
+ #
550
+ # @param resource_group_name [String] The name of the resource group containing
551
+ # the resource with the lock to delete.
552
+ # @param resource_provider_namespace [String] The resource provider namespace
553
+ # of the resource with the lock to delete.
554
+ # @param parent_resource_path [String] The parent resource identity.
555
+ # @param resource_type [String] The resource type of the resource with the lock
556
+ # to delete.
557
+ # @param resource_name [String] The name of the resource with the lock to
558
+ # delete.
559
+ # @param lock_name [String] The name of the lock to delete.
500
560
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
501
561
  # will be added to the HTTP request.
502
562
  #
503
563
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
504
564
  #
505
- def delete_at_subscription_level_with_http_info(lock_name, custom_headers = nil)
506
- delete_at_subscription_level_async(lock_name, custom_headers).value!
565
+ def delete_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers = nil)
566
+ delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers).value!
507
567
  end
508
568
 
509
569
  #
510
- # Deletes the management lock of a subscription.
570
+ # Deletes the management lock of a resource or any level below the resource.
571
+ #
572
+ # To delete management locks, you must have access to Microsoft.Authorization/*
573
+ # or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner
574
+ # and User Access Administrator are granted those actions.
511
575
  #
512
- # @param lock_name [String] The name of lock.
576
+ # @param resource_group_name [String] The name of the resource group containing
577
+ # the resource with the lock to delete.
578
+ # @param resource_provider_namespace [String] The resource provider namespace
579
+ # of the resource with the lock to delete.
580
+ # @param parent_resource_path [String] The parent resource identity.
581
+ # @param resource_type [String] The resource type of the resource with the lock
582
+ # to delete.
583
+ # @param resource_name [String] The name of the resource with the lock to
584
+ # delete.
585
+ # @param lock_name [String] The name of the lock to delete.
513
586
  # @param [Hash{String => String}] A hash of custom headers that will be added
514
587
  # to the HTTP request.
515
588
  #
516
589
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
517
590
  #
518
- def delete_at_subscription_level_async(lock_name, custom_headers = nil)
591
+ def delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers = nil)
592
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
593
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
594
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
595
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
596
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
519
597
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
520
598
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
521
599
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -526,13 +604,14 @@ module Azure::ARM::Locks
526
604
  # Set Headers
527
605
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
528
606
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
529
- path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
607
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
530
608
 
531
609
  request_url = @base_url || @client.base_url
532
610
 
533
611
  options = {
534
612
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
535
- path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
613
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
614
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
536
615
  query_params: {'api-version' => @client.api_version},
537
616
  headers: request_headers.merge(custom_headers || {}),
538
617
  base_url: request_url
@@ -543,7 +622,7 @@ module Azure::ARM::Locks
543
622
  http_response = result.response
544
623
  status_code = http_response.status
545
624
  response_content = http_response.body
546
- unless status_code == 204 || status_code == 200 || status_code == 202
625
+ unless status_code == 204 || status_code == 200
547
626
  error_model = JSON.load(response_content)
548
627
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
549
628
  end
@@ -557,43 +636,71 @@ module Azure::ARM::Locks
557
636
  end
558
637
 
559
638
  #
560
- # Gets the management lock of a scope.
639
+ # Creates or updates a management lock at the subscription level.
640
+ #
641
+ # When you apply a lock at a parent scope, all child resources inherit the same
642
+ # lock. To create management locks, you must have access to
643
+ # Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the
644
+ # built-in roles, only Owner and User Access Administrator are granted those
645
+ # actions.
561
646
  #
562
- # @param lock_name [String] Name of the management lock.
647
+ # @param lock_name [String] The name of lock. The lock name can be a maximum of
648
+ # 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control
649
+ # characters.
650
+ # @param parameters [ManagementLockObject] The management lock parameters.
563
651
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
564
652
  # will be added to the HTTP request.
565
653
  #
566
654
  # @return [ManagementLockObject] operation results.
567
655
  #
568
- def get(lock_name, custom_headers = nil)
569
- response = get_async(lock_name, custom_headers).value!
656
+ def create_or_update_at_subscription_level(lock_name, parameters, custom_headers = nil)
657
+ response = create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers).value!
570
658
  response.body unless response.nil?
571
659
  end
572
660
 
573
661
  #
574
- # Gets the management lock of a scope.
662
+ # Creates or updates a management lock at the subscription level.
575
663
  #
576
- # @param lock_name [String] Name of the management lock.
664
+ # When you apply a lock at a parent scope, all child resources inherit the same
665
+ # lock. To create management locks, you must have access to
666
+ # Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the
667
+ # built-in roles, only Owner and User Access Administrator are granted those
668
+ # actions.
669
+ #
670
+ # @param lock_name [String] The name of lock. The lock name can be a maximum of
671
+ # 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control
672
+ # characters.
673
+ # @param parameters [ManagementLockObject] The management lock parameters.
577
674
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
578
675
  # will be added to the HTTP request.
579
676
  #
580
677
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
581
678
  #
582
- def get_with_http_info(lock_name, custom_headers = nil)
583
- get_async(lock_name, custom_headers).value!
679
+ def create_or_update_at_subscription_level_with_http_info(lock_name, parameters, custom_headers = nil)
680
+ create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers).value!
584
681
  end
585
682
 
586
683
  #
587
- # Gets the management lock of a scope.
684
+ # Creates or updates a management lock at the subscription level.
685
+ #
686
+ # When you apply a lock at a parent scope, all child resources inherit the same
687
+ # lock. To create management locks, you must have access to
688
+ # Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the
689
+ # built-in roles, only Owner and User Access Administrator are granted those
690
+ # actions.
588
691
  #
589
- # @param lock_name [String] Name of the management lock.
692
+ # @param lock_name [String] The name of lock. The lock name can be a maximum of
693
+ # 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control
694
+ # characters.
695
+ # @param parameters [ManagementLockObject] The management lock parameters.
590
696
  # @param [Hash{String => String}] A hash of custom headers that will be added
591
697
  # to the HTTP request.
592
698
  #
593
699
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
594
700
  #
595
- def get_async(lock_name, custom_headers = nil)
701
+ def create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers = nil)
596
702
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
703
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
597
704
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
598
705
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
599
706
 
@@ -603,6 +710,14 @@ module Azure::ARM::Locks
603
710
  # Set Headers
604
711
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
605
712
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
713
+
714
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
715
+
716
+ # Serialize Request
717
+ request_mapper = ManagementLockObject.mapper()
718
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
719
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
720
+
606
721
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
607
722
 
608
723
  request_url = @base_url || @client.base_url
@@ -611,23 +726,24 @@ module Azure::ARM::Locks
611
726
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
612
727
  path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
613
728
  query_params: {'api-version' => @client.api_version},
729
+ body: request_content,
614
730
  headers: request_headers.merge(custom_headers || {}),
615
731
  base_url: request_url
616
732
  }
617
- promise = @client.make_request_async(:get, path_template, options)
733
+ promise = @client.make_request_async(:put, path_template, options)
618
734
 
619
735
  promise = promise.then do |result|
620
736
  http_response = result.response
621
737
  status_code = http_response.status
622
738
  response_content = http_response.body
623
- unless status_code == 200 || status_code == 204
739
+ unless status_code == 201 || status_code == 200
624
740
  error_model = JSON.load(response_content)
625
741
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
626
742
  end
627
743
 
628
744
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
629
745
  # Deserialize Response
630
- if status_code == 200
746
+ if status_code == 201
631
747
  begin
632
748
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
633
749
  result_mapper = ManagementLockObject.mapper()
@@ -637,7 +753,7 @@ module Azure::ARM::Locks
637
753
  end
638
754
  end
639
755
  # Deserialize Response
640
- if status_code == 204
756
+ if status_code == 200
641
757
  begin
642
758
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
643
759
  result_mapper = ManagementLockObject.mapper()
@@ -654,45 +770,53 @@ module Azure::ARM::Locks
654
770
  end
655
771
 
656
772
  #
657
- # Deletes the management lock of a resource group.
773
+ # Deletes the management lock at the subscription level.
658
774
  #
659
- # @param resource_group [String] The resource group names.
660
- # @param lock_name [String] The name of lock.
775
+ # To delete management locks, you must have access to Microsoft.Authorization/*
776
+ # or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner
777
+ # and User Access Administrator are granted those actions.
778
+ #
779
+ # @param lock_name [String] The name of lock to delete.
661
780
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
662
781
  # will be added to the HTTP request.
663
782
  #
664
783
  #
665
- def delete_at_resource_group_level(resource_group, lock_name, custom_headers = nil)
666
- response = delete_at_resource_group_level_async(resource_group, lock_name, custom_headers).value!
784
+ def delete_at_subscription_level(lock_name, custom_headers = nil)
785
+ response = delete_at_subscription_level_async(lock_name, custom_headers).value!
667
786
  nil
668
787
  end
669
788
 
670
789
  #
671
- # Deletes the management lock of a resource group.
790
+ # Deletes the management lock at the subscription level.
791
+ #
792
+ # To delete management locks, you must have access to Microsoft.Authorization/*
793
+ # or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner
794
+ # and User Access Administrator are granted those actions.
672
795
  #
673
- # @param resource_group [String] The resource group names.
674
- # @param lock_name [String] The name of lock.
796
+ # @param lock_name [String] The name of lock to delete.
675
797
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
676
798
  # will be added to the HTTP request.
677
799
  #
678
800
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
679
801
  #
680
- def delete_at_resource_group_level_with_http_info(resource_group, lock_name, custom_headers = nil)
681
- delete_at_resource_group_level_async(resource_group, lock_name, custom_headers).value!
802
+ def delete_at_subscription_level_with_http_info(lock_name, custom_headers = nil)
803
+ delete_at_subscription_level_async(lock_name, custom_headers).value!
682
804
  end
683
805
 
684
806
  #
685
- # Deletes the management lock of a resource group.
807
+ # Deletes the management lock at the subscription level.
808
+ #
809
+ # To delete management locks, you must have access to Microsoft.Authorization/*
810
+ # or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner
811
+ # and User Access Administrator are granted those actions.
686
812
  #
687
- # @param resource_group [String] The resource group names.
688
- # @param lock_name [String] The name of lock.
813
+ # @param lock_name [String] The name of lock to delete.
689
814
  # @param [Hash{String => String}] A hash of custom headers that will be added
690
815
  # to the HTTP request.
691
816
  #
692
817
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
693
818
  #
694
- def delete_at_resource_group_level_async(resource_group, lock_name, custom_headers = nil)
695
- fail ArgumentError, 'resource_group is nil' if resource_group.nil?
819
+ def delete_at_subscription_level_async(lock_name, custom_headers = nil)
696
820
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
697
821
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
698
822
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -703,13 +827,13 @@ module Azure::ARM::Locks
703
827
  # Set Headers
704
828
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
705
829
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
706
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Authorization/locks/{lockName}'
830
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
707
831
 
708
832
  request_url = @base_url || @client.base_url
709
833
 
710
834
  options = {
711
835
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
712
- path_params: {'resourceGroup' => resource_group,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
836
+ path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
713
837
  query_params: {'api-version' => @client.api_version},
714
838
  headers: request_headers.merge(custom_headers || {}),
715
839
  base_url: request_url
@@ -720,7 +844,7 @@ module Azure::ARM::Locks
720
844
  http_response = result.response
721
845
  status_code = http_response.status
722
846
  response_content = http_response.body
723
- unless status_code == 204 || status_code == 200 || status_code == 202
847
+ unless status_code == 204 || status_code == 200
724
848
  error_model = JSON.load(response_content)
725
849
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
726
850
  end
@@ -734,68 +858,43 @@ module Azure::ARM::Locks
734
858
  end
735
859
 
736
860
  #
737
- # Gets all the management locks of a resource group.
738
- #
739
- # @param resource_group_name [String] Resource group name.
740
- # @param filter [String] The filter to apply on the operation.
741
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
742
- # will be added to the HTTP request.
743
- #
744
- # @return [ManagementLockListResult] which provide lazy access to pages of the
745
- # response.
746
- #
747
- def list_at_resource_group_level_as_lazy(resource_group_name, filter = nil, custom_headers = nil)
748
- response = list_at_resource_group_level_async(resource_group_name, filter, custom_headers).value!
749
- unless response.nil?
750
- page = response.body
751
- page.next_method = Proc.new do |next_page_link|
752
- list_at_resource_group_level_next_async(next_page_link, custom_headers)
753
- end
754
- page
755
- end
756
- end
757
-
758
- #
759
- # Gets all the management locks of a resource group.
861
+ # Gets a management lock at the subscription level.
760
862
  #
761
- # @param resource_group_name [String] Resource group name.
762
- # @param filter [String] The filter to apply on the operation.
863
+ # @param lock_name [String] The name of the lock to get.
763
864
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
764
865
  # will be added to the HTTP request.
765
866
  #
766
- # @return [Array<ManagementLockObject>] operation results.
867
+ # @return [ManagementLockObject] operation results.
767
868
  #
768
- def list_at_resource_group_level(resource_group_name, filter = nil, custom_headers = nil)
769
- first_page = list_at_resource_group_level_as_lazy(resource_group_name, filter, custom_headers)
770
- first_page.get_all_items
869
+ def get(lock_name, custom_headers = nil)
870
+ response = get_async(lock_name, custom_headers).value!
871
+ response.body unless response.nil?
771
872
  end
772
873
 
773
874
  #
774
- # Gets all the management locks of a resource group.
875
+ # Gets a management lock at the subscription level.
775
876
  #
776
- # @param resource_group_name [String] Resource group name.
777
- # @param filter [String] The filter to apply on the operation.
877
+ # @param lock_name [String] The name of the lock to get.
778
878
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
779
879
  # will be added to the HTTP request.
780
880
  #
781
881
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
782
882
  #
783
- def list_at_resource_group_level_with_http_info(resource_group_name, filter = nil, custom_headers = nil)
784
- list_at_resource_group_level_async(resource_group_name, filter, custom_headers).value!
883
+ def get_with_http_info(lock_name, custom_headers = nil)
884
+ get_async(lock_name, custom_headers).value!
785
885
  end
786
886
 
787
887
  #
788
- # Gets all the management locks of a resource group.
888
+ # Gets a management lock at the subscription level.
789
889
  #
790
- # @param resource_group_name [String] Resource group name.
791
- # @param filter [String] The filter to apply on the operation.
890
+ # @param lock_name [String] The name of the lock to get.
792
891
  # @param [Hash{String => String}] A hash of custom headers that will be added
793
892
  # to the HTTP request.
794
893
  #
795
894
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
796
895
  #
797
- def list_at_resource_group_level_async(resource_group_name, filter = nil, custom_headers = nil)
798
- fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
896
+ def get_async(lock_name, custom_headers = nil)
897
+ fail ArgumentError, 'lock_name is nil' if lock_name.nil?
799
898
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
800
899
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
801
900
 
@@ -805,14 +904,14 @@ module Azure::ARM::Locks
805
904
  # Set Headers
806
905
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
807
906
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
808
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks'
907
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
809
908
 
810
909
  request_url = @base_url || @client.base_url
811
910
 
812
911
  options = {
813
912
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
814
- path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
815
- query_params: {'$filter' => filter,'api-version' => @client.api_version},
913
+ path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
914
+ query_params: {'api-version' => @client.api_version},
816
915
  headers: request_headers.merge(custom_headers || {}),
817
916
  base_url: request_url
818
917
  }
@@ -832,7 +931,7 @@ module Azure::ARM::Locks
832
931
  if status_code == 200
833
932
  begin
834
933
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
835
- result_mapper = ManagementLockListResult.mapper()
934
+ result_mapper = ManagementLockObject.mapper()
836
935
  result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
837
936
  rescue Exception => e
838
937
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -846,92 +945,49 @@ module Azure::ARM::Locks
846
945
  end
847
946
 
848
947
  #
849
- # Gets all the management locks of a resource or any level below resource.
948
+ # Gets all the management locks for a resource group.
850
949
  #
851
- # @param resource_group_name [String] The name of the resource group. The name
852
- # is case insensitive.
853
- # @param resource_provider_namespace [String] Resource identity.
854
- # @param parent_resource_path [String] Resource identity.
855
- # @param resource_type [String] Resource identity.
856
- # @param resource_name [String] Resource identity.
857
- # @param filter [String] The filter to apply on the operation.
858
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
859
- # will be added to the HTTP request.
860
- #
861
- # @return [ManagementLockListResult] which provide lazy access to pages of the
862
- # response.
863
- #
864
- 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)
865
- response = list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers).value!
866
- unless response.nil?
867
- page = response.body
868
- page.next_method = Proc.new do |next_page_link|
869
- list_at_resource_level_next_async(next_page_link, custom_headers)
870
- end
871
- page
872
- end
873
- end
874
-
875
- #
876
- # Gets all the management locks of a resource or any level below resource.
877
- #
878
- # @param resource_group_name [String] The name of the resource group. The name
879
- # is case insensitive.
880
- # @param resource_provider_namespace [String] Resource identity.
881
- # @param parent_resource_path [String] Resource identity.
882
- # @param resource_type [String] Resource identity.
883
- # @param resource_name [String] Resource identity.
950
+ # @param resource_group_name [String] The name of the resource group containing
951
+ # the locks to get.
884
952
  # @param filter [String] The filter to apply on the operation.
885
953
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
886
954
  # will be added to the HTTP request.
887
955
  #
888
956
  # @return [Array<ManagementLockObject>] operation results.
889
957
  #
890
- def list_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
891
- first_page = list_at_resource_level_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers)
958
+ def list_at_resource_group_level(resource_group_name, filter = nil, custom_headers = nil)
959
+ first_page = list_at_resource_group_level_as_lazy(resource_group_name, filter, custom_headers)
892
960
  first_page.get_all_items
893
961
  end
894
962
 
895
963
  #
896
- # Gets all the management locks of a resource or any level below resource.
964
+ # Gets all the management locks for a resource group.
897
965
  #
898
- # @param resource_group_name [String] The name of the resource group. The name
899
- # is case insensitive.
900
- # @param resource_provider_namespace [String] Resource identity.
901
- # @param parent_resource_path [String] Resource identity.
902
- # @param resource_type [String] Resource identity.
903
- # @param resource_name [String] Resource identity.
966
+ # @param resource_group_name [String] The name of the resource group containing
967
+ # the locks to get.
904
968
  # @param filter [String] The filter to apply on the operation.
905
969
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
906
970
  # will be added to the HTTP request.
907
971
  #
908
972
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
909
973
  #
910
- def list_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
911
- list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers).value!
974
+ def list_at_resource_group_level_with_http_info(resource_group_name, filter = nil, custom_headers = nil)
975
+ list_at_resource_group_level_async(resource_group_name, filter, custom_headers).value!
912
976
  end
913
977
 
914
978
  #
915
- # Gets all the management locks of a resource or any level below resource.
979
+ # Gets all the management locks for a resource group.
916
980
  #
917
- # @param resource_group_name [String] The name of the resource group. The name
918
- # is case insensitive.
919
- # @param resource_provider_namespace [String] Resource identity.
920
- # @param parent_resource_path [String] Resource identity.
921
- # @param resource_type [String] Resource identity.
922
- # @param resource_name [String] Resource identity.
981
+ # @param resource_group_name [String] The name of the resource group containing
982
+ # the locks to get.
923
983
  # @param filter [String] The filter to apply on the operation.
924
984
  # @param [Hash{String => String}] A hash of custom headers that will be added
925
985
  # to the HTTP request.
926
986
  #
927
987
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
928
988
  #
929
- def list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
989
+ def list_at_resource_group_level_async(resource_group_name, filter = nil, custom_headers = nil)
930
990
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
931
- fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
932
- fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
933
- fail ArgumentError, 'resource_type is nil' if resource_type.nil?
934
- fail ArgumentError, 'resource_name is nil' if resource_name.nil?
935
991
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
936
992
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
937
993
 
@@ -941,14 +997,13 @@ module Azure::ARM::Locks
941
997
  # Set Headers
942
998
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
943
999
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
944
- path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks'
1000
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks'
945
1001
 
946
1002
  request_url = @base_url || @client.base_url
947
1003
 
948
1004
  options = {
949
1005
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
950
- path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
951
- skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
1006
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
952
1007
  query_params: {'$filter' => filter,'api-version' => @client.api_version},
953
1008
  headers: request_headers.merge(custom_headers || {}),
954
1009
  base_url: request_url
@@ -983,68 +1038,69 @@ module Azure::ARM::Locks
983
1038
  end
984
1039
 
985
1040
  #
986
- # Get a list of management locks at resource level or below.
987
- #
988
- # @param next_link [String] NextLink from the previous successful call to List
989
- # operation.
990
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
991
- # will be added to the HTTP request.
992
- #
993
- # @return [ManagementLockListResult] which provide lazy access to pages of the
994
- # response.
995
- #
996
- def list_next_as_lazy(next_link, custom_headers = nil)
997
- response = list_next_async(next_link, custom_headers).value!
998
- unless response.nil?
999
- page = response.body
1000
- page.next_method = Proc.new do |next_page_link|
1001
- list_next_next_async(next_page_link, custom_headers)
1002
- end
1003
- page
1004
- end
1005
- end
1006
-
1007
- #
1008
- # Get a list of management locks at resource level or below.
1041
+ # Gets all the management locks for a resource or any level below resource.
1009
1042
  #
1010
- # @param next_link [String] NextLink from the previous successful call to List
1011
- # operation.
1043
+ # @param resource_group_name [String] The name of the resource group containing
1044
+ # the locked resource. The name is case insensitive.
1045
+ # @param resource_provider_namespace [String] The namespace of the resource
1046
+ # provider.
1047
+ # @param parent_resource_path [String] The parent resource identity.
1048
+ # @param resource_type [String] The resource type of the locked resource.
1049
+ # @param resource_name [String] The name of the locked resource.
1050
+ # @param filter [String] The filter to apply on the operation.
1012
1051
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1013
1052
  # will be added to the HTTP request.
1014
1053
  #
1015
1054
  # @return [Array<ManagementLockObject>] operation results.
1016
1055
  #
1017
- def list_next(next_link, custom_headers = nil)
1018
- first_page = list_next_as_lazy(next_link, custom_headers)
1056
+ def list_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
1057
+ first_page = list_at_resource_level_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers)
1019
1058
  first_page.get_all_items
1020
1059
  end
1021
1060
 
1022
1061
  #
1023
- # Get a list of management locks at resource level or below.
1062
+ # Gets all the management locks for a resource or any level below resource.
1024
1063
  #
1025
- # @param next_link [String] NextLink from the previous successful call to List
1026
- # operation.
1064
+ # @param resource_group_name [String] The name of the resource group containing
1065
+ # the locked resource. The name is case insensitive.
1066
+ # @param resource_provider_namespace [String] The namespace of the resource
1067
+ # provider.
1068
+ # @param parent_resource_path [String] The parent resource identity.
1069
+ # @param resource_type [String] The resource type of the locked resource.
1070
+ # @param resource_name [String] The name of the locked resource.
1071
+ # @param filter [String] The filter to apply on the operation.
1027
1072
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1028
1073
  # will be added to the HTTP request.
1029
1074
  #
1030
1075
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1031
1076
  #
1032
- def list_next_with_http_info(next_link, custom_headers = nil)
1033
- list_next_async(next_link, custom_headers).value!
1077
+ def list_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
1078
+ list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers).value!
1034
1079
  end
1035
1080
 
1036
1081
  #
1037
- # Get a list of management locks at resource level or below.
1082
+ # Gets all the management locks for a resource or any level below resource.
1038
1083
  #
1039
- # @param next_link [String] NextLink from the previous successful call to List
1040
- # operation.
1084
+ # @param resource_group_name [String] The name of the resource group containing
1085
+ # the locked resource. The name is case insensitive.
1086
+ # @param resource_provider_namespace [String] The namespace of the resource
1087
+ # provider.
1088
+ # @param parent_resource_path [String] The parent resource identity.
1089
+ # @param resource_type [String] The resource type of the locked resource.
1090
+ # @param resource_name [String] The name of the locked resource.
1091
+ # @param filter [String] The filter to apply on the operation.
1041
1092
  # @param [Hash{String => String}] A hash of custom headers that will be added
1042
1093
  # to the HTTP request.
1043
1094
  #
1044
1095
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1045
1096
  #
1046
- def list_next_async(next_link, custom_headers = nil)
1047
- fail ArgumentError, 'next_link is nil' if next_link.nil?
1097
+ def list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
1098
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1099
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
1100
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
1101
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
1102
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1103
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1048
1104
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1049
1105
 
1050
1106
 
@@ -1053,14 +1109,15 @@ module Azure::ARM::Locks
1053
1109
  # Set Headers
1054
1110
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1055
1111
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1056
- path_template = '/{nextLink}'
1112
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks'
1057
1113
 
1058
1114
  request_url = @base_url || @client.base_url
1059
1115
 
1060
1116
  options = {
1061
1117
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1062
- path_params: {'subscriptionId' => @client.subscription_id},
1063
- skip_encoding_path_params: {'nextLink' => next_link},
1118
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
1119
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
1120
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
1064
1121
  headers: request_headers.merge(custom_headers || {}),
1065
1122
  base_url: request_url
1066
1123
  }
@@ -1094,28 +1151,7 @@ module Azure::ARM::Locks
1094
1151
  end
1095
1152
 
1096
1153
  #
1097
- # Gets all the management locks of a subscription.
1098
- #
1099
- # @param filter [String] The filter to apply on the operation.
1100
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
1101
- # will be added to the HTTP request.
1102
- #
1103
- # @return [ManagementLockListResult] which provide lazy access to pages of the
1104
- # response.
1105
- #
1106
- def list_at_subscription_level_as_lazy(filter = nil, custom_headers = nil)
1107
- response = list_at_subscription_level_async(filter, custom_headers).value!
1108
- unless response.nil?
1109
- page = response.body
1110
- page.next_method = Proc.new do |next_page_link|
1111
- list_at_subscription_level_next_async(next_page_link, custom_headers)
1112
- end
1113
- page
1114
- end
1115
- end
1116
-
1117
- #
1118
- # Gets all the management locks of a subscription.
1154
+ # Gets all the management locks for a subscription.
1119
1155
  #
1120
1156
  # @param filter [String] The filter to apply on the operation.
1121
1157
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
@@ -1129,7 +1165,7 @@ module Azure::ARM::Locks
1129
1165
  end
1130
1166
 
1131
1167
  #
1132
- # Gets all the management locks of a subscription.
1168
+ # Gets all the management locks for a subscription.
1133
1169
  #
1134
1170
  # @param filter [String] The filter to apply on the operation.
1135
1171
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
@@ -1142,7 +1178,7 @@ module Azure::ARM::Locks
1142
1178
  end
1143
1179
 
1144
1180
  #
1145
- # Gets all the management locks of a subscription.
1181
+ # Gets all the management locks for a subscription.
1146
1182
  #
1147
1183
  # @param filter [String] The filter to apply on the operation.
1148
1184
  # @param [Hash{String => String}] A hash of custom headers that will be added
@@ -1201,10 +1237,10 @@ module Azure::ARM::Locks
1201
1237
  end
1202
1238
 
1203
1239
  #
1204
- # Gets all the management locks of a resource group.
1240
+ # Gets all the management locks for a resource group.
1205
1241
  #
1206
- # @param next_page_link [String] The NextLink from the previous successful
1207
- # call to List operation.
1242
+ # @param next_page_link [String] The NextLink from the previous successful call
1243
+ # to List operation.
1208
1244
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1209
1245
  # will be added to the HTTP request.
1210
1246
  #
@@ -1216,10 +1252,10 @@ module Azure::ARM::Locks
1216
1252
  end
1217
1253
 
1218
1254
  #
1219
- # Gets all the management locks of a resource group.
1255
+ # Gets all the management locks for a resource group.
1220
1256
  #
1221
- # @param next_page_link [String] The NextLink from the previous successful
1222
- # call to List operation.
1257
+ # @param next_page_link [String] The NextLink from the previous successful call
1258
+ # to List operation.
1223
1259
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1224
1260
  # will be added to the HTTP request.
1225
1261
  #
@@ -1230,10 +1266,10 @@ module Azure::ARM::Locks
1230
1266
  end
1231
1267
 
1232
1268
  #
1233
- # Gets all the management locks of a resource group.
1269
+ # Gets all the management locks for a resource group.
1234
1270
  #
1235
- # @param next_page_link [String] The NextLink from the previous successful
1236
- # call to List operation.
1271
+ # @param next_page_link [String] The NextLink from the previous successful call
1272
+ # to List operation.
1237
1273
  # @param [Hash{String => String}] A hash of custom headers that will be added
1238
1274
  # to the HTTP request.
1239
1275
  #
@@ -1288,10 +1324,10 @@ module Azure::ARM::Locks
1288
1324
  end
1289
1325
 
1290
1326
  #
1291
- # Gets all the management locks of a resource or any level below resource.
1327
+ # Gets all the management locks for a resource or any level below resource.
1292
1328
  #
1293
- # @param next_page_link [String] The NextLink from the previous successful
1294
- # call to List operation.
1329
+ # @param next_page_link [String] The NextLink from the previous successful call
1330
+ # to List operation.
1295
1331
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1296
1332
  # will be added to the HTTP request.
1297
1333
  #
@@ -1303,10 +1339,10 @@ module Azure::ARM::Locks
1303
1339
  end
1304
1340
 
1305
1341
  #
1306
- # Gets all the management locks of a resource or any level below resource.
1342
+ # Gets all the management locks for a resource or any level below resource.
1307
1343
  #
1308
- # @param next_page_link [String] The NextLink from the previous successful
1309
- # call to List operation.
1344
+ # @param next_page_link [String] The NextLink from the previous successful call
1345
+ # to List operation.
1310
1346
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1311
1347
  # will be added to the HTTP request.
1312
1348
  #
@@ -1317,10 +1353,10 @@ module Azure::ARM::Locks
1317
1353
  end
1318
1354
 
1319
1355
  #
1320
- # Gets all the management locks of a resource or any level below resource.
1356
+ # Gets all the management locks for a resource or any level below resource.
1321
1357
  #
1322
- # @param next_page_link [String] The NextLink from the previous successful
1323
- # call to List operation.
1358
+ # @param next_page_link [String] The NextLink from the previous successful call
1359
+ # to List operation.
1324
1360
  # @param [Hash{String => String}] A hash of custom headers that will be added
1325
1361
  # to the HTTP request.
1326
1362
  #
@@ -1375,45 +1411,45 @@ module Azure::ARM::Locks
1375
1411
  end
1376
1412
 
1377
1413
  #
1378
- # Get a list of management locks at resource level or below.
1414
+ # Gets all the management locks for a subscription.
1379
1415
  #
1380
- # @param next_page_link [String] The NextLink from the previous successful
1381
- # call to List operation.
1416
+ # @param next_page_link [String] The NextLink from the previous successful call
1417
+ # to List operation.
1382
1418
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1383
1419
  # will be added to the HTTP request.
1384
1420
  #
1385
1421
  # @return [ManagementLockListResult] operation results.
1386
1422
  #
1387
- def list_next_next(next_page_link, custom_headers = nil)
1388
- response = list_next_next_async(next_page_link, custom_headers).value!
1423
+ def list_at_subscription_level_next(next_page_link, custom_headers = nil)
1424
+ response = list_at_subscription_level_next_async(next_page_link, custom_headers).value!
1389
1425
  response.body unless response.nil?
1390
1426
  end
1391
1427
 
1392
1428
  #
1393
- # Get a list of management locks at resource level or below.
1429
+ # Gets all the management locks for a subscription.
1394
1430
  #
1395
- # @param next_page_link [String] The NextLink from the previous successful
1396
- # call to List operation.
1431
+ # @param next_page_link [String] The NextLink from the previous successful call
1432
+ # to List operation.
1397
1433
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1398
1434
  # will be added to the HTTP request.
1399
1435
  #
1400
1436
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1401
1437
  #
1402
- def list_next_next_with_http_info(next_page_link, custom_headers = nil)
1403
- list_next_next_async(next_page_link, custom_headers).value!
1438
+ def list_at_subscription_level_next_with_http_info(next_page_link, custom_headers = nil)
1439
+ list_at_subscription_level_next_async(next_page_link, custom_headers).value!
1404
1440
  end
1405
1441
 
1406
1442
  #
1407
- # Get a list of management locks at resource level or below.
1443
+ # Gets all the management locks for a subscription.
1408
1444
  #
1409
- # @param next_page_link [String] The NextLink from the previous successful
1410
- # call to List operation.
1445
+ # @param next_page_link [String] The NextLink from the previous successful call
1446
+ # to List operation.
1411
1447
  # @param [Hash{String => String}] A hash of custom headers that will be added
1412
1448
  # to the HTTP request.
1413
1449
  #
1414
1450
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1415
1451
  #
1416
- def list_next_next_async(next_page_link, custom_headers = nil)
1452
+ def list_at_subscription_level_next_async(next_page_link, custom_headers = nil)
1417
1453
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1418
1454
 
1419
1455
 
@@ -1462,90 +1498,75 @@ module Azure::ARM::Locks
1462
1498
  end
1463
1499
 
1464
1500
  #
1465
- # Gets all the management locks of a subscription.
1501
+ # Gets all the management locks for a resource group.
1466
1502
  #
1467
- # @param next_page_link [String] The NextLink from the previous successful
1468
- # call to List operation.
1503
+ # @param resource_group_name [String] The name of the resource group containing
1504
+ # the locks to get.
1505
+ # @param filter [String] The filter to apply on the operation.
1469
1506
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1470
1507
  # will be added to the HTTP request.
1471
1508
  #
1472
- # @return [ManagementLockListResult] operation results.
1509
+ # @return [ManagementLockListResult] which provide lazy access to pages of the
1510
+ # response.
1473
1511
  #
1474
- def list_at_subscription_level_next(next_page_link, custom_headers = nil)
1475
- response = list_at_subscription_level_next_async(next_page_link, custom_headers).value!
1476
- response.body unless response.nil?
1512
+ def list_at_resource_group_level_as_lazy(resource_group_name, filter = nil, custom_headers = nil)
1513
+ response = list_at_resource_group_level_async(resource_group_name, filter, custom_headers).value!
1514
+ unless response.nil?
1515
+ page = response.body
1516
+ page.next_method = Proc.new do |next_page_link|
1517
+ list_at_resource_group_level_next_async(next_page_link, custom_headers)
1518
+ end
1519
+ page
1520
+ end
1477
1521
  end
1478
1522
 
1479
1523
  #
1480
- # Gets all the management locks of a subscription.
1524
+ # Gets all the management locks for a resource or any level below resource.
1481
1525
  #
1482
- # @param next_page_link [String] The NextLink from the previous successful
1483
- # call to List operation.
1526
+ # @param resource_group_name [String] The name of the resource group containing
1527
+ # the locked resource. The name is case insensitive.
1528
+ # @param resource_provider_namespace [String] The namespace of the resource
1529
+ # provider.
1530
+ # @param parent_resource_path [String] The parent resource identity.
1531
+ # @param resource_type [String] The resource type of the locked resource.
1532
+ # @param resource_name [String] The name of the locked resource.
1533
+ # @param filter [String] The filter to apply on the operation.
1484
1534
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1485
1535
  # will be added to the HTTP request.
1486
1536
  #
1487
- # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1537
+ # @return [ManagementLockListResult] which provide lazy access to pages of the
1538
+ # response.
1488
1539
  #
1489
- def list_at_subscription_level_next_with_http_info(next_page_link, custom_headers = nil)
1490
- list_at_subscription_level_next_async(next_page_link, custom_headers).value!
1540
+ 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)
1541
+ response = list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers).value!
1542
+ unless response.nil?
1543
+ page = response.body
1544
+ page.next_method = Proc.new do |next_page_link|
1545
+ list_at_resource_level_next_async(next_page_link, custom_headers)
1546
+ end
1547
+ page
1548
+ end
1491
1549
  end
1492
1550
 
1493
1551
  #
1494
- # Gets all the management locks of a subscription.
1552
+ # Gets all the management locks for a subscription.
1495
1553
  #
1496
- # @param next_page_link [String] The NextLink from the previous successful
1497
- # call to List operation.
1498
- # @param [Hash{String => String}] A hash of custom headers that will be added
1499
- # to the HTTP request.
1554
+ # @param filter [String] The filter to apply on the operation.
1555
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1556
+ # will be added to the HTTP request.
1500
1557
  #
1501
- # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1558
+ # @return [ManagementLockListResult] which provide lazy access to pages of the
1559
+ # response.
1502
1560
  #
1503
- def list_at_subscription_level_next_async(next_page_link, custom_headers = nil)
1504
- fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1505
-
1506
-
1507
- request_headers = {}
1508
-
1509
- # Set Headers
1510
- request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1511
- request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1512
- path_template = '{nextLink}'
1513
-
1514
- request_url = @base_url || @client.base_url
1515
-
1516
- options = {
1517
- middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1518
- skip_encoding_path_params: {'nextLink' => next_page_link},
1519
- headers: request_headers.merge(custom_headers || {}),
1520
- base_url: request_url
1521
- }
1522
- promise = @client.make_request_async(:get, path_template, options)
1523
-
1524
- promise = promise.then do |result|
1525
- http_response = result.response
1526
- status_code = http_response.status
1527
- response_content = http_response.body
1528
- unless status_code == 200
1529
- error_model = JSON.load(response_content)
1530
- fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1531
- end
1532
-
1533
- result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1534
- # Deserialize Response
1535
- if status_code == 200
1536
- begin
1537
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1538
- result_mapper = ManagementLockListResult.mapper()
1539
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1540
- rescue Exception => e
1541
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1542
- end
1561
+ def list_at_subscription_level_as_lazy(filter = nil, custom_headers = nil)
1562
+ response = list_at_subscription_level_async(filter, custom_headers).value!
1563
+ unless response.nil?
1564
+ page = response.body
1565
+ page.next_method = Proc.new do |next_page_link|
1566
+ list_at_subscription_level_next_async(next_page_link, custom_headers)
1543
1567
  end
1544
-
1545
- result
1568
+ page
1546
1569
  end
1547
-
1548
- promise.execute
1549
1570
  end
1550
1571
 
1551
1572
  end