azure_mgmt_policy 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generated/azure_mgmt_policy.rb +8 -1
- data/lib/generated/azure_mgmt_policy/models/error_response.rb +66 -0
- data/lib/generated/azure_mgmt_policy/models/policy_assignment.rb +43 -2
- data/lib/generated/azure_mgmt_policy/models/policy_assignment_list_result.rb +1 -1
- data/lib/generated/azure_mgmt_policy/models/policy_definition.rb +26 -4
- data/lib/generated/azure_mgmt_policy/models/policy_definition_list_result.rb +1 -1
- data/lib/generated/azure_mgmt_policy/models/policy_definition_reference.rb +56 -0
- data/lib/generated/azure_mgmt_policy/models/policy_mode.rb +17 -0
- data/lib/generated/azure_mgmt_policy/models/policy_set_definition.rb +141 -0
- data/lib/generated/azure_mgmt_policy/models/policy_set_definition_list_result.rb +95 -0
- data/lib/generated/azure_mgmt_policy/models/policy_sku.rb +57 -0
- data/lib/generated/azure_mgmt_policy/models/policy_type.rb +1 -1
- data/lib/generated/azure_mgmt_policy/module_definition.rb +1 -1
- data/lib/generated/azure_mgmt_policy/policy_assignments.rb +36 -36
- data/lib/generated/azure_mgmt_policy/policy_client.rb +5 -5
- data/lib/generated/azure_mgmt_policy/policy_definitions.rb +9 -9
- data/lib/generated/azure_mgmt_policy/policy_set_definitions.rb +498 -0
- data/lib/generated/azure_mgmt_policy/version.rb +2 -2
- metadata +9 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Code generated by Microsoft (R) AutoRest Code Generator
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
3
|
# Changes may cause incorrect behavior and will be lost if the code is
|
4
4
|
# regenerated.
|
5
5
|
|
@@ -20,9 +20,6 @@ module Azure::ARM::Policy
|
|
20
20
|
# @return [String] The ID of the target subscription.
|
21
21
|
attr_accessor :subscription_id
|
22
22
|
|
23
|
-
# @return [String] The API version to use for the operation.
|
24
|
-
attr_reader :api_version
|
25
|
-
|
26
23
|
# @return [String] Gets or sets the preferred language for the response.
|
27
24
|
attr_accessor :accept_language
|
28
25
|
|
@@ -37,6 +34,9 @@ module Azure::ARM::Policy
|
|
37
34
|
# @return [PolicyAssignments] policy_assignments
|
38
35
|
attr_reader :policy_assignments
|
39
36
|
|
37
|
+
# @return [PolicySetDefinitions] policy_set_definitions
|
38
|
+
attr_reader :policy_set_definitions
|
39
|
+
|
40
40
|
# @return [PolicyDefinitions] policy_definitions
|
41
41
|
attr_reader :policy_definitions
|
42
42
|
|
@@ -54,8 +54,8 @@ module Azure::ARM::Policy
|
|
54
54
|
@credentials = credentials
|
55
55
|
|
56
56
|
@policy_assignments = PolicyAssignments.new(self)
|
57
|
+
@policy_set_definitions = PolicySetDefinitions.new(self)
|
57
58
|
@policy_definitions = PolicyDefinitions.new(self)
|
58
|
-
@api_version = '2016-12-01'
|
59
59
|
@accept_language = 'en-US'
|
60
60
|
@long_running_operation_retry_timeout = 30
|
61
61
|
@generate_client_request_id = true
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Code generated by Microsoft (R) AutoRest Code Generator
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
3
|
# Changes may cause incorrect behavior and will be lost if the code is
|
4
4
|
# regenerated.
|
5
5
|
|
@@ -67,7 +67,7 @@ module Azure::ARM::Policy
|
|
67
67
|
def create_or_update_async(policy_definition_name, parameters, custom_headers = nil)
|
68
68
|
fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
|
69
69
|
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
70
|
-
|
70
|
+
api_version = '2016-12-01'
|
71
71
|
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
72
72
|
|
73
73
|
|
@@ -91,7 +91,7 @@ module Azure::ARM::Policy
|
|
91
91
|
options = {
|
92
92
|
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
93
93
|
path_params: {'policyDefinitionName' => policy_definition_name,'subscriptionId' => @client.subscription_id},
|
94
|
-
query_params: {'api-version' =>
|
94
|
+
query_params: {'api-version' => api_version},
|
95
95
|
body: request_content,
|
96
96
|
headers: request_headers.merge(custom_headers || {}),
|
97
97
|
base_url: request_url
|
@@ -165,7 +165,7 @@ module Azure::ARM::Policy
|
|
165
165
|
#
|
166
166
|
def delete_async(policy_definition_name, custom_headers = nil)
|
167
167
|
fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
|
168
|
-
|
168
|
+
api_version = '2016-12-01'
|
169
169
|
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
170
170
|
|
171
171
|
|
@@ -181,7 +181,7 @@ module Azure::ARM::Policy
|
|
181
181
|
options = {
|
182
182
|
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
183
183
|
path_params: {'policyDefinitionName' => policy_definition_name,'subscriptionId' => @client.subscription_id},
|
184
|
-
query_params: {'api-version' =>
|
184
|
+
query_params: {'api-version' => api_version},
|
185
185
|
headers: request_headers.merge(custom_headers || {}),
|
186
186
|
base_url: request_url
|
187
187
|
}
|
@@ -245,7 +245,7 @@ module Azure::ARM::Policy
|
|
245
245
|
#
|
246
246
|
def get_async(policy_definition_name, custom_headers = nil)
|
247
247
|
fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
|
248
|
-
|
248
|
+
api_version = '2016-12-01'
|
249
249
|
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
250
250
|
|
251
251
|
|
@@ -261,7 +261,7 @@ module Azure::ARM::Policy
|
|
261
261
|
options = {
|
262
262
|
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
263
263
|
path_params: {'policyDefinitionName' => policy_definition_name,'subscriptionId' => @client.subscription_id},
|
264
|
-
query_params: {'api-version' =>
|
264
|
+
query_params: {'api-version' => api_version},
|
265
265
|
headers: request_headers.merge(custom_headers || {}),
|
266
266
|
base_url: request_url
|
267
267
|
}
|
@@ -331,7 +331,7 @@ module Azure::ARM::Policy
|
|
331
331
|
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
332
332
|
#
|
333
333
|
def list_async(filter = nil, custom_headers = nil)
|
334
|
-
|
334
|
+
api_version = '2016-12-01'
|
335
335
|
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
336
336
|
|
337
337
|
|
@@ -347,7 +347,7 @@ module Azure::ARM::Policy
|
|
347
347
|
options = {
|
348
348
|
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
349
349
|
path_params: {'subscriptionId' => @client.subscription_id},
|
350
|
-
query_params: {'$filter' => filter,'api-version' =>
|
350
|
+
query_params: {'$filter' => filter,'api-version' => api_version},
|
351
351
|
headers: request_headers.merge(custom_headers || {}),
|
352
352
|
base_url: request_url
|
353
353
|
}
|
@@ -0,0 +1,498 @@
|
|
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::ARM::Policy
|
7
|
+
#
|
8
|
+
# To manage and control access to your resources, you can define customized
|
9
|
+
# policies and assign them at a scope.
|
10
|
+
#
|
11
|
+
class PolicySetDefinitions
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the PolicySetDefinitions class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [PolicyClient] reference to the PolicyClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Creates or updates a policy set definition.
|
27
|
+
#
|
28
|
+
# @param policy_set_definition_name [String] The name of the policy set
|
29
|
+
# definition to create.
|
30
|
+
# @param parameters [PolicySetDefinition] The policy set definition properties.
|
31
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
32
|
+
# will be added to the HTTP request.
|
33
|
+
#
|
34
|
+
# @return [PolicySetDefinition] operation results.
|
35
|
+
#
|
36
|
+
def create_or_update(policy_set_definition_name, parameters, custom_headers = nil)
|
37
|
+
response = create_or_update_async(policy_set_definition_name, parameters, custom_headers).value!
|
38
|
+
response.body unless response.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Creates or updates a policy set definition.
|
43
|
+
#
|
44
|
+
# @param policy_set_definition_name [String] The name of the policy set
|
45
|
+
# definition to create.
|
46
|
+
# @param parameters [PolicySetDefinition] The policy set definition properties.
|
47
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
48
|
+
# will be added to the HTTP request.
|
49
|
+
#
|
50
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
51
|
+
#
|
52
|
+
def create_or_update_with_http_info(policy_set_definition_name, parameters, custom_headers = nil)
|
53
|
+
create_or_update_async(policy_set_definition_name, parameters, custom_headers).value!
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Creates or updates a policy set definition.
|
58
|
+
#
|
59
|
+
# @param policy_set_definition_name [String] The name of the policy set
|
60
|
+
# definition to create.
|
61
|
+
# @param parameters [PolicySetDefinition] The policy set definition properties.
|
62
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
63
|
+
# to the HTTP request.
|
64
|
+
#
|
65
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
66
|
+
#
|
67
|
+
def create_or_update_async(policy_set_definition_name, parameters, custom_headers = nil)
|
68
|
+
fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil?
|
69
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
70
|
+
api_version = '2017-06-01-preview'
|
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::ARM::Policy::Models::PolicySetDefinition.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}/providers/Microsoft.Authorization/policysetdefinitions/{policySetDefinitionName}'
|
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: {'policySetDefinitionName' => policy_set_definition_name,'subscriptionId' => @client.subscription_id},
|
94
|
+
query_params: {'api-version' => 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 == 201 || status_code == 200
|
106
|
+
error_model = JSON.load(response_content)
|
107
|
+
fail MsRest::HttpOperationError.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 == 201
|
113
|
+
begin
|
114
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
115
|
+
result_mapper = Azure::ARM::Policy::Models::PolicySetDefinition.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 == 200
|
123
|
+
begin
|
124
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
125
|
+
result_mapper = Azure::ARM::Policy::Models::PolicySetDefinition.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 a policy set definition.
|
140
|
+
#
|
141
|
+
# @param policy_set_definition_name [String] The name of the policy set
|
142
|
+
# definition to delete.
|
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(policy_set_definition_name, custom_headers = nil)
|
148
|
+
response = delete_async(policy_set_definition_name, custom_headers).value!
|
149
|
+
nil
|
150
|
+
end
|
151
|
+
|
152
|
+
#
|
153
|
+
# Deletes a policy set definition.
|
154
|
+
#
|
155
|
+
# @param policy_set_definition_name [String] The name of the policy set
|
156
|
+
# definition to delete.
|
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_with_http_info(policy_set_definition_name, custom_headers = nil)
|
163
|
+
delete_async(policy_set_definition_name, custom_headers).value!
|
164
|
+
end
|
165
|
+
|
166
|
+
#
|
167
|
+
# Deletes a policy set definition.
|
168
|
+
#
|
169
|
+
# @param policy_set_definition_name [String] The name of the policy set
|
170
|
+
# definition to delete.
|
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_async(policy_set_definition_name, custom_headers = nil)
|
177
|
+
fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil?
|
178
|
+
api_version = '2017-06-01-preview'
|
179
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
180
|
+
|
181
|
+
|
182
|
+
request_headers = {}
|
183
|
+
|
184
|
+
# Set Headers
|
185
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
186
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
187
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policysetdefinitions/{policySetDefinitionName}'
|
188
|
+
|
189
|
+
request_url = @base_url || @client.base_url
|
190
|
+
|
191
|
+
options = {
|
192
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
193
|
+
path_params: {'policySetDefinitionName' => policy_set_definition_name,'subscriptionId' => @client.subscription_id},
|
194
|
+
query_params: {'api-version' => api_version},
|
195
|
+
headers: request_headers.merge(custom_headers || {}),
|
196
|
+
base_url: request_url
|
197
|
+
}
|
198
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
199
|
+
|
200
|
+
promise = promise.then do |result|
|
201
|
+
http_response = result.response
|
202
|
+
status_code = http_response.status
|
203
|
+
response_content = http_response.body
|
204
|
+
unless status_code == 204 || status_code == 200
|
205
|
+
error_model = JSON.load(response_content)
|
206
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
207
|
+
end
|
208
|
+
|
209
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
210
|
+
|
211
|
+
result
|
212
|
+
end
|
213
|
+
|
214
|
+
promise.execute
|
215
|
+
end
|
216
|
+
|
217
|
+
#
|
218
|
+
# Gets the policy set definition.
|
219
|
+
#
|
220
|
+
# @param policy_set_definition_name [String] The name of the policy set
|
221
|
+
# definition to get.
|
222
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
223
|
+
# will be added to the HTTP request.
|
224
|
+
#
|
225
|
+
# @return [PolicySetDefinition] operation results.
|
226
|
+
#
|
227
|
+
def get(policy_set_definition_name, custom_headers = nil)
|
228
|
+
response = get_async(policy_set_definition_name, custom_headers).value!
|
229
|
+
response.body unless response.nil?
|
230
|
+
end
|
231
|
+
|
232
|
+
#
|
233
|
+
# Gets the policy set definition.
|
234
|
+
#
|
235
|
+
# @param policy_set_definition_name [String] The name of the policy set
|
236
|
+
# definition to get.
|
237
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
238
|
+
# will be added to the HTTP request.
|
239
|
+
#
|
240
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
241
|
+
#
|
242
|
+
def get_with_http_info(policy_set_definition_name, custom_headers = nil)
|
243
|
+
get_async(policy_set_definition_name, custom_headers).value!
|
244
|
+
end
|
245
|
+
|
246
|
+
#
|
247
|
+
# Gets the policy set definition.
|
248
|
+
#
|
249
|
+
# @param policy_set_definition_name [String] The name of the policy set
|
250
|
+
# definition to get.
|
251
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
252
|
+
# to the HTTP request.
|
253
|
+
#
|
254
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
255
|
+
#
|
256
|
+
def get_async(policy_set_definition_name, custom_headers = nil)
|
257
|
+
fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil?
|
258
|
+
api_version = '2017-06-01-preview'
|
259
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
260
|
+
|
261
|
+
|
262
|
+
request_headers = {}
|
263
|
+
|
264
|
+
# Set Headers
|
265
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
266
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
267
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policysetdefinitions/{policySetDefinitionName}'
|
268
|
+
|
269
|
+
request_url = @base_url || @client.base_url
|
270
|
+
|
271
|
+
options = {
|
272
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
273
|
+
path_params: {'policySetDefinitionName' => policy_set_definition_name,'subscriptionId' => @client.subscription_id},
|
274
|
+
query_params: {'api-version' => api_version},
|
275
|
+
headers: request_headers.merge(custom_headers || {}),
|
276
|
+
base_url: request_url
|
277
|
+
}
|
278
|
+
promise = @client.make_request_async(:get, path_template, options)
|
279
|
+
|
280
|
+
promise = promise.then do |result|
|
281
|
+
http_response = result.response
|
282
|
+
status_code = http_response.status
|
283
|
+
response_content = http_response.body
|
284
|
+
unless status_code == 200 || status_code == 404
|
285
|
+
error_model = JSON.load(response_content)
|
286
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
287
|
+
end
|
288
|
+
|
289
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
290
|
+
# Deserialize Response
|
291
|
+
if status_code == 200
|
292
|
+
begin
|
293
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
294
|
+
result_mapper = Azure::ARM::Policy::Models::PolicySetDefinition.mapper()
|
295
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
296
|
+
rescue Exception => e
|
297
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
result
|
302
|
+
end
|
303
|
+
|
304
|
+
promise.execute
|
305
|
+
end
|
306
|
+
|
307
|
+
#
|
308
|
+
# Gets all the policy set definitions for a subscription.
|
309
|
+
#
|
310
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
311
|
+
# will be added to the HTTP request.
|
312
|
+
#
|
313
|
+
# @return [Array<PolicySetDefinition>] operation results.
|
314
|
+
#
|
315
|
+
def list(custom_headers = nil)
|
316
|
+
first_page = list_as_lazy(custom_headers)
|
317
|
+
first_page.get_all_items
|
318
|
+
end
|
319
|
+
|
320
|
+
#
|
321
|
+
# Gets all the policy set definitions for a subscription.
|
322
|
+
#
|
323
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
324
|
+
# will be added to the HTTP request.
|
325
|
+
#
|
326
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
327
|
+
#
|
328
|
+
def list_with_http_info(custom_headers = nil)
|
329
|
+
list_async(custom_headers).value!
|
330
|
+
end
|
331
|
+
|
332
|
+
#
|
333
|
+
# Gets all the policy set definitions for a subscription.
|
334
|
+
#
|
335
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
336
|
+
# to the HTTP request.
|
337
|
+
#
|
338
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
339
|
+
#
|
340
|
+
def list_async(custom_headers = nil)
|
341
|
+
api_version = '2017-06-01-preview'
|
342
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
343
|
+
|
344
|
+
|
345
|
+
request_headers = {}
|
346
|
+
|
347
|
+
# Set Headers
|
348
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
349
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
350
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policysetdefinitions'
|
351
|
+
|
352
|
+
request_url = @base_url || @client.base_url
|
353
|
+
|
354
|
+
options = {
|
355
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
356
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
357
|
+
query_params: {'api-version' => api_version},
|
358
|
+
headers: request_headers.merge(custom_headers || {}),
|
359
|
+
base_url: request_url
|
360
|
+
}
|
361
|
+
promise = @client.make_request_async(:get, path_template, options)
|
362
|
+
|
363
|
+
promise = promise.then do |result|
|
364
|
+
http_response = result.response
|
365
|
+
status_code = http_response.status
|
366
|
+
response_content = http_response.body
|
367
|
+
unless status_code == 200
|
368
|
+
error_model = JSON.load(response_content)
|
369
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
370
|
+
end
|
371
|
+
|
372
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
373
|
+
# Deserialize Response
|
374
|
+
if status_code == 200
|
375
|
+
begin
|
376
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
377
|
+
result_mapper = Azure::ARM::Policy::Models::PolicySetDefinitionListResult.mapper()
|
378
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
379
|
+
rescue Exception => e
|
380
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
result
|
385
|
+
end
|
386
|
+
|
387
|
+
promise.execute
|
388
|
+
end
|
389
|
+
|
390
|
+
#
|
391
|
+
# Gets all the policy set definitions for a subscription.
|
392
|
+
#
|
393
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
394
|
+
# to List operation.
|
395
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
396
|
+
# will be added to the HTTP request.
|
397
|
+
#
|
398
|
+
# @return [PolicySetDefinitionListResult] operation results.
|
399
|
+
#
|
400
|
+
def list_next(next_page_link, custom_headers = nil)
|
401
|
+
response = list_next_async(next_page_link, custom_headers).value!
|
402
|
+
response.body unless response.nil?
|
403
|
+
end
|
404
|
+
|
405
|
+
#
|
406
|
+
# Gets all the policy set definitions for a subscription.
|
407
|
+
#
|
408
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
409
|
+
# to List operation.
|
410
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
411
|
+
# will be added to the HTTP request.
|
412
|
+
#
|
413
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
414
|
+
#
|
415
|
+
def list_next_with_http_info(next_page_link, custom_headers = nil)
|
416
|
+
list_next_async(next_page_link, custom_headers).value!
|
417
|
+
end
|
418
|
+
|
419
|
+
#
|
420
|
+
# Gets all the policy set definitions for a subscription.
|
421
|
+
#
|
422
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
423
|
+
# to List operation.
|
424
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
425
|
+
# to the HTTP request.
|
426
|
+
#
|
427
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
428
|
+
#
|
429
|
+
def list_next_async(next_page_link, custom_headers = nil)
|
430
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
431
|
+
|
432
|
+
|
433
|
+
request_headers = {}
|
434
|
+
|
435
|
+
# Set Headers
|
436
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
437
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
438
|
+
path_template = '{nextLink}'
|
439
|
+
|
440
|
+
request_url = @base_url || @client.base_url
|
441
|
+
|
442
|
+
options = {
|
443
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
444
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
445
|
+
headers: request_headers.merge(custom_headers || {}),
|
446
|
+
base_url: request_url
|
447
|
+
}
|
448
|
+
promise = @client.make_request_async(:get, path_template, options)
|
449
|
+
|
450
|
+
promise = promise.then do |result|
|
451
|
+
http_response = result.response
|
452
|
+
status_code = http_response.status
|
453
|
+
response_content = http_response.body
|
454
|
+
unless status_code == 200
|
455
|
+
error_model = JSON.load(response_content)
|
456
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
457
|
+
end
|
458
|
+
|
459
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
460
|
+
# Deserialize Response
|
461
|
+
if status_code == 200
|
462
|
+
begin
|
463
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
464
|
+
result_mapper = Azure::ARM::Policy::Models::PolicySetDefinitionListResult.mapper()
|
465
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
466
|
+
rescue Exception => e
|
467
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
result
|
472
|
+
end
|
473
|
+
|
474
|
+
promise.execute
|
475
|
+
end
|
476
|
+
|
477
|
+
#
|
478
|
+
# Gets all the policy set definitions for a subscription.
|
479
|
+
#
|
480
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
481
|
+
# will be added to the HTTP request.
|
482
|
+
#
|
483
|
+
# @return [PolicySetDefinitionListResult] which provide lazy access to pages of
|
484
|
+
# the response.
|
485
|
+
#
|
486
|
+
def list_as_lazy(custom_headers = nil)
|
487
|
+
response = list_async(custom_headers).value!
|
488
|
+
unless response.nil?
|
489
|
+
page = response.body
|
490
|
+
page.next_method = Proc.new do |next_page_link|
|
491
|
+
list_next_async(next_page_link, custom_headers)
|
492
|
+
end
|
493
|
+
page
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
end
|
498
|
+
end
|