azure_mgmt_locks 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/2015-01-01/generated/azure_mgmt_locks.rb +31 -0
- data/lib/2015-01-01/generated/azure_mgmt_locks/management_lock_client.rb +131 -0
- data/lib/2015-01-01/generated/azure_mgmt_locks/management_locks.rb +1434 -0
- data/lib/{generated → 2015-01-01/generated}/azure_mgmt_locks/models/lock_level.rb +1 -1
- data/lib/2015-01-01/generated/azure_mgmt_locks/models/management_lock_list_result.rb +94 -0
- data/lib/2015-01-01/generated/azure_mgmt_locks/models/management_lock_object.rb +85 -0
- data/lib/2015-01-01/generated/azure_mgmt_locks/module_definition.rb +9 -0
- data/lib/{generated → 2015-01-01/generated}/azure_mgmt_locks/version.rb +2 -2
- data/lib/{generated → 2016-09-01/generated}/azure_mgmt_locks.rb +8 -8
- data/lib/{generated → 2016-09-01/generated}/azure_mgmt_locks/management_lock_client.rb +3 -3
- data/lib/{generated → 2016-09-01/generated}/azure_mgmt_locks/management_locks.rb +23 -23
- data/lib/2016-09-01/generated/azure_mgmt_locks/models/lock_level.rb +17 -0
- data/lib/{generated → 2016-09-01/generated}/azure_mgmt_locks/models/management_lock_list_result.rb +1 -1
- data/lib/{generated → 2016-09-01/generated}/azure_mgmt_locks/models/management_lock_object.rb +1 -1
- data/lib/{generated → 2016-09-01/generated}/azure_mgmt_locks/models/management_lock_owner.rb +1 -1
- data/lib/2016-09-01/generated/azure_mgmt_locks/module_definition.rb +9 -0
- data/lib/{generated/azure_mgmt_locks/module_definition.rb → 2016-09-01/generated/azure_mgmt_locks/version.rb} +3 -3
- data/lib/azure_mgmt_locks.rb +4 -1
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/common/configurable.rb +73 -0
- data/lib/profiles/common/default.rb +68 -0
- data/lib/profiles/latest/locks_latest_profile_client.rb +33 -0
- data/lib/profiles/latest/locks_module_definition.rb +9 -0
- data/lib/profiles/latest/modules/locks_profile_module.rb +58 -0
- data/lib/profiles/v2017_03_09/locks_module_definition.rb +9 -0
- data/lib/profiles/v2017_03_09/locks_v2017_03_09_profile_client.rb +33 -0
- data/lib/profiles/v2017_03_09/modules/locks_profile_module.rb +54 -0
- data/lib/version.rb +7 -0
- metadata +29 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9650e91f9c8b2087717fc2b0554ea48a9eee74c8
|
4
|
+
data.tar.gz: cd8c3cc557daae41754bacd276c79eaef1eb1fc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87ff20e38cafec974b2a17c3f1815109e97d4542164dc4c036da4b636cc32d5054d50f2c218d951e9c439987c2523e7eb4735267e7a1ddb841c02e5ba5da4124
|
7
|
+
data.tar.gz: 23bf35b164e7893268b4b24c8aafbb2b1968c9c485375bb1fd7d96f975ee67d2a1dfaa7558f33750dc1822c22ccb068304aece6136d9156336a32cd6e29e4cc7
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
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 '2015-01-01/generated/azure_mgmt_locks/module_definition'
|
20
|
+
require 'ms_rest_azure'
|
21
|
+
|
22
|
+
module Azure::Locks::Mgmt::V2015_01_01
|
23
|
+
autoload :ManagementLocks, '2015-01-01/generated/azure_mgmt_locks/management_locks.rb'
|
24
|
+
autoload :ManagementLockClient, '2015-01-01/generated/azure_mgmt_locks/management_lock_client.rb'
|
25
|
+
|
26
|
+
module Models
|
27
|
+
autoload :ManagementLockListResult, '2015-01-01/generated/azure_mgmt_locks/models/management_lock_list_result.rb'
|
28
|
+
autoload :ManagementLockObject, '2015-01-01/generated/azure_mgmt_locks/models/management_lock_object.rb'
|
29
|
+
autoload :LockLevel, '2015-01-01/generated/azure_mgmt_locks/models/lock_level.rb'
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::Locks::Mgmt::V2015_01_01
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class ManagementLockClient < MsRestAzure::AzureServiceClient
|
11
|
+
include MsRestAzure
|
12
|
+
include MsRestAzure::Serialization
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_accessor :base_url
|
16
|
+
|
17
|
+
# @return Credentials needed for the client to connect to Azure.
|
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 [ManagementLocks] management_locks
|
40
|
+
attr_reader :management_locks
|
41
|
+
|
42
|
+
#
|
43
|
+
# Creates initializes a new instance of the ManagementLockClient class.
|
44
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
45
|
+
# @param base_url [String] the base URI of the service.
|
46
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
47
|
+
#
|
48
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
49
|
+
super(credentials, options)
|
50
|
+
@base_url = base_url || 'https://management.azure.com'
|
51
|
+
|
52
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
53
|
+
@credentials = credentials
|
54
|
+
|
55
|
+
@management_locks = ManagementLocks.new(self)
|
56
|
+
@api_version = '2015-01-01'
|
57
|
+
@accept_language = 'en-US'
|
58
|
+
@long_running_operation_retry_timeout = 30
|
59
|
+
@generate_client_request_id = true
|
60
|
+
add_telemetry
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Makes a request and returns the body of the response.
|
65
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
66
|
+
# @param path [String] the path, relative to {base_url}.
|
67
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
68
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
69
|
+
# Example:
|
70
|
+
#
|
71
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
72
|
+
# path = "/path"
|
73
|
+
# options = {
|
74
|
+
# body: request_content,
|
75
|
+
# query_params: {'api-version' => '2016-02-01'}
|
76
|
+
# }
|
77
|
+
# result = @client.make_request(:put, path, options)
|
78
|
+
#
|
79
|
+
def make_request(method, path, options = {})
|
80
|
+
result = make_request_with_http_info(method, path, options)
|
81
|
+
result.body unless result.nil?
|
82
|
+
end
|
83
|
+
|
84
|
+
#
|
85
|
+
# Makes a request and returns the operation response.
|
86
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
87
|
+
# @param path [String] the path, relative to {base_url}.
|
88
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
89
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
90
|
+
#
|
91
|
+
def make_request_with_http_info(method, path, options = {})
|
92
|
+
result = make_request_async(method, path, options).value!
|
93
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
94
|
+
result
|
95
|
+
end
|
96
|
+
|
97
|
+
#
|
98
|
+
# Makes a request asynchronously.
|
99
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
100
|
+
# @param path [String] the path, relative to {base_url}.
|
101
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
102
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
103
|
+
#
|
104
|
+
def make_request_async(method, path, options = {})
|
105
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
106
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
107
|
+
|
108
|
+
request_url = options[:base_url] || @base_url
|
109
|
+
|
110
|
+
request_headers = @request_headers
|
111
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
112
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
113
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
114
|
+
|
115
|
+
super(request_url, method, path, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
private
|
120
|
+
#
|
121
|
+
# Adds telemetry information.
|
122
|
+
#
|
123
|
+
def add_telemetry
|
124
|
+
sdk_information = 'azure_mgmt_locks'
|
125
|
+
if defined? Azure::Locks::Mgmt::V2015_01_01::VERSION
|
126
|
+
sdk_information = "#{sdk_information}/#{Azure::Locks::Mgmt::V2015_01_01::VERSION}"
|
127
|
+
end
|
128
|
+
add_user_agent_information(sdk_information)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,1434 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::Locks::Mgmt::V2015_01_01
|
7
|
+
#
|
8
|
+
# ManagementLocks
|
9
|
+
#
|
10
|
+
class ManagementLocks
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the ManagementLocks class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [ManagementLockClient] reference to the ManagementLockClient
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# Create or update a management lock at the resource group level.
|
26
|
+
#
|
27
|
+
# @param resource_group_name [String] The resource group name.
|
28
|
+
# @param lock_name [String] The lock name.
|
29
|
+
# @param parameters [ManagementLockObject] The management lock parameters.
|
30
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
31
|
+
# will be added to the HTTP request.
|
32
|
+
#
|
33
|
+
# @return [ManagementLockObject] operation results.
|
34
|
+
#
|
35
|
+
def create_or_update_at_resource_group_level(resource_group_name, lock_name, parameters, custom_headers = nil)
|
36
|
+
response = create_or_update_at_resource_group_level_async(resource_group_name, lock_name, parameters, custom_headers).value!
|
37
|
+
response.body unless response.nil?
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Create or update a management lock at the resource group level.
|
42
|
+
#
|
43
|
+
# @param resource_group_name [String] The resource group name.
|
44
|
+
# @param lock_name [String] The lock name.
|
45
|
+
# @param parameters [ManagementLockObject] The management lock parameters.
|
46
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
47
|
+
# will be added to the HTTP request.
|
48
|
+
#
|
49
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
50
|
+
#
|
51
|
+
def create_or_update_at_resource_group_level_with_http_info(resource_group_name, lock_name, parameters, custom_headers = nil)
|
52
|
+
create_or_update_at_resource_group_level_async(resource_group_name, lock_name, parameters, custom_headers).value!
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Create or update a management lock at the resource group level.
|
57
|
+
#
|
58
|
+
# @param resource_group_name [String] The resource group name.
|
59
|
+
# @param lock_name [String] The lock name.
|
60
|
+
# @param parameters [ManagementLockObject] The management lock parameters.
|
61
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
62
|
+
# to the HTTP request.
|
63
|
+
#
|
64
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
65
|
+
#
|
66
|
+
def create_or_update_at_resource_group_level_async(resource_group_name, lock_name, parameters, custom_headers = nil)
|
67
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
68
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
69
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
70
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
71
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
72
|
+
|
73
|
+
|
74
|
+
request_headers = {}
|
75
|
+
|
76
|
+
# Set Headers
|
77
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
78
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
79
|
+
|
80
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
81
|
+
|
82
|
+
# Serialize Request
|
83
|
+
request_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
84
|
+
request_content = @client.serialize(request_mapper, parameters)
|
85
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
86
|
+
|
87
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}'
|
88
|
+
|
89
|
+
request_url = @base_url || @client.base_url
|
90
|
+
|
91
|
+
options = {
|
92
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
93
|
+
path_params: {'resourceGroupName' => resource_group_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
94
|
+
query_params: {'api-version' => @client.api_version},
|
95
|
+
body: request_content,
|
96
|
+
headers: request_headers.merge(custom_headers || {}),
|
97
|
+
base_url: request_url
|
98
|
+
}
|
99
|
+
promise = @client.make_request_async(:put, path_template, options)
|
100
|
+
|
101
|
+
promise = promise.then do |result|
|
102
|
+
http_response = result.response
|
103
|
+
status_code = http_response.status
|
104
|
+
response_content = http_response.body
|
105
|
+
unless status_code == 200 || status_code == 201
|
106
|
+
error_model = JSON.load(response_content)
|
107
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
108
|
+
end
|
109
|
+
|
110
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
111
|
+
# Deserialize Response
|
112
|
+
if status_code == 200
|
113
|
+
begin
|
114
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
115
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
116
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
117
|
+
rescue Exception => e
|
118
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
# Deserialize Response
|
122
|
+
if status_code == 201
|
123
|
+
begin
|
124
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
125
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
126
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
127
|
+
rescue Exception => e
|
128
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
result
|
133
|
+
end
|
134
|
+
|
135
|
+
promise.execute
|
136
|
+
end
|
137
|
+
|
138
|
+
#
|
139
|
+
# Deletes the management lock of a resource group.
|
140
|
+
#
|
141
|
+
# @param resource_group_name [String] The resource group name.
|
142
|
+
# @param lock_name [String] The name of lock.
|
143
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
144
|
+
# will be added to the HTTP request.
|
145
|
+
#
|
146
|
+
#
|
147
|
+
def delete_at_resource_group_level(resource_group_name, lock_name, custom_headers = nil)
|
148
|
+
response = delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers).value!
|
149
|
+
nil
|
150
|
+
end
|
151
|
+
|
152
|
+
#
|
153
|
+
# Deletes the management lock of a resource group.
|
154
|
+
#
|
155
|
+
# @param resource_group_name [String] The resource group name.
|
156
|
+
# @param lock_name [String] The name of lock.
|
157
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
158
|
+
# will be added to the HTTP request.
|
159
|
+
#
|
160
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
161
|
+
#
|
162
|
+
def delete_at_resource_group_level_with_http_info(resource_group_name, lock_name, custom_headers = nil)
|
163
|
+
delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers).value!
|
164
|
+
end
|
165
|
+
|
166
|
+
#
|
167
|
+
# Deletes the management lock of a resource group.
|
168
|
+
#
|
169
|
+
# @param resource_group_name [String] The resource group name.
|
170
|
+
# @param lock_name [String] The name of lock.
|
171
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
172
|
+
# to the HTTP request.
|
173
|
+
#
|
174
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
175
|
+
#
|
176
|
+
def delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers = nil)
|
177
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
178
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
179
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
180
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
181
|
+
|
182
|
+
|
183
|
+
request_headers = {}
|
184
|
+
|
185
|
+
# Set Headers
|
186
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
187
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
188
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}'
|
189
|
+
|
190
|
+
request_url = @base_url || @client.base_url
|
191
|
+
|
192
|
+
options = {
|
193
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
194
|
+
path_params: {'resourceGroupName' => resource_group_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
195
|
+
query_params: {'api-version' => @client.api_version},
|
196
|
+
headers: request_headers.merge(custom_headers || {}),
|
197
|
+
base_url: request_url
|
198
|
+
}
|
199
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
200
|
+
|
201
|
+
promise = promise.then do |result|
|
202
|
+
http_response = result.response
|
203
|
+
status_code = http_response.status
|
204
|
+
response_content = http_response.body
|
205
|
+
unless status_code == 204 || status_code == 200
|
206
|
+
error_model = JSON.load(response_content)
|
207
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
208
|
+
end
|
209
|
+
|
210
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
211
|
+
|
212
|
+
result
|
213
|
+
end
|
214
|
+
|
215
|
+
promise.execute
|
216
|
+
end
|
217
|
+
|
218
|
+
#
|
219
|
+
# Gets a management lock at the resource group level.
|
220
|
+
#
|
221
|
+
# @param resource_group_name [String] The resource group name.
|
222
|
+
# @param lock_name [String] The lock name.
|
223
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
224
|
+
# will be added to the HTTP request.
|
225
|
+
#
|
226
|
+
# @return [ManagementLockObject] operation results.
|
227
|
+
#
|
228
|
+
def get_at_resource_group_level(resource_group_name, lock_name, custom_headers = nil)
|
229
|
+
response = get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers).value!
|
230
|
+
response.body unless response.nil?
|
231
|
+
end
|
232
|
+
|
233
|
+
#
|
234
|
+
# Gets a management lock at the resource group level.
|
235
|
+
#
|
236
|
+
# @param resource_group_name [String] The resource group name.
|
237
|
+
# @param lock_name [String] The lock name.
|
238
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
239
|
+
# will be added to the HTTP request.
|
240
|
+
#
|
241
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
242
|
+
#
|
243
|
+
def get_at_resource_group_level_with_http_info(resource_group_name, lock_name, custom_headers = nil)
|
244
|
+
get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers).value!
|
245
|
+
end
|
246
|
+
|
247
|
+
#
|
248
|
+
# Gets a management lock at the resource group level.
|
249
|
+
#
|
250
|
+
# @param resource_group_name [String] The resource group name.
|
251
|
+
# @param lock_name [String] The lock name.
|
252
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
253
|
+
# to the HTTP request.
|
254
|
+
#
|
255
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
256
|
+
#
|
257
|
+
def get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers = nil)
|
258
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
259
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
260
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
261
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
262
|
+
|
263
|
+
|
264
|
+
request_headers = {}
|
265
|
+
|
266
|
+
# Set Headers
|
267
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
268
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
269
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}'
|
270
|
+
|
271
|
+
request_url = @base_url || @client.base_url
|
272
|
+
|
273
|
+
options = {
|
274
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
275
|
+
path_params: {'resourceGroupName' => resource_group_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
276
|
+
query_params: {'api-version' => @client.api_version},
|
277
|
+
headers: request_headers.merge(custom_headers || {}),
|
278
|
+
base_url: request_url
|
279
|
+
}
|
280
|
+
promise = @client.make_request_async(:get, path_template, options)
|
281
|
+
|
282
|
+
promise = promise.then do |result|
|
283
|
+
http_response = result.response
|
284
|
+
status_code = http_response.status
|
285
|
+
response_content = http_response.body
|
286
|
+
unless status_code == 200
|
287
|
+
error_model = JSON.load(response_content)
|
288
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
289
|
+
end
|
290
|
+
|
291
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
292
|
+
# Deserialize Response
|
293
|
+
if status_code == 200
|
294
|
+
begin
|
295
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
296
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
297
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
298
|
+
rescue Exception => e
|
299
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
result
|
304
|
+
end
|
305
|
+
|
306
|
+
promise.execute
|
307
|
+
end
|
308
|
+
|
309
|
+
#
|
310
|
+
# Create or update a management lock at the resource level or any level below
|
311
|
+
# resource.
|
312
|
+
#
|
313
|
+
# @param resource_group_name [String] The name of the resource group.
|
314
|
+
# @param resource_provider_namespace [String] Resource identity.
|
315
|
+
# @param parent_resource_path [String] Resource identity.
|
316
|
+
# @param resource_type [String] Resource identity.
|
317
|
+
# @param resource_name [String] Resource identity.
|
318
|
+
# @param lock_name [String] The name of lock.
|
319
|
+
# @param parameters [ManagementLockObject] Create or update management lock
|
320
|
+
# parameters.
|
321
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
322
|
+
# will be added to the HTTP request.
|
323
|
+
#
|
324
|
+
# @return [ManagementLockObject] operation results.
|
325
|
+
#
|
326
|
+
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)
|
327
|
+
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!
|
328
|
+
response.body unless response.nil?
|
329
|
+
end
|
330
|
+
|
331
|
+
#
|
332
|
+
# Create or update a management lock at the resource level or any level below
|
333
|
+
# resource.
|
334
|
+
#
|
335
|
+
# @param resource_group_name [String] The name of the resource group.
|
336
|
+
# @param resource_provider_namespace [String] Resource identity.
|
337
|
+
# @param parent_resource_path [String] Resource identity.
|
338
|
+
# @param resource_type [String] Resource identity.
|
339
|
+
# @param resource_name [String] Resource identity.
|
340
|
+
# @param lock_name [String] The name of lock.
|
341
|
+
# @param parameters [ManagementLockObject] Create or update management lock
|
342
|
+
# parameters.
|
343
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
344
|
+
# will be added to the HTTP request.
|
345
|
+
#
|
346
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
347
|
+
#
|
348
|
+
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)
|
349
|
+
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!
|
350
|
+
end
|
351
|
+
|
352
|
+
#
|
353
|
+
# Create or update a management lock at the resource level or any level below
|
354
|
+
# resource.
|
355
|
+
#
|
356
|
+
# @param resource_group_name [String] The name of the resource group.
|
357
|
+
# @param resource_provider_namespace [String] Resource identity.
|
358
|
+
# @param parent_resource_path [String] Resource identity.
|
359
|
+
# @param resource_type [String] Resource identity.
|
360
|
+
# @param resource_name [String] Resource identity.
|
361
|
+
# @param lock_name [String] The name of lock.
|
362
|
+
# @param parameters [ManagementLockObject] Create or update management lock
|
363
|
+
# parameters.
|
364
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
365
|
+
# to the HTTP request.
|
366
|
+
#
|
367
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
368
|
+
#
|
369
|
+
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)
|
370
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
371
|
+
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
372
|
+
fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
|
373
|
+
fail ArgumentError, 'resource_type is nil' if resource_type.nil?
|
374
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
375
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
376
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
377
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
378
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
379
|
+
|
380
|
+
|
381
|
+
request_headers = {}
|
382
|
+
|
383
|
+
# Set Headers
|
384
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
385
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
386
|
+
|
387
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
388
|
+
|
389
|
+
# Serialize Request
|
390
|
+
request_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
391
|
+
request_content = @client.serialize(request_mapper, parameters)
|
392
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
393
|
+
|
394
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
|
395
|
+
|
396
|
+
request_url = @base_url || @client.base_url
|
397
|
+
|
398
|
+
options = {
|
399
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
400
|
+
path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
401
|
+
skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
|
402
|
+
query_params: {'api-version' => @client.api_version},
|
403
|
+
body: request_content,
|
404
|
+
headers: request_headers.merge(custom_headers || {}),
|
405
|
+
base_url: request_url
|
406
|
+
}
|
407
|
+
promise = @client.make_request_async(:put, path_template, options)
|
408
|
+
|
409
|
+
promise = promise.then do |result|
|
410
|
+
http_response = result.response
|
411
|
+
status_code = http_response.status
|
412
|
+
response_content = http_response.body
|
413
|
+
unless status_code == 200 || status_code == 201
|
414
|
+
error_model = JSON.load(response_content)
|
415
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
416
|
+
end
|
417
|
+
|
418
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
419
|
+
# Deserialize Response
|
420
|
+
if status_code == 200
|
421
|
+
begin
|
422
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
423
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
424
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
425
|
+
rescue Exception => e
|
426
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
427
|
+
end
|
428
|
+
end
|
429
|
+
# Deserialize Response
|
430
|
+
if status_code == 201
|
431
|
+
begin
|
432
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
433
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
434
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
435
|
+
rescue Exception => e
|
436
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
437
|
+
end
|
438
|
+
end
|
439
|
+
|
440
|
+
result
|
441
|
+
end
|
442
|
+
|
443
|
+
promise.execute
|
444
|
+
end
|
445
|
+
|
446
|
+
#
|
447
|
+
# Deletes the management lock of a resource or any level below resource.
|
448
|
+
#
|
449
|
+
# @param resource_group_name [String] The name of the resource group.
|
450
|
+
# @param resource_provider_namespace [String] Resource identity.
|
451
|
+
# @param parent_resource_path [String] Resource identity.
|
452
|
+
# @param resource_type [String] Resource identity.
|
453
|
+
# @param resource_name [String] Resource identity.
|
454
|
+
# @param lock_name [String] The name of lock.
|
455
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
456
|
+
# will be added to the HTTP request.
|
457
|
+
#
|
458
|
+
#
|
459
|
+
def delete_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers = nil)
|
460
|
+
response = delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers).value!
|
461
|
+
nil
|
462
|
+
end
|
463
|
+
|
464
|
+
#
|
465
|
+
# Deletes the management lock of a resource or any level below resource.
|
466
|
+
#
|
467
|
+
# @param resource_group_name [String] The name of the resource group.
|
468
|
+
# @param resource_provider_namespace [String] Resource identity.
|
469
|
+
# @param parent_resource_path [String] Resource identity.
|
470
|
+
# @param resource_type [String] Resource identity.
|
471
|
+
# @param resource_name [String] Resource identity.
|
472
|
+
# @param lock_name [String] The name of lock.
|
473
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
474
|
+
# will be added to the HTTP request.
|
475
|
+
#
|
476
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
477
|
+
#
|
478
|
+
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)
|
479
|
+
delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers).value!
|
480
|
+
end
|
481
|
+
|
482
|
+
#
|
483
|
+
# Deletes the management lock of a resource or any level below resource.
|
484
|
+
#
|
485
|
+
# @param resource_group_name [String] The name of the resource group.
|
486
|
+
# @param resource_provider_namespace [String] Resource identity.
|
487
|
+
# @param parent_resource_path [String] Resource identity.
|
488
|
+
# @param resource_type [String] Resource identity.
|
489
|
+
# @param resource_name [String] Resource identity.
|
490
|
+
# @param lock_name [String] The name of lock.
|
491
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
492
|
+
# to the HTTP request.
|
493
|
+
#
|
494
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
495
|
+
#
|
496
|
+
def delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers = nil)
|
497
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
498
|
+
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
499
|
+
fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
|
500
|
+
fail ArgumentError, 'resource_type is nil' if resource_type.nil?
|
501
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
502
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
503
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
504
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
505
|
+
|
506
|
+
|
507
|
+
request_headers = {}
|
508
|
+
|
509
|
+
# Set Headers
|
510
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
511
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
512
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
|
513
|
+
|
514
|
+
request_url = @base_url || @client.base_url
|
515
|
+
|
516
|
+
options = {
|
517
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
518
|
+
path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
519
|
+
skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
|
520
|
+
query_params: {'api-version' => @client.api_version},
|
521
|
+
headers: request_headers.merge(custom_headers || {}),
|
522
|
+
base_url: request_url
|
523
|
+
}
|
524
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
525
|
+
|
526
|
+
promise = promise.then do |result|
|
527
|
+
http_response = result.response
|
528
|
+
status_code = http_response.status
|
529
|
+
response_content = http_response.body
|
530
|
+
unless status_code == 204 || status_code == 200
|
531
|
+
error_model = JSON.load(response_content)
|
532
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
533
|
+
end
|
534
|
+
|
535
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
536
|
+
|
537
|
+
result
|
538
|
+
end
|
539
|
+
|
540
|
+
promise.execute
|
541
|
+
end
|
542
|
+
|
543
|
+
#
|
544
|
+
# Create or update a management lock at the subscription level.
|
545
|
+
#
|
546
|
+
# @param lock_name [String] The name of lock.
|
547
|
+
# @param parameters [ManagementLockObject] The management lock parameters.
|
548
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
549
|
+
# will be added to the HTTP request.
|
550
|
+
#
|
551
|
+
# @return [ManagementLockObject] operation results.
|
552
|
+
#
|
553
|
+
def create_or_update_at_subscription_level(lock_name, parameters, custom_headers = nil)
|
554
|
+
response = create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers).value!
|
555
|
+
response.body unless response.nil?
|
556
|
+
end
|
557
|
+
|
558
|
+
#
|
559
|
+
# Create or update a management lock at the subscription level.
|
560
|
+
#
|
561
|
+
# @param lock_name [String] The name of lock.
|
562
|
+
# @param parameters [ManagementLockObject] The management lock parameters.
|
563
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
564
|
+
# will be added to the HTTP request.
|
565
|
+
#
|
566
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
567
|
+
#
|
568
|
+
def create_or_update_at_subscription_level_with_http_info(lock_name, parameters, custom_headers = nil)
|
569
|
+
create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers).value!
|
570
|
+
end
|
571
|
+
|
572
|
+
#
|
573
|
+
# Create or update a management lock at the subscription level.
|
574
|
+
#
|
575
|
+
# @param lock_name [String] The name of lock.
|
576
|
+
# @param parameters [ManagementLockObject] The management lock parameters.
|
577
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
578
|
+
# to the HTTP request.
|
579
|
+
#
|
580
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
581
|
+
#
|
582
|
+
def create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers = nil)
|
583
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
584
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
585
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
586
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
587
|
+
|
588
|
+
|
589
|
+
request_headers = {}
|
590
|
+
|
591
|
+
# Set Headers
|
592
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
593
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
594
|
+
|
595
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
596
|
+
|
597
|
+
# Serialize Request
|
598
|
+
request_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
599
|
+
request_content = @client.serialize(request_mapper, parameters)
|
600
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
601
|
+
|
602
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
|
603
|
+
|
604
|
+
request_url = @base_url || @client.base_url
|
605
|
+
|
606
|
+
options = {
|
607
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
608
|
+
path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
609
|
+
query_params: {'api-version' => @client.api_version},
|
610
|
+
body: request_content,
|
611
|
+
headers: request_headers.merge(custom_headers || {}),
|
612
|
+
base_url: request_url
|
613
|
+
}
|
614
|
+
promise = @client.make_request_async(:put, path_template, options)
|
615
|
+
|
616
|
+
promise = promise.then do |result|
|
617
|
+
http_response = result.response
|
618
|
+
status_code = http_response.status
|
619
|
+
response_content = http_response.body
|
620
|
+
unless status_code == 201 || status_code == 200
|
621
|
+
error_model = JSON.load(response_content)
|
622
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
623
|
+
end
|
624
|
+
|
625
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
626
|
+
# Deserialize Response
|
627
|
+
if status_code == 201
|
628
|
+
begin
|
629
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
630
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
631
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
632
|
+
rescue Exception => e
|
633
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
634
|
+
end
|
635
|
+
end
|
636
|
+
# Deserialize Response
|
637
|
+
if status_code == 200
|
638
|
+
begin
|
639
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
640
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
641
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
642
|
+
rescue Exception => e
|
643
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
644
|
+
end
|
645
|
+
end
|
646
|
+
|
647
|
+
result
|
648
|
+
end
|
649
|
+
|
650
|
+
promise.execute
|
651
|
+
end
|
652
|
+
|
653
|
+
#
|
654
|
+
# Deletes the management lock of a subscription.
|
655
|
+
#
|
656
|
+
# @param lock_name [String] The name of lock.
|
657
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
658
|
+
# will be added to the HTTP request.
|
659
|
+
#
|
660
|
+
#
|
661
|
+
def delete_at_subscription_level(lock_name, custom_headers = nil)
|
662
|
+
response = delete_at_subscription_level_async(lock_name, custom_headers).value!
|
663
|
+
nil
|
664
|
+
end
|
665
|
+
|
666
|
+
#
|
667
|
+
# Deletes the management lock of a subscription.
|
668
|
+
#
|
669
|
+
# @param lock_name [String] The name of lock.
|
670
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
671
|
+
# will be added to the HTTP request.
|
672
|
+
#
|
673
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
674
|
+
#
|
675
|
+
def delete_at_subscription_level_with_http_info(lock_name, custom_headers = nil)
|
676
|
+
delete_at_subscription_level_async(lock_name, custom_headers).value!
|
677
|
+
end
|
678
|
+
|
679
|
+
#
|
680
|
+
# Deletes the management lock of a subscription.
|
681
|
+
#
|
682
|
+
# @param lock_name [String] The name of lock.
|
683
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
684
|
+
# to the HTTP request.
|
685
|
+
#
|
686
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
687
|
+
#
|
688
|
+
def delete_at_subscription_level_async(lock_name, custom_headers = nil)
|
689
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
690
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
691
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
692
|
+
|
693
|
+
|
694
|
+
request_headers = {}
|
695
|
+
|
696
|
+
# Set Headers
|
697
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
698
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
699
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
|
700
|
+
|
701
|
+
request_url = @base_url || @client.base_url
|
702
|
+
|
703
|
+
options = {
|
704
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
705
|
+
path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
706
|
+
query_params: {'api-version' => @client.api_version},
|
707
|
+
headers: request_headers.merge(custom_headers || {}),
|
708
|
+
base_url: request_url
|
709
|
+
}
|
710
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
711
|
+
|
712
|
+
promise = promise.then do |result|
|
713
|
+
http_response = result.response
|
714
|
+
status_code = http_response.status
|
715
|
+
response_content = http_response.body
|
716
|
+
unless status_code == 204 || status_code == 200
|
717
|
+
error_model = JSON.load(response_content)
|
718
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
719
|
+
end
|
720
|
+
|
721
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
722
|
+
|
723
|
+
result
|
724
|
+
end
|
725
|
+
|
726
|
+
promise.execute
|
727
|
+
end
|
728
|
+
|
729
|
+
#
|
730
|
+
# Gets the management lock of a scope.
|
731
|
+
#
|
732
|
+
# @param lock_name [String] Name of the management lock.
|
733
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
734
|
+
# will be added to the HTTP request.
|
735
|
+
#
|
736
|
+
# @return [ManagementLockObject] operation results.
|
737
|
+
#
|
738
|
+
def get(lock_name, custom_headers = nil)
|
739
|
+
response = get_async(lock_name, custom_headers).value!
|
740
|
+
response.body unless response.nil?
|
741
|
+
end
|
742
|
+
|
743
|
+
#
|
744
|
+
# Gets the management lock of a scope.
|
745
|
+
#
|
746
|
+
# @param lock_name [String] Name of the management lock.
|
747
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
748
|
+
# will be added to the HTTP request.
|
749
|
+
#
|
750
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
751
|
+
#
|
752
|
+
def get_with_http_info(lock_name, custom_headers = nil)
|
753
|
+
get_async(lock_name, custom_headers).value!
|
754
|
+
end
|
755
|
+
|
756
|
+
#
|
757
|
+
# Gets the management lock of a scope.
|
758
|
+
#
|
759
|
+
# @param lock_name [String] Name of the management lock.
|
760
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
761
|
+
# to the HTTP request.
|
762
|
+
#
|
763
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
764
|
+
#
|
765
|
+
def get_async(lock_name, custom_headers = nil)
|
766
|
+
fail ArgumentError, 'lock_name is nil' if lock_name.nil?
|
767
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
768
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
769
|
+
|
770
|
+
|
771
|
+
request_headers = {}
|
772
|
+
|
773
|
+
# Set Headers
|
774
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
775
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
776
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
|
777
|
+
|
778
|
+
request_url = @base_url || @client.base_url
|
779
|
+
|
780
|
+
options = {
|
781
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
782
|
+
path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
|
783
|
+
query_params: {'api-version' => @client.api_version},
|
784
|
+
headers: request_headers.merge(custom_headers || {}),
|
785
|
+
base_url: request_url
|
786
|
+
}
|
787
|
+
promise = @client.make_request_async(:get, path_template, options)
|
788
|
+
|
789
|
+
promise = promise.then do |result|
|
790
|
+
http_response = result.response
|
791
|
+
status_code = http_response.status
|
792
|
+
response_content = http_response.body
|
793
|
+
unless status_code == 200
|
794
|
+
error_model = JSON.load(response_content)
|
795
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
796
|
+
end
|
797
|
+
|
798
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
799
|
+
# Deserialize Response
|
800
|
+
if status_code == 200
|
801
|
+
begin
|
802
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
803
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockObject.mapper()
|
804
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
805
|
+
rescue Exception => e
|
806
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
807
|
+
end
|
808
|
+
end
|
809
|
+
|
810
|
+
result
|
811
|
+
end
|
812
|
+
|
813
|
+
promise.execute
|
814
|
+
end
|
815
|
+
|
816
|
+
#
|
817
|
+
# Gets all the management locks of a resource group.
|
818
|
+
#
|
819
|
+
# @param resource_group_name [String] Resource group name.
|
820
|
+
# @param filter [String] The filter to apply on the operation.
|
821
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
822
|
+
# will be added to the HTTP request.
|
823
|
+
#
|
824
|
+
# @return [Array<ManagementLockObject>] operation results.
|
825
|
+
#
|
826
|
+
def list_at_resource_group_level(resource_group_name, filter = nil, custom_headers = nil)
|
827
|
+
first_page = list_at_resource_group_level_as_lazy(resource_group_name, filter, custom_headers)
|
828
|
+
first_page.get_all_items
|
829
|
+
end
|
830
|
+
|
831
|
+
#
|
832
|
+
# Gets all the management locks of a resource group.
|
833
|
+
#
|
834
|
+
# @param resource_group_name [String] Resource group name.
|
835
|
+
# @param filter [String] The filter to apply on the operation.
|
836
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
837
|
+
# will be added to the HTTP request.
|
838
|
+
#
|
839
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
840
|
+
#
|
841
|
+
def list_at_resource_group_level_with_http_info(resource_group_name, filter = nil, custom_headers = nil)
|
842
|
+
list_at_resource_group_level_async(resource_group_name, filter, custom_headers).value!
|
843
|
+
end
|
844
|
+
|
845
|
+
#
|
846
|
+
# Gets all the management locks of a resource group.
|
847
|
+
#
|
848
|
+
# @param resource_group_name [String] Resource group name.
|
849
|
+
# @param filter [String] The filter to apply on the operation.
|
850
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
851
|
+
# to the HTTP request.
|
852
|
+
#
|
853
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
854
|
+
#
|
855
|
+
def list_at_resource_group_level_async(resource_group_name, filter = nil, custom_headers = nil)
|
856
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
857
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
858
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
859
|
+
|
860
|
+
|
861
|
+
request_headers = {}
|
862
|
+
|
863
|
+
# Set Headers
|
864
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
865
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
866
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks'
|
867
|
+
|
868
|
+
request_url = @base_url || @client.base_url
|
869
|
+
|
870
|
+
options = {
|
871
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
872
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
873
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
874
|
+
headers: request_headers.merge(custom_headers || {}),
|
875
|
+
base_url: request_url
|
876
|
+
}
|
877
|
+
promise = @client.make_request_async(:get, path_template, options)
|
878
|
+
|
879
|
+
promise = promise.then do |result|
|
880
|
+
http_response = result.response
|
881
|
+
status_code = http_response.status
|
882
|
+
response_content = http_response.body
|
883
|
+
unless status_code == 200
|
884
|
+
error_model = JSON.load(response_content)
|
885
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
886
|
+
end
|
887
|
+
|
888
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
889
|
+
# Deserialize Response
|
890
|
+
if status_code == 200
|
891
|
+
begin
|
892
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
893
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockListResult.mapper()
|
894
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
895
|
+
rescue Exception => e
|
896
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
897
|
+
end
|
898
|
+
end
|
899
|
+
|
900
|
+
result
|
901
|
+
end
|
902
|
+
|
903
|
+
promise.execute
|
904
|
+
end
|
905
|
+
|
906
|
+
#
|
907
|
+
# Gets all the management locks of a resource or any level below resource.
|
908
|
+
#
|
909
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
910
|
+
# is case insensitive.
|
911
|
+
# @param resource_provider_namespace [String] Resource identity.
|
912
|
+
# @param parent_resource_path [String] Resource identity.
|
913
|
+
# @param resource_type [String] Resource identity.
|
914
|
+
# @param resource_name [String] Resource identity.
|
915
|
+
# @param filter [String] The filter to apply on the operation.
|
916
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
917
|
+
# will be added to the HTTP request.
|
918
|
+
#
|
919
|
+
# @return [Array<ManagementLockObject>] operation results.
|
920
|
+
#
|
921
|
+
def list_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
|
922
|
+
first_page = list_at_resource_level_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers)
|
923
|
+
first_page.get_all_items
|
924
|
+
end
|
925
|
+
|
926
|
+
#
|
927
|
+
# Gets all the management locks of a resource or any level below resource.
|
928
|
+
#
|
929
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
930
|
+
# is case insensitive.
|
931
|
+
# @param resource_provider_namespace [String] Resource identity.
|
932
|
+
# @param parent_resource_path [String] Resource identity.
|
933
|
+
# @param resource_type [String] Resource identity.
|
934
|
+
# @param resource_name [String] Resource identity.
|
935
|
+
# @param filter [String] The filter to apply on the operation.
|
936
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
937
|
+
# will be added to the HTTP request.
|
938
|
+
#
|
939
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
940
|
+
#
|
941
|
+
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)
|
942
|
+
list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers).value!
|
943
|
+
end
|
944
|
+
|
945
|
+
#
|
946
|
+
# Gets all the management locks of a resource or any level below resource.
|
947
|
+
#
|
948
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
949
|
+
# is case insensitive.
|
950
|
+
# @param resource_provider_namespace [String] Resource identity.
|
951
|
+
# @param parent_resource_path [String] Resource identity.
|
952
|
+
# @param resource_type [String] Resource identity.
|
953
|
+
# @param resource_name [String] Resource identity.
|
954
|
+
# @param filter [String] The filter to apply on the operation.
|
955
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
956
|
+
# to the HTTP request.
|
957
|
+
#
|
958
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
959
|
+
#
|
960
|
+
def list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
|
961
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
962
|
+
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
963
|
+
fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
|
964
|
+
fail ArgumentError, 'resource_type is nil' if resource_type.nil?
|
965
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
966
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
967
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
968
|
+
|
969
|
+
|
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 = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks'
|
976
|
+
|
977
|
+
request_url = @base_url || @client.base_url
|
978
|
+
|
979
|
+
options = {
|
980
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
981
|
+
path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
|
982
|
+
skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
|
983
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
984
|
+
headers: request_headers.merge(custom_headers || {}),
|
985
|
+
base_url: request_url
|
986
|
+
}
|
987
|
+
promise = @client.make_request_async(:get, path_template, options)
|
988
|
+
|
989
|
+
promise = promise.then do |result|
|
990
|
+
http_response = result.response
|
991
|
+
status_code = http_response.status
|
992
|
+
response_content = http_response.body
|
993
|
+
unless status_code == 200
|
994
|
+
error_model = JSON.load(response_content)
|
995
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
996
|
+
end
|
997
|
+
|
998
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
999
|
+
# Deserialize Response
|
1000
|
+
if status_code == 200
|
1001
|
+
begin
|
1002
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1003
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockListResult.mapper()
|
1004
|
+
result.body = @client.deserialize(result_mapper, 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
|
+
#
|
1017
|
+
# Gets all the management locks of a subscription.
|
1018
|
+
#
|
1019
|
+
# @param filter [String] The filter to apply on the operation.
|
1020
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1021
|
+
# will be added to the HTTP request.
|
1022
|
+
#
|
1023
|
+
# @return [Array<ManagementLockObject>] operation results.
|
1024
|
+
#
|
1025
|
+
def list_at_subscription_level(filter = nil, custom_headers = nil)
|
1026
|
+
first_page = list_at_subscription_level_as_lazy(filter, custom_headers)
|
1027
|
+
first_page.get_all_items
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
#
|
1031
|
+
# Gets all the management locks of a subscription.
|
1032
|
+
#
|
1033
|
+
# @param filter [String] The filter to apply on the operation.
|
1034
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1035
|
+
# will be added to the HTTP request.
|
1036
|
+
#
|
1037
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1038
|
+
#
|
1039
|
+
def list_at_subscription_level_with_http_info(filter = nil, custom_headers = nil)
|
1040
|
+
list_at_subscription_level_async(filter, custom_headers).value!
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
#
|
1044
|
+
# Gets all the management locks of a subscription.
|
1045
|
+
#
|
1046
|
+
# @param filter [String] The filter to apply on the operation.
|
1047
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1048
|
+
# to the HTTP request.
|
1049
|
+
#
|
1050
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1051
|
+
#
|
1052
|
+
def list_at_subscription_level_async(filter = nil, custom_headers = nil)
|
1053
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
1054
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
1055
|
+
|
1056
|
+
|
1057
|
+
request_headers = {}
|
1058
|
+
|
1059
|
+
# Set Headers
|
1060
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1061
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1062
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks'
|
1063
|
+
|
1064
|
+
request_url = @base_url || @client.base_url
|
1065
|
+
|
1066
|
+
options = {
|
1067
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1068
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
1069
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
1070
|
+
headers: request_headers.merge(custom_headers || {}),
|
1071
|
+
base_url: request_url
|
1072
|
+
}
|
1073
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1074
|
+
|
1075
|
+
promise = promise.then do |result|
|
1076
|
+
http_response = result.response
|
1077
|
+
status_code = http_response.status
|
1078
|
+
response_content = http_response.body
|
1079
|
+
unless status_code == 200
|
1080
|
+
error_model = JSON.load(response_content)
|
1081
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1082
|
+
end
|
1083
|
+
|
1084
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1085
|
+
# Deserialize Response
|
1086
|
+
if status_code == 200
|
1087
|
+
begin
|
1088
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1089
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockListResult.mapper()
|
1090
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1091
|
+
rescue Exception => e
|
1092
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1093
|
+
end
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
result
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
promise.execute
|
1100
|
+
end
|
1101
|
+
|
1102
|
+
#
|
1103
|
+
# Gets all the management locks of a resource group.
|
1104
|
+
#
|
1105
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1106
|
+
# to List operation.
|
1107
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1108
|
+
# will be added to the HTTP request.
|
1109
|
+
#
|
1110
|
+
# @return [ManagementLockListResult] operation results.
|
1111
|
+
#
|
1112
|
+
def list_at_resource_group_level_next(next_page_link, custom_headers = nil)
|
1113
|
+
response = list_at_resource_group_level_next_async(next_page_link, custom_headers).value!
|
1114
|
+
response.body unless response.nil?
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
#
|
1118
|
+
# Gets all the management locks of a resource group.
|
1119
|
+
#
|
1120
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1121
|
+
# to List operation.
|
1122
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1123
|
+
# will be added to the HTTP request.
|
1124
|
+
#
|
1125
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1126
|
+
#
|
1127
|
+
def list_at_resource_group_level_next_with_http_info(next_page_link, custom_headers = nil)
|
1128
|
+
list_at_resource_group_level_next_async(next_page_link, custom_headers).value!
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
#
|
1132
|
+
# Gets all the management locks of a resource group.
|
1133
|
+
#
|
1134
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1135
|
+
# to List operation.
|
1136
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1137
|
+
# to the HTTP request.
|
1138
|
+
#
|
1139
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1140
|
+
#
|
1141
|
+
def list_at_resource_group_level_next_async(next_page_link, custom_headers = nil)
|
1142
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1143
|
+
|
1144
|
+
|
1145
|
+
request_headers = {}
|
1146
|
+
|
1147
|
+
# Set Headers
|
1148
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1149
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1150
|
+
path_template = '{nextLink}'
|
1151
|
+
|
1152
|
+
request_url = @base_url || @client.base_url
|
1153
|
+
|
1154
|
+
options = {
|
1155
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1156
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1157
|
+
headers: request_headers.merge(custom_headers || {}),
|
1158
|
+
base_url: request_url
|
1159
|
+
}
|
1160
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1161
|
+
|
1162
|
+
promise = promise.then do |result|
|
1163
|
+
http_response = result.response
|
1164
|
+
status_code = http_response.status
|
1165
|
+
response_content = http_response.body
|
1166
|
+
unless status_code == 200
|
1167
|
+
error_model = JSON.load(response_content)
|
1168
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1169
|
+
end
|
1170
|
+
|
1171
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1172
|
+
# Deserialize Response
|
1173
|
+
if status_code == 200
|
1174
|
+
begin
|
1175
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1176
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockListResult.mapper()
|
1177
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1178
|
+
rescue Exception => e
|
1179
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1180
|
+
end
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
result
|
1184
|
+
end
|
1185
|
+
|
1186
|
+
promise.execute
|
1187
|
+
end
|
1188
|
+
|
1189
|
+
#
|
1190
|
+
# Gets all the management locks of a resource or any level below resource.
|
1191
|
+
#
|
1192
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1193
|
+
# to List operation.
|
1194
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1195
|
+
# will be added to the HTTP request.
|
1196
|
+
#
|
1197
|
+
# @return [ManagementLockListResult] operation results.
|
1198
|
+
#
|
1199
|
+
def list_at_resource_level_next(next_page_link, custom_headers = nil)
|
1200
|
+
response = list_at_resource_level_next_async(next_page_link, custom_headers).value!
|
1201
|
+
response.body unless response.nil?
|
1202
|
+
end
|
1203
|
+
|
1204
|
+
#
|
1205
|
+
# Gets all the management locks of a resource or any level below resource.
|
1206
|
+
#
|
1207
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1208
|
+
# to List operation.
|
1209
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1210
|
+
# will be added to the HTTP request.
|
1211
|
+
#
|
1212
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1213
|
+
#
|
1214
|
+
def list_at_resource_level_next_with_http_info(next_page_link, custom_headers = nil)
|
1215
|
+
list_at_resource_level_next_async(next_page_link, custom_headers).value!
|
1216
|
+
end
|
1217
|
+
|
1218
|
+
#
|
1219
|
+
# Gets all the management locks of a resource or any level below resource.
|
1220
|
+
#
|
1221
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1222
|
+
# to List operation.
|
1223
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1224
|
+
# to the HTTP request.
|
1225
|
+
#
|
1226
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1227
|
+
#
|
1228
|
+
def list_at_resource_level_next_async(next_page_link, custom_headers = nil)
|
1229
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1230
|
+
|
1231
|
+
|
1232
|
+
request_headers = {}
|
1233
|
+
|
1234
|
+
# Set Headers
|
1235
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1236
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1237
|
+
path_template = '{nextLink}'
|
1238
|
+
|
1239
|
+
request_url = @base_url || @client.base_url
|
1240
|
+
|
1241
|
+
options = {
|
1242
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1243
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1244
|
+
headers: request_headers.merge(custom_headers || {}),
|
1245
|
+
base_url: request_url
|
1246
|
+
}
|
1247
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1248
|
+
|
1249
|
+
promise = promise.then do |result|
|
1250
|
+
http_response = result.response
|
1251
|
+
status_code = http_response.status
|
1252
|
+
response_content = http_response.body
|
1253
|
+
unless status_code == 200
|
1254
|
+
error_model = JSON.load(response_content)
|
1255
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1256
|
+
end
|
1257
|
+
|
1258
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1259
|
+
# Deserialize Response
|
1260
|
+
if status_code == 200
|
1261
|
+
begin
|
1262
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1263
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockListResult.mapper()
|
1264
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1265
|
+
rescue Exception => e
|
1266
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1267
|
+
end
|
1268
|
+
end
|
1269
|
+
|
1270
|
+
result
|
1271
|
+
end
|
1272
|
+
|
1273
|
+
promise.execute
|
1274
|
+
end
|
1275
|
+
|
1276
|
+
#
|
1277
|
+
# Gets all the management locks of a subscription.
|
1278
|
+
#
|
1279
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1280
|
+
# to List operation.
|
1281
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1282
|
+
# will be added to the HTTP request.
|
1283
|
+
#
|
1284
|
+
# @return [ManagementLockListResult] operation results.
|
1285
|
+
#
|
1286
|
+
def list_at_subscription_level_next(next_page_link, custom_headers = nil)
|
1287
|
+
response = list_at_subscription_level_next_async(next_page_link, custom_headers).value!
|
1288
|
+
response.body unless response.nil?
|
1289
|
+
end
|
1290
|
+
|
1291
|
+
#
|
1292
|
+
# Gets all the management locks of a subscription.
|
1293
|
+
#
|
1294
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1295
|
+
# to List operation.
|
1296
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1297
|
+
# will be added to the HTTP request.
|
1298
|
+
#
|
1299
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1300
|
+
#
|
1301
|
+
def list_at_subscription_level_next_with_http_info(next_page_link, custom_headers = nil)
|
1302
|
+
list_at_subscription_level_next_async(next_page_link, custom_headers).value!
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
#
|
1306
|
+
# Gets all the management locks of a subscription.
|
1307
|
+
#
|
1308
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1309
|
+
# to List operation.
|
1310
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1311
|
+
# to the HTTP request.
|
1312
|
+
#
|
1313
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1314
|
+
#
|
1315
|
+
def list_at_subscription_level_next_async(next_page_link, custom_headers = nil)
|
1316
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1317
|
+
|
1318
|
+
|
1319
|
+
request_headers = {}
|
1320
|
+
|
1321
|
+
# Set Headers
|
1322
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1323
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1324
|
+
path_template = '{nextLink}'
|
1325
|
+
|
1326
|
+
request_url = @base_url || @client.base_url
|
1327
|
+
|
1328
|
+
options = {
|
1329
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1330
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1331
|
+
headers: request_headers.merge(custom_headers || {}),
|
1332
|
+
base_url: request_url
|
1333
|
+
}
|
1334
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1335
|
+
|
1336
|
+
promise = promise.then do |result|
|
1337
|
+
http_response = result.response
|
1338
|
+
status_code = http_response.status
|
1339
|
+
response_content = http_response.body
|
1340
|
+
unless status_code == 200
|
1341
|
+
error_model = JSON.load(response_content)
|
1342
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1343
|
+
end
|
1344
|
+
|
1345
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1346
|
+
# Deserialize Response
|
1347
|
+
if status_code == 200
|
1348
|
+
begin
|
1349
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1350
|
+
result_mapper = Azure::Locks::Mgmt::V2015_01_01::Models::ManagementLockListResult.mapper()
|
1351
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1352
|
+
rescue Exception => e
|
1353
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1354
|
+
end
|
1355
|
+
end
|
1356
|
+
|
1357
|
+
result
|
1358
|
+
end
|
1359
|
+
|
1360
|
+
promise.execute
|
1361
|
+
end
|
1362
|
+
|
1363
|
+
#
|
1364
|
+
# Gets all the management locks of a resource group.
|
1365
|
+
#
|
1366
|
+
# @param resource_group_name [String] Resource group name.
|
1367
|
+
# @param filter [String] The filter to apply on the operation.
|
1368
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1369
|
+
# will be added to the HTTP request.
|
1370
|
+
#
|
1371
|
+
# @return [ManagementLockListResult] which provide lazy access to pages of the
|
1372
|
+
# response.
|
1373
|
+
#
|
1374
|
+
def list_at_resource_group_level_as_lazy(resource_group_name, filter = nil, custom_headers = nil)
|
1375
|
+
response = list_at_resource_group_level_async(resource_group_name, filter, custom_headers).value!
|
1376
|
+
unless response.nil?
|
1377
|
+
page = response.body
|
1378
|
+
page.next_method = Proc.new do |next_page_link|
|
1379
|
+
list_at_resource_group_level_next_async(next_page_link, custom_headers)
|
1380
|
+
end
|
1381
|
+
page
|
1382
|
+
end
|
1383
|
+
end
|
1384
|
+
|
1385
|
+
#
|
1386
|
+
# Gets all the management locks of a resource or any level below resource.
|
1387
|
+
#
|
1388
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
1389
|
+
# is case insensitive.
|
1390
|
+
# @param resource_provider_namespace [String] Resource identity.
|
1391
|
+
# @param parent_resource_path [String] Resource identity.
|
1392
|
+
# @param resource_type [String] Resource identity.
|
1393
|
+
# @param resource_name [String] Resource identity.
|
1394
|
+
# @param filter [String] The filter to apply on the operation.
|
1395
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1396
|
+
# will be added to the HTTP request.
|
1397
|
+
#
|
1398
|
+
# @return [ManagementLockListResult] which provide lazy access to pages of the
|
1399
|
+
# response.
|
1400
|
+
#
|
1401
|
+
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)
|
1402
|
+
response = list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter, custom_headers).value!
|
1403
|
+
unless response.nil?
|
1404
|
+
page = response.body
|
1405
|
+
page.next_method = Proc.new do |next_page_link|
|
1406
|
+
list_at_resource_level_next_async(next_page_link, custom_headers)
|
1407
|
+
end
|
1408
|
+
page
|
1409
|
+
end
|
1410
|
+
end
|
1411
|
+
|
1412
|
+
#
|
1413
|
+
# Gets all the management locks of a subscription.
|
1414
|
+
#
|
1415
|
+
# @param filter [String] The filter to apply on the operation.
|
1416
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1417
|
+
# will be added to the HTTP request.
|
1418
|
+
#
|
1419
|
+
# @return [ManagementLockListResult] which provide lazy access to pages of the
|
1420
|
+
# response.
|
1421
|
+
#
|
1422
|
+
def list_at_subscription_level_as_lazy(filter = nil, custom_headers = nil)
|
1423
|
+
response = list_at_subscription_level_async(filter, custom_headers).value!
|
1424
|
+
unless response.nil?
|
1425
|
+
page = response.body
|
1426
|
+
page.next_method = Proc.new do |next_page_link|
|
1427
|
+
list_at_subscription_level_next_async(next_page_link, custom_headers)
|
1428
|
+
end
|
1429
|
+
page
|
1430
|
+
end
|
1431
|
+
end
|
1432
|
+
|
1433
|
+
end
|
1434
|
+
end
|