azure_mgmt_locks 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +5 -0
- data/azure_mgmt_locks.gemspec +35 -0
- data/lib/azure_mgmt_locks.rb +34 -0
- data/lib/azure_mgmt_locks/lock_management_client.rb +68 -0
- data/lib/azure_mgmt_locks/management_locks.rb +1017 -0
- data/lib/azure_mgmt_locks/models/deployment_extended_filter.rb +56 -0
- data/lib/azure_mgmt_locks/models/generic_resource_filter.rb +74 -0
- data/lib/azure_mgmt_locks/models/lock_level.rb +17 -0
- data/lib/azure_mgmt_locks/models/management_lock_list_result.rb +85 -0
- data/lib/azure_mgmt_locks/models/management_lock_object.rb +90 -0
- data/lib/azure_mgmt_locks/models/management_lock_properties.rb +70 -0
- data/lib/azure_mgmt_locks/models/resource_group_filter.rb +65 -0
- data/lib/azure_mgmt_locks/module_definition.rb +8 -0
- data/lib/azure_mgmt_locks/version.rb +8 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dc81fa3a13daaa8ecd44292e6da7ec870aa0e30f
|
4
|
+
data.tar.gz: f6d40ecdbe7f8a89d2c02e60abda036a8a80c6e1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7e7f11aaaa41eb5f919b15bfc92443320dbe9a9170a9f7dff7d2f7992e8e2d02d0ee2fac28c5717aec5049ce2cebbd0c784b2e7122a4d38a81ec8222d3365a8a
|
7
|
+
data.tar.gz: 377258e943bb38df11e4099dd0f24c004efc41306d98b1b7cb16c9b12e1ee6a3f1ba54def8188211b2580623608fc94178d43f780f813a44d755ad86b2d52bd4
|
data/.rspec
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Microsoft Corporation
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
lib = File.expand_path('../lib', __FILE__)
|
6
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
|
+
|
8
|
+
require 'azure_mgmt_locks/module_definition'
|
9
|
+
require 'azure_mgmt_locks/version'
|
10
|
+
|
11
|
+
Gem::Specification.new do |spec|
|
12
|
+
spec.name = 'azure_mgmt_locks'
|
13
|
+
spec.version = Azure::ARM::Locks::VERSION
|
14
|
+
spec.authors = 'Microsoft Corporation'
|
15
|
+
spec.email = 'azrubyteam@microsoft.com'
|
16
|
+
spec.description = 'Microsoft Azure Resource Lock Management Client Library for Ruby'
|
17
|
+
spec.summary = 'Official Ruby client library to consume Microsoft Azure Resource Lock Management services.'
|
18
|
+
spec.homepage = 'http://github.com/azure/azure-sdk-for-ruby'
|
19
|
+
spec.license = 'MIT'
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = 'bin'
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ['lib']
|
25
|
+
|
26
|
+
spec.required_ruby_version = '>= 1.9.3'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.9'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3'
|
31
|
+
spec.add_development_dependency 'dotenv', '~> 2'
|
32
|
+
spec.add_development_dependency 'azure_mgmt_resources', '~> 0.2'
|
33
|
+
|
34
|
+
spec.add_runtime_dependency 'ms_rest_azure', '~> 0.2.0'
|
35
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
require 'uri'
|
7
|
+
require 'cgi'
|
8
|
+
require 'date'
|
9
|
+
require 'json'
|
10
|
+
require 'base64'
|
11
|
+
require 'erb'
|
12
|
+
require 'securerandom'
|
13
|
+
require 'time'
|
14
|
+
require 'timeliness'
|
15
|
+
require 'faraday'
|
16
|
+
require 'faraday-cookie_jar'
|
17
|
+
require 'concurrent'
|
18
|
+
require 'ms_rest'
|
19
|
+
require 'ms_rest_azure'
|
20
|
+
|
21
|
+
module Azure::ARM::Locks
|
22
|
+
autoload :ManagementLocks, 'azure_mgmt_locks/management_locks.rb'
|
23
|
+
autoload :LockManagementClient, 'azure_mgmt_locks/lock_management_client.rb'
|
24
|
+
|
25
|
+
module Models
|
26
|
+
autoload :DeploymentExtendedFilter, 'azure_mgmt_locks/models/deployment_extended_filter.rb'
|
27
|
+
autoload :GenericResourceFilter, 'azure_mgmt_locks/models/generic_resource_filter.rb'
|
28
|
+
autoload :ResourceGroupFilter, 'azure_mgmt_locks/models/resource_group_filter.rb'
|
29
|
+
autoload :ManagementLockProperties, 'azure_mgmt_locks/models/management_lock_properties.rb'
|
30
|
+
autoload :ManagementLockObject, 'azure_mgmt_locks/models/management_lock_object.rb'
|
31
|
+
autoload :ManagementLockListResult, 'azure_mgmt_locks/models/management_lock_list_result.rb'
|
32
|
+
autoload :LockLevel, 'azure_mgmt_locks/models/lock_level.rb'
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Locks
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class LockManagementClient < MsRestAzure::AzureServiceClient
|
11
|
+
include Azure::ARM::Locks::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_accessor :base_url
|
16
|
+
|
17
|
+
# @return Gets Azure subscription credentials.
|
18
|
+
attr_reader :credentials
|
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.
|
23
|
+
attr_accessor :subscription_id
|
24
|
+
|
25
|
+
# @return [String] Client Api Version.
|
26
|
+
attr_reader :api_version
|
27
|
+
|
28
|
+
# @return [String] Gets or sets the preferred language for the response.
|
29
|
+
attr_accessor :accept_language
|
30
|
+
|
31
|
+
# @return [Integer] Gets or sets the retry timeout in seconds for Long
|
32
|
+
# Running Operations. Default value is 30.
|
33
|
+
attr_accessor :long_running_operation_retry_timeout
|
34
|
+
|
35
|
+
# @return [Boolean] When set to true a unique x-ms-client-request-id value
|
36
|
+
# is generated and included in each request. Default is true.
|
37
|
+
attr_accessor :generate_client_request_id
|
38
|
+
|
39
|
+
# @return Subscription credentials which uniquely identify client
|
40
|
+
# subscription.
|
41
|
+
attr_accessor :credentials
|
42
|
+
|
43
|
+
# @return management_locks
|
44
|
+
attr_reader :management_locks
|
45
|
+
|
46
|
+
#
|
47
|
+
# Creates initializes a new instance of the LockManagementClient class.
|
48
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
49
|
+
# @param base_url [String] the base URI of the service.
|
50
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
51
|
+
#
|
52
|
+
def initialize(credentials, base_url = nil, options = nil)
|
53
|
+
super(credentials, options)
|
54
|
+
@base_url = base_url || 'https://management.azure.com'
|
55
|
+
|
56
|
+
fail ArgumentError, 'credentials is nil' if credentials.nil?
|
57
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
|
58
|
+
@credentials = credentials
|
59
|
+
|
60
|
+
@management_locks = ManagementLocks.new(self)
|
61
|
+
@api_version = '2015-01-01'
|
62
|
+
@accept_language = 'en-US'
|
63
|
+
@long_running_operation_retry_timeout = 30
|
64
|
+
@generate_client_request_id = true
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,1017 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Locks
|
7
|
+
#
|
8
|
+
# ManagementLocks
|
9
|
+
#
|
10
|
+
class ManagementLocks
|
11
|
+
include Azure::ARM::Locks::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the ManagementLocks class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return reference to the LockManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Create or update a management lock at the resource group level.
|
27
|
+
#
|
28
|
+
# @param resource_group_name [String] The resource group name.
|
29
|
+
# @param lock_name [String] The lock name.
|
30
|
+
# @param parameters [ManagementLockObject] The management lock parameters.
|
31
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
32
|
+
# applied to HTTP request.
|
33
|
+
#
|
34
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
35
|
+
# response.
|
36
|
+
#
|
37
|
+
def create_or_update_at_resource_group_level(resource_group_name, lock_name, parameters, custom_headers = nil)
|
38
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
39
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
40
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
41
|
+
parameters.validate unless parameters.nil?
|
42
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
43
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
44
|
+
request_headers = {}
|
45
|
+
|
46
|
+
# Set Headers
|
47
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
48
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
49
|
+
|
50
|
+
# Serialize Request
|
51
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
52
|
+
unless parameters.nil?
|
53
|
+
parameters = ManagementLockObject.serialize_object(parameters)
|
54
|
+
end
|
55
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
56
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}'
|
57
|
+
options = {
|
58
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
59
|
+
path_params: {'resourceGroupName' => resource_group_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
60
|
+
query_params: {'api-version' => @client.api_version},
|
61
|
+
body: request_content,
|
62
|
+
headers: request_headers.merge(custom_headers || {})
|
63
|
+
}
|
64
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
65
|
+
promise = request.run_promise do |req|
|
66
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
67
|
+
end
|
68
|
+
|
69
|
+
promise = promise.then do |http_response|
|
70
|
+
status_code = http_response.status
|
71
|
+
response_content = http_response.body
|
72
|
+
unless status_code == 200 || status_code == 201
|
73
|
+
error_model = JSON.load(response_content)
|
74
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Create Result
|
78
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
79
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
80
|
+
# Deserialize Response
|
81
|
+
if status_code == 200
|
82
|
+
begin
|
83
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
84
|
+
unless parsed_response.nil?
|
85
|
+
parsed_response = ManagementLockObject.deserialize_object(parsed_response)
|
86
|
+
end
|
87
|
+
result.body = parsed_response
|
88
|
+
rescue Exception => e
|
89
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
# Deserialize Response
|
93
|
+
if status_code == 201
|
94
|
+
begin
|
95
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
96
|
+
unless parsed_response.nil?
|
97
|
+
parsed_response = ManagementLockObject.deserialize_object(parsed_response)
|
98
|
+
end
|
99
|
+
result.body = parsed_response
|
100
|
+
rescue Exception => e
|
101
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
result
|
106
|
+
end
|
107
|
+
|
108
|
+
promise.execute
|
109
|
+
end
|
110
|
+
|
111
|
+
#
|
112
|
+
# Create or update a management lock at the resource level or any level below
|
113
|
+
# resource.
|
114
|
+
#
|
115
|
+
# @param resource_group_name [String] The name of the resource group.
|
116
|
+
# @param resource_provider_namespace [String] Resource identity.
|
117
|
+
# @param parent_resource_path [String] Resource identity.
|
118
|
+
# @param resource_type [String] Resource identity.
|
119
|
+
# @param resource_name [String] Resource identity.
|
120
|
+
# @param lock_name [String] The name of lock.
|
121
|
+
# @param parameters [ManagementLockObject] Create or update management lock
|
122
|
+
# parameters.
|
123
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
124
|
+
# applied to HTTP request.
|
125
|
+
#
|
126
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
127
|
+
# response.
|
128
|
+
#
|
129
|
+
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)
|
130
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
131
|
+
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
132
|
+
fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
|
133
|
+
fail ArgumentError, 'resource_type is nil' if resource_type.nil?
|
134
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
135
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
136
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
137
|
+
parameters.validate unless parameters.nil?
|
138
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
139
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
140
|
+
request_headers = {}
|
141
|
+
|
142
|
+
# Set Headers
|
143
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
144
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
145
|
+
|
146
|
+
# Serialize Request
|
147
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
148
|
+
unless parameters.nil?
|
149
|
+
parameters = ManagementLockObject.serialize_object(parameters)
|
150
|
+
end
|
151
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
152
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
|
153
|
+
options = {
|
154
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
155
|
+
path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
156
|
+
skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
|
157
|
+
query_params: {'api-version' => @client.api_version},
|
158
|
+
body: request_content,
|
159
|
+
headers: request_headers.merge(custom_headers || {})
|
160
|
+
}
|
161
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
162
|
+
promise = request.run_promise do |req|
|
163
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
164
|
+
end
|
165
|
+
|
166
|
+
promise = promise.then do |http_response|
|
167
|
+
status_code = http_response.status
|
168
|
+
response_content = http_response.body
|
169
|
+
unless status_code == 200 || status_code == 201
|
170
|
+
error_model = JSON.load(response_content)
|
171
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Create Result
|
175
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
176
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
177
|
+
# Deserialize Response
|
178
|
+
if status_code == 200
|
179
|
+
begin
|
180
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
181
|
+
unless parsed_response.nil?
|
182
|
+
parsed_response = ManagementLockObject.deserialize_object(parsed_response)
|
183
|
+
end
|
184
|
+
result.body = parsed_response
|
185
|
+
rescue Exception => e
|
186
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
# Deserialize Response
|
190
|
+
if status_code == 201
|
191
|
+
begin
|
192
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
193
|
+
unless parsed_response.nil?
|
194
|
+
parsed_response = ManagementLockObject.deserialize_object(parsed_response)
|
195
|
+
end
|
196
|
+
result.body = parsed_response
|
197
|
+
rescue Exception => e
|
198
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
result
|
203
|
+
end
|
204
|
+
|
205
|
+
promise.execute
|
206
|
+
end
|
207
|
+
|
208
|
+
#
|
209
|
+
# Deletes the management lock of a resource or any level below resource.
|
210
|
+
#
|
211
|
+
# @param resource_group_name [String] The name of the resource group.
|
212
|
+
# @param resource_provider_namespace [String] Resource identity.
|
213
|
+
# @param parent_resource_path [String] Resource identity.
|
214
|
+
# @param resource_type [String] Resource identity.
|
215
|
+
# @param resource_name [String] Resource identity.
|
216
|
+
# @param lock_name [String] The name of lock.
|
217
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
218
|
+
# applied to HTTP request.
|
219
|
+
#
|
220
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
221
|
+
# response.
|
222
|
+
#
|
223
|
+
def delete_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers = nil)
|
224
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
225
|
+
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
226
|
+
fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
|
227
|
+
fail ArgumentError, 'resource_type is nil' if resource_type.nil?
|
228
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
229
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
230
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
231
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
232
|
+
request_headers = {}
|
233
|
+
|
234
|
+
# Set Headers
|
235
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
236
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
237
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
|
238
|
+
options = {
|
239
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
240
|
+
path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
241
|
+
skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
|
242
|
+
query_params: {'api-version' => @client.api_version},
|
243
|
+
headers: request_headers.merge(custom_headers || {})
|
244
|
+
}
|
245
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
|
246
|
+
promise = request.run_promise do |req|
|
247
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
248
|
+
end
|
249
|
+
|
250
|
+
promise = promise.then do |http_response|
|
251
|
+
status_code = http_response.status
|
252
|
+
response_content = http_response.body
|
253
|
+
unless status_code == 204 || status_code == 200 || status_code == 202
|
254
|
+
error_model = JSON.load(response_content)
|
255
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
256
|
+
end
|
257
|
+
|
258
|
+
# Create Result
|
259
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
260
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
261
|
+
|
262
|
+
result
|
263
|
+
end
|
264
|
+
|
265
|
+
promise.execute
|
266
|
+
end
|
267
|
+
|
268
|
+
#
|
269
|
+
# Create or update a management lock at the subscription level.
|
270
|
+
#
|
271
|
+
# @param lock_name [String] The name of lock.
|
272
|
+
# @param parameters [ManagementLockObject] The management lock parameters.
|
273
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
274
|
+
# applied to HTTP request.
|
275
|
+
#
|
276
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
277
|
+
# response.
|
278
|
+
#
|
279
|
+
def create_or_update_at_subscription_level(lock_name, parameters, custom_headers = nil)
|
280
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
281
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
282
|
+
parameters.validate unless parameters.nil?
|
283
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
284
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
285
|
+
request_headers = {}
|
286
|
+
|
287
|
+
# Set Headers
|
288
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
289
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
290
|
+
|
291
|
+
# Serialize Request
|
292
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
293
|
+
unless parameters.nil?
|
294
|
+
parameters = ManagementLockObject.serialize_object(parameters)
|
295
|
+
end
|
296
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
297
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
|
298
|
+
options = {
|
299
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
300
|
+
path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
301
|
+
query_params: {'api-version' => @client.api_version},
|
302
|
+
body: request_content,
|
303
|
+
headers: request_headers.merge(custom_headers || {})
|
304
|
+
}
|
305
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
306
|
+
promise = request.run_promise do |req|
|
307
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
308
|
+
end
|
309
|
+
|
310
|
+
promise = promise.then do |http_response|
|
311
|
+
status_code = http_response.status
|
312
|
+
response_content = http_response.body
|
313
|
+
unless status_code == 201 || status_code == 200
|
314
|
+
error_model = JSON.load(response_content)
|
315
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
316
|
+
end
|
317
|
+
|
318
|
+
# Create Result
|
319
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
320
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
321
|
+
# Deserialize Response
|
322
|
+
if status_code == 201
|
323
|
+
begin
|
324
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
325
|
+
unless parsed_response.nil?
|
326
|
+
parsed_response = ManagementLockObject.deserialize_object(parsed_response)
|
327
|
+
end
|
328
|
+
result.body = parsed_response
|
329
|
+
rescue Exception => e
|
330
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
# Deserialize Response
|
334
|
+
if status_code == 200
|
335
|
+
begin
|
336
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
337
|
+
unless parsed_response.nil?
|
338
|
+
parsed_response = ManagementLockObject.deserialize_object(parsed_response)
|
339
|
+
end
|
340
|
+
result.body = parsed_response
|
341
|
+
rescue Exception => e
|
342
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
result
|
347
|
+
end
|
348
|
+
|
349
|
+
promise.execute
|
350
|
+
end
|
351
|
+
|
352
|
+
#
|
353
|
+
# Deletes the management lock of a subscription.
|
354
|
+
#
|
355
|
+
# @param lock_name [String] The name of lock.
|
356
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
357
|
+
# applied to HTTP request.
|
358
|
+
#
|
359
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
360
|
+
# response.
|
361
|
+
#
|
362
|
+
def delete_at_subscription_level(lock_name, custom_headers = nil)
|
363
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
364
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
365
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
366
|
+
request_headers = {}
|
367
|
+
|
368
|
+
# Set Headers
|
369
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
370
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
371
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
|
372
|
+
options = {
|
373
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
374
|
+
path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
375
|
+
query_params: {'api-version' => @client.api_version},
|
376
|
+
headers: request_headers.merge(custom_headers || {})
|
377
|
+
}
|
378
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
|
379
|
+
promise = request.run_promise do |req|
|
380
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
381
|
+
end
|
382
|
+
|
383
|
+
promise = promise.then do |http_response|
|
384
|
+
status_code = http_response.status
|
385
|
+
response_content = http_response.body
|
386
|
+
unless status_code == 204 || status_code == 200 || status_code == 202
|
387
|
+
error_model = JSON.load(response_content)
|
388
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
389
|
+
end
|
390
|
+
|
391
|
+
# Create Result
|
392
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
393
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
394
|
+
|
395
|
+
result
|
396
|
+
end
|
397
|
+
|
398
|
+
promise.execute
|
399
|
+
end
|
400
|
+
|
401
|
+
#
|
402
|
+
# Gets the management lock of a scope.
|
403
|
+
#
|
404
|
+
# @param lock_name [String] Name of the management lock.
|
405
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
406
|
+
# applied to HTTP request.
|
407
|
+
#
|
408
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
409
|
+
# response.
|
410
|
+
#
|
411
|
+
def get(lock_name, custom_headers = nil)
|
412
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
413
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
414
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
415
|
+
request_headers = {}
|
416
|
+
|
417
|
+
# Set Headers
|
418
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
419
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
420
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
|
421
|
+
options = {
|
422
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
423
|
+
path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
424
|
+
query_params: {'api-version' => @client.api_version},
|
425
|
+
headers: request_headers.merge(custom_headers || {})
|
426
|
+
}
|
427
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
428
|
+
promise = request.run_promise do |req|
|
429
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
430
|
+
end
|
431
|
+
|
432
|
+
promise = promise.then do |http_response|
|
433
|
+
status_code = http_response.status
|
434
|
+
response_content = http_response.body
|
435
|
+
unless status_code == 200 || status_code == 204
|
436
|
+
error_model = JSON.load(response_content)
|
437
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
438
|
+
end
|
439
|
+
|
440
|
+
# Create Result
|
441
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
442
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
443
|
+
# Deserialize Response
|
444
|
+
if status_code == 200
|
445
|
+
begin
|
446
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
447
|
+
unless parsed_response.nil?
|
448
|
+
parsed_response = ManagementLockObject.deserialize_object(parsed_response)
|
449
|
+
end
|
450
|
+
result.body = parsed_response
|
451
|
+
rescue Exception => e
|
452
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
453
|
+
end
|
454
|
+
end
|
455
|
+
# Deserialize Response
|
456
|
+
if status_code == 204
|
457
|
+
begin
|
458
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
459
|
+
unless parsed_response.nil?
|
460
|
+
parsed_response = ManagementLockObject.deserialize_object(parsed_response)
|
461
|
+
end
|
462
|
+
result.body = parsed_response
|
463
|
+
rescue Exception => e
|
464
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
result
|
469
|
+
end
|
470
|
+
|
471
|
+
promise.execute
|
472
|
+
end
|
473
|
+
|
474
|
+
#
|
475
|
+
# Deletes the management lock of a resource group.
|
476
|
+
#
|
477
|
+
# @param resource_group [String] The resource group names.
|
478
|
+
# @param lock_name [String] The name of lock.
|
479
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
480
|
+
# applied to HTTP request.
|
481
|
+
#
|
482
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
483
|
+
# response.
|
484
|
+
#
|
485
|
+
def delete_at_resource_group_level(resource_group, lock_name, custom_headers = nil)
|
486
|
+
fail ArgumentError, 'resource_group is nil' if resource_group.nil?
|
487
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
488
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
489
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
490
|
+
request_headers = {}
|
491
|
+
|
492
|
+
# Set Headers
|
493
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
494
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
495
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Authorization/locks/{lockName}'
|
496
|
+
options = {
|
497
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
498
|
+
path_params: {'resourceGroup' => resource_group,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
499
|
+
query_params: {'api-version' => @client.api_version},
|
500
|
+
headers: request_headers.merge(custom_headers || {})
|
501
|
+
}
|
502
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
|
503
|
+
promise = request.run_promise do |req|
|
504
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
505
|
+
end
|
506
|
+
|
507
|
+
promise = promise.then do |http_response|
|
508
|
+
status_code = http_response.status
|
509
|
+
response_content = http_response.body
|
510
|
+
unless status_code == 204 || status_code == 200 || status_code == 202
|
511
|
+
error_model = JSON.load(response_content)
|
512
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
513
|
+
end
|
514
|
+
|
515
|
+
# Create Result
|
516
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
517
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
518
|
+
|
519
|
+
result
|
520
|
+
end
|
521
|
+
|
522
|
+
promise.execute
|
523
|
+
end
|
524
|
+
|
525
|
+
#
|
526
|
+
# Gets all the management locks of a resource group.
|
527
|
+
#
|
528
|
+
# @param resource_group_name [String] Resource group name.
|
529
|
+
# @param filter [String] The filter to apply on the operation.
|
530
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
531
|
+
# applied to HTTP request.
|
532
|
+
#
|
533
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
534
|
+
# response.
|
535
|
+
#
|
536
|
+
def list_at_resource_group_level(resource_group_name, filter = nil, custom_headers = nil)
|
537
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
538
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
539
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
540
|
+
request_headers = {}
|
541
|
+
|
542
|
+
# Set Headers
|
543
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
544
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
545
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks'
|
546
|
+
options = {
|
547
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
548
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
549
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
550
|
+
headers: request_headers.merge(custom_headers || {})
|
551
|
+
}
|
552
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
553
|
+
promise = request.run_promise do |req|
|
554
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
555
|
+
end
|
556
|
+
|
557
|
+
promise = promise.then do |http_response|
|
558
|
+
status_code = http_response.status
|
559
|
+
response_content = http_response.body
|
560
|
+
unless status_code == 200
|
561
|
+
error_model = JSON.load(response_content)
|
562
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
563
|
+
end
|
564
|
+
|
565
|
+
# Create Result
|
566
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
567
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
568
|
+
# Deserialize Response
|
569
|
+
if status_code == 200
|
570
|
+
begin
|
571
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
572
|
+
unless parsed_response.nil?
|
573
|
+
parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
|
574
|
+
end
|
575
|
+
result.body = parsed_response
|
576
|
+
rescue Exception => e
|
577
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
578
|
+
end
|
579
|
+
end
|
580
|
+
|
581
|
+
result
|
582
|
+
end
|
583
|
+
|
584
|
+
promise.execute
|
585
|
+
end
|
586
|
+
|
587
|
+
#
|
588
|
+
# Gets all the management locks of a resource or any level below resource.
|
589
|
+
#
|
590
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
591
|
+
# is case insensitive.
|
592
|
+
# @param resource_provider_namespace [String] Resource identity.
|
593
|
+
# @param parent_resource_path [String] Resource identity.
|
594
|
+
# @param resource_type [String] Resource identity.
|
595
|
+
# @param resource_name [String] Resource identity.
|
596
|
+
# @param filter [String] The filter to apply on the operation.
|
597
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
598
|
+
# applied to HTTP request.
|
599
|
+
#
|
600
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
601
|
+
# response.
|
602
|
+
#
|
603
|
+
def list_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
|
604
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
605
|
+
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
606
|
+
fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
|
607
|
+
fail ArgumentError, 'resource_type is nil' if resource_type.nil?
|
608
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
609
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
610
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
611
|
+
request_headers = {}
|
612
|
+
|
613
|
+
# Set Headers
|
614
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
615
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
616
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks'
|
617
|
+
options = {
|
618
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
619
|
+
path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
|
620
|
+
skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
|
621
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
622
|
+
headers: request_headers.merge(custom_headers || {})
|
623
|
+
}
|
624
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
625
|
+
promise = request.run_promise do |req|
|
626
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
627
|
+
end
|
628
|
+
|
629
|
+
promise = promise.then do |http_response|
|
630
|
+
status_code = http_response.status
|
631
|
+
response_content = http_response.body
|
632
|
+
unless status_code == 200
|
633
|
+
error_model = JSON.load(response_content)
|
634
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
635
|
+
end
|
636
|
+
|
637
|
+
# Create Result
|
638
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
639
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
640
|
+
# Deserialize Response
|
641
|
+
if status_code == 200
|
642
|
+
begin
|
643
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
644
|
+
unless parsed_response.nil?
|
645
|
+
parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
|
646
|
+
end
|
647
|
+
result.body = parsed_response
|
648
|
+
rescue Exception => e
|
649
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
650
|
+
end
|
651
|
+
end
|
652
|
+
|
653
|
+
result
|
654
|
+
end
|
655
|
+
|
656
|
+
promise.execute
|
657
|
+
end
|
658
|
+
|
659
|
+
#
|
660
|
+
# Get a list of management locks at resource level or below.
|
661
|
+
#
|
662
|
+
# @param next_link [String] NextLink from the previous successful call to List
|
663
|
+
# operation.
|
664
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
665
|
+
# applied to HTTP request.
|
666
|
+
#
|
667
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
668
|
+
# response.
|
669
|
+
#
|
670
|
+
def list_next(next_link, custom_headers = nil)
|
671
|
+
fail ArgumentError, 'next_link is nil' if next_link.nil?
|
672
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
673
|
+
request_headers = {}
|
674
|
+
|
675
|
+
# Set Headers
|
676
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
677
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
678
|
+
path_template = '/{nextLink}'
|
679
|
+
options = {
|
680
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
681
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
682
|
+
skip_encoding_path_params: {'nextLink' => next_link},
|
683
|
+
headers: request_headers.merge(custom_headers || {})
|
684
|
+
}
|
685
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
686
|
+
promise = request.run_promise do |req|
|
687
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
688
|
+
end
|
689
|
+
|
690
|
+
promise = promise.then do |http_response|
|
691
|
+
status_code = http_response.status
|
692
|
+
response_content = http_response.body
|
693
|
+
unless status_code == 200
|
694
|
+
error_model = JSON.load(response_content)
|
695
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
696
|
+
end
|
697
|
+
|
698
|
+
# Create Result
|
699
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
700
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
701
|
+
# Deserialize Response
|
702
|
+
if status_code == 200
|
703
|
+
begin
|
704
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
705
|
+
unless parsed_response.nil?
|
706
|
+
parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
|
707
|
+
end
|
708
|
+
result.body = parsed_response
|
709
|
+
rescue Exception => e
|
710
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
711
|
+
end
|
712
|
+
end
|
713
|
+
|
714
|
+
result
|
715
|
+
end
|
716
|
+
|
717
|
+
promise.execute
|
718
|
+
end
|
719
|
+
|
720
|
+
#
|
721
|
+
# Gets all the management locks of a subscription.
|
722
|
+
#
|
723
|
+
# @param filter [String] The filter to apply on the operation.
|
724
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
725
|
+
# applied to HTTP request.
|
726
|
+
#
|
727
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
728
|
+
# response.
|
729
|
+
#
|
730
|
+
def list_at_subscription_level(filter = nil, custom_headers = nil)
|
731
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
732
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
733
|
+
request_headers = {}
|
734
|
+
|
735
|
+
# Set Headers
|
736
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
737
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
738
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks'
|
739
|
+
options = {
|
740
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
741
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
742
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
743
|
+
headers: request_headers.merge(custom_headers || {})
|
744
|
+
}
|
745
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
746
|
+
promise = request.run_promise do |req|
|
747
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
748
|
+
end
|
749
|
+
|
750
|
+
promise = promise.then do |http_response|
|
751
|
+
status_code = http_response.status
|
752
|
+
response_content = http_response.body
|
753
|
+
unless status_code == 200
|
754
|
+
error_model = JSON.load(response_content)
|
755
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
756
|
+
end
|
757
|
+
|
758
|
+
# Create Result
|
759
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
760
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
761
|
+
# Deserialize Response
|
762
|
+
if status_code == 200
|
763
|
+
begin
|
764
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
765
|
+
unless parsed_response.nil?
|
766
|
+
parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
|
767
|
+
end
|
768
|
+
result.body = parsed_response
|
769
|
+
rescue Exception => e
|
770
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
771
|
+
end
|
772
|
+
end
|
773
|
+
|
774
|
+
result
|
775
|
+
end
|
776
|
+
|
777
|
+
promise.execute
|
778
|
+
end
|
779
|
+
|
780
|
+
#
|
781
|
+
# Gets all the management locks of a resource group.
|
782
|
+
#
|
783
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
784
|
+
# call to List operation.
|
785
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
786
|
+
# applied to HTTP request.
|
787
|
+
#
|
788
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
789
|
+
# response.
|
790
|
+
#
|
791
|
+
def list_at_resource_group_level_next(next_page_link, custom_headers = nil)
|
792
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
793
|
+
request_headers = {}
|
794
|
+
|
795
|
+
# Set Headers
|
796
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
797
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
798
|
+
path_template = '{nextLink}'
|
799
|
+
options = {
|
800
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
801
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
802
|
+
headers: request_headers.merge(custom_headers || {})
|
803
|
+
}
|
804
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
805
|
+
promise = request.run_promise do |req|
|
806
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
807
|
+
end
|
808
|
+
|
809
|
+
promise = promise.then do |http_response|
|
810
|
+
status_code = http_response.status
|
811
|
+
response_content = http_response.body
|
812
|
+
unless status_code == 200
|
813
|
+
error_model = JSON.load(response_content)
|
814
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
815
|
+
end
|
816
|
+
|
817
|
+
# Create Result
|
818
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
819
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
820
|
+
# Deserialize Response
|
821
|
+
if status_code == 200
|
822
|
+
begin
|
823
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
824
|
+
unless parsed_response.nil?
|
825
|
+
parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
|
826
|
+
end
|
827
|
+
result.body = parsed_response
|
828
|
+
rescue Exception => e
|
829
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
830
|
+
end
|
831
|
+
end
|
832
|
+
|
833
|
+
result
|
834
|
+
end
|
835
|
+
|
836
|
+
promise.execute
|
837
|
+
end
|
838
|
+
|
839
|
+
#
|
840
|
+
# Gets all the management locks of a resource or any level below resource.
|
841
|
+
#
|
842
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
843
|
+
# call to List operation.
|
844
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
845
|
+
# applied to HTTP request.
|
846
|
+
#
|
847
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
848
|
+
# response.
|
849
|
+
#
|
850
|
+
def list_at_resource_level_next(next_page_link, custom_headers = nil)
|
851
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
852
|
+
request_headers = {}
|
853
|
+
|
854
|
+
# Set Headers
|
855
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
856
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
857
|
+
path_template = '{nextLink}'
|
858
|
+
options = {
|
859
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
860
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
861
|
+
headers: request_headers.merge(custom_headers || {})
|
862
|
+
}
|
863
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
864
|
+
promise = request.run_promise do |req|
|
865
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
866
|
+
end
|
867
|
+
|
868
|
+
promise = promise.then do |http_response|
|
869
|
+
status_code = http_response.status
|
870
|
+
response_content = http_response.body
|
871
|
+
unless status_code == 200
|
872
|
+
error_model = JSON.load(response_content)
|
873
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
874
|
+
end
|
875
|
+
|
876
|
+
# Create Result
|
877
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
878
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
879
|
+
# Deserialize Response
|
880
|
+
if status_code == 200
|
881
|
+
begin
|
882
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
883
|
+
unless parsed_response.nil?
|
884
|
+
parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
|
885
|
+
end
|
886
|
+
result.body = parsed_response
|
887
|
+
rescue Exception => e
|
888
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
889
|
+
end
|
890
|
+
end
|
891
|
+
|
892
|
+
result
|
893
|
+
end
|
894
|
+
|
895
|
+
promise.execute
|
896
|
+
end
|
897
|
+
|
898
|
+
#
|
899
|
+
# Get a list of management locks at resource level or below.
|
900
|
+
#
|
901
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
902
|
+
# call to List operation.
|
903
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
904
|
+
# applied to HTTP request.
|
905
|
+
#
|
906
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
907
|
+
# response.
|
908
|
+
#
|
909
|
+
def list_next_next(next_page_link, custom_headers = nil)
|
910
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
911
|
+
request_headers = {}
|
912
|
+
|
913
|
+
# Set Headers
|
914
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
915
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
916
|
+
path_template = '{nextLink}'
|
917
|
+
options = {
|
918
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
919
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
920
|
+
headers: request_headers.merge(custom_headers || {})
|
921
|
+
}
|
922
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
923
|
+
promise = request.run_promise do |req|
|
924
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
925
|
+
end
|
926
|
+
|
927
|
+
promise = promise.then do |http_response|
|
928
|
+
status_code = http_response.status
|
929
|
+
response_content = http_response.body
|
930
|
+
unless status_code == 200
|
931
|
+
error_model = JSON.load(response_content)
|
932
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
933
|
+
end
|
934
|
+
|
935
|
+
# Create Result
|
936
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
937
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
938
|
+
# Deserialize Response
|
939
|
+
if status_code == 200
|
940
|
+
begin
|
941
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
942
|
+
unless parsed_response.nil?
|
943
|
+
parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
|
944
|
+
end
|
945
|
+
result.body = parsed_response
|
946
|
+
rescue Exception => e
|
947
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
948
|
+
end
|
949
|
+
end
|
950
|
+
|
951
|
+
result
|
952
|
+
end
|
953
|
+
|
954
|
+
promise.execute
|
955
|
+
end
|
956
|
+
|
957
|
+
#
|
958
|
+
# Gets all the management locks of a subscription.
|
959
|
+
#
|
960
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
961
|
+
# call to List operation.
|
962
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
963
|
+
# applied to HTTP request.
|
964
|
+
#
|
965
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
966
|
+
# response.
|
967
|
+
#
|
968
|
+
def list_at_subscription_level_next(next_page_link, custom_headers = nil)
|
969
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
970
|
+
request_headers = {}
|
971
|
+
|
972
|
+
# Set Headers
|
973
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
974
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
975
|
+
path_template = '{nextLink}'
|
976
|
+
options = {
|
977
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
978
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
979
|
+
headers: request_headers.merge(custom_headers || {})
|
980
|
+
}
|
981
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
982
|
+
promise = request.run_promise do |req|
|
983
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
984
|
+
end
|
985
|
+
|
986
|
+
promise = promise.then do |http_response|
|
987
|
+
status_code = http_response.status
|
988
|
+
response_content = http_response.body
|
989
|
+
unless status_code == 200
|
990
|
+
error_model = JSON.load(response_content)
|
991
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
992
|
+
end
|
993
|
+
|
994
|
+
# Create Result
|
995
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
996
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
997
|
+
# Deserialize Response
|
998
|
+
if status_code == 200
|
999
|
+
begin
|
1000
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1001
|
+
unless parsed_response.nil?
|
1002
|
+
parsed_response = ManagementLockListResult.deserialize_object(parsed_response)
|
1003
|
+
end
|
1004
|
+
result.body = parsed_response
|
1005
|
+
rescue Exception => e
|
1006
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1007
|
+
end
|
1008
|
+
end
|
1009
|
+
|
1010
|
+
result
|
1011
|
+
end
|
1012
|
+
|
1013
|
+
promise.execute
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
end
|
1017
|
+
end
|