azure_mgmt_links 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/azure_mgmt_links.rb +7 -0
- data/lib/generated/azure_mgmt_links.rb +33 -0
- data/lib/generated/azure_mgmt_links/management_link_client.rb +129 -0
- data/lib/generated/azure_mgmt_links/models/filter.rb +15 -0
- data/lib/generated/azure_mgmt_links/models/resource_link.rb +67 -0
- data/lib/generated/azure_mgmt_links/models/resource_link_filter.rb +44 -0
- data/lib/generated/azure_mgmt_links/models/resource_link_properties.rb +67 -0
- data/lib/generated/azure_mgmt_links/models/resource_link_result.rb +95 -0
- data/lib/generated/azure_mgmt_links/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_links/resource_links.rb +753 -0
- data/lib/generated/azure_mgmt_links/version.rb +8 -0
- metadata +125 -0
@@ -0,0 +1,753 @@
|
|
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::Links
|
7
|
+
#
|
8
|
+
# Azure resources can be linked together to form logical relationships. You
|
9
|
+
# can establish links between resources belonging to different resource
|
10
|
+
# groups. However, all the linked resources must belong to the same
|
11
|
+
# subscription. Each resource can be linked to 50 other resources. If any of
|
12
|
+
# the linked resources are deleted or moved, the link owner must clean up the
|
13
|
+
# remaining link.
|
14
|
+
#
|
15
|
+
class ResourceLinks
|
16
|
+
include MsRestAzure
|
17
|
+
|
18
|
+
#
|
19
|
+
# Creates and initializes a new instance of the ResourceLinks class.
|
20
|
+
# @param client service class for accessing basic functionality.
|
21
|
+
#
|
22
|
+
def initialize(client)
|
23
|
+
@client = client
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [ManagementLinkClient] reference to the ManagementLinkClient
|
27
|
+
attr_reader :client
|
28
|
+
|
29
|
+
#
|
30
|
+
# Deletes a resource link with the specified ID.
|
31
|
+
#
|
32
|
+
# @param link_id [String] The fully qualified ID of the resource link. Use the
|
33
|
+
# format,
|
34
|
+
# /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}.
|
35
|
+
# For example,
|
36
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
|
37
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
38
|
+
# will be added to the HTTP request.
|
39
|
+
#
|
40
|
+
#
|
41
|
+
def delete(link_id, custom_headers = nil)
|
42
|
+
response = delete_async(link_id, custom_headers).value!
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Deletes a resource link with the specified ID.
|
48
|
+
#
|
49
|
+
# @param link_id [String] The fully qualified ID of the resource link. Use the
|
50
|
+
# format,
|
51
|
+
# /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}.
|
52
|
+
# For example,
|
53
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
|
54
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
55
|
+
# will be added to the HTTP request.
|
56
|
+
#
|
57
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
58
|
+
#
|
59
|
+
def delete_with_http_info(link_id, custom_headers = nil)
|
60
|
+
delete_async(link_id, custom_headers).value!
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Deletes a resource link with the specified ID.
|
65
|
+
#
|
66
|
+
# @param link_id [String] The fully qualified ID of the resource link. Use the
|
67
|
+
# format,
|
68
|
+
# /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}.
|
69
|
+
# For example,
|
70
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
|
71
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
72
|
+
# to the HTTP request.
|
73
|
+
#
|
74
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
75
|
+
#
|
76
|
+
def delete_async(link_id, custom_headers = nil)
|
77
|
+
fail ArgumentError, 'link_id is nil' if link_id.nil?
|
78
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
79
|
+
|
80
|
+
|
81
|
+
request_headers = {}
|
82
|
+
|
83
|
+
# Set Headers
|
84
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
85
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
86
|
+
path_template = '{linkId}'
|
87
|
+
|
88
|
+
request_url = @base_url || @client.base_url
|
89
|
+
|
90
|
+
options = {
|
91
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
92
|
+
skip_encoding_path_params: {'linkId' => link_id},
|
93
|
+
query_params: {'api-version' => @client.api_version},
|
94
|
+
headers: request_headers.merge(custom_headers || {}),
|
95
|
+
base_url: request_url
|
96
|
+
}
|
97
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
98
|
+
|
99
|
+
promise = promise.then do |result|
|
100
|
+
http_response = result.response
|
101
|
+
status_code = http_response.status
|
102
|
+
response_content = http_response.body
|
103
|
+
unless status_code == 200 || status_code == 204
|
104
|
+
error_model = JSON.load(response_content)
|
105
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
106
|
+
end
|
107
|
+
|
108
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
109
|
+
|
110
|
+
result
|
111
|
+
end
|
112
|
+
|
113
|
+
promise.execute
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# Creates or updates a resource link between the specified resources.
|
118
|
+
#
|
119
|
+
# @param link_id [String] The fully qualified ID of the resource link. Use the
|
120
|
+
# format,
|
121
|
+
# /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}.
|
122
|
+
# For example,
|
123
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
|
124
|
+
# @param parameters [ResourceLink] Parameters for creating or updating a
|
125
|
+
# resource link.
|
126
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
127
|
+
# will be added to the HTTP request.
|
128
|
+
#
|
129
|
+
# @return [ResourceLink] operation results.
|
130
|
+
#
|
131
|
+
def create_or_update(link_id, parameters, custom_headers = nil)
|
132
|
+
response = create_or_update_async(link_id, parameters, custom_headers).value!
|
133
|
+
response.body unless response.nil?
|
134
|
+
end
|
135
|
+
|
136
|
+
#
|
137
|
+
# Creates or updates a resource link between the specified resources.
|
138
|
+
#
|
139
|
+
# @param link_id [String] The fully qualified ID of the resource link. Use the
|
140
|
+
# format,
|
141
|
+
# /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}.
|
142
|
+
# For example,
|
143
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
|
144
|
+
# @param parameters [ResourceLink] Parameters for creating or updating a
|
145
|
+
# resource link.
|
146
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
147
|
+
# will be added to the HTTP request.
|
148
|
+
#
|
149
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
150
|
+
#
|
151
|
+
def create_or_update_with_http_info(link_id, parameters, custom_headers = nil)
|
152
|
+
create_or_update_async(link_id, parameters, custom_headers).value!
|
153
|
+
end
|
154
|
+
|
155
|
+
#
|
156
|
+
# Creates or updates a resource link between the specified resources.
|
157
|
+
#
|
158
|
+
# @param link_id [String] The fully qualified ID of the resource link. Use the
|
159
|
+
# format,
|
160
|
+
# /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}.
|
161
|
+
# For example,
|
162
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
|
163
|
+
# @param parameters [ResourceLink] Parameters for creating or updating a
|
164
|
+
# resource link.
|
165
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
166
|
+
# to the HTTP request.
|
167
|
+
#
|
168
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
169
|
+
#
|
170
|
+
def create_or_update_async(link_id, parameters, custom_headers = nil)
|
171
|
+
fail ArgumentError, 'link_id is nil' if link_id.nil?
|
172
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
173
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
174
|
+
|
175
|
+
|
176
|
+
request_headers = {}
|
177
|
+
|
178
|
+
# Set Headers
|
179
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
180
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
181
|
+
|
182
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
183
|
+
|
184
|
+
# Serialize Request
|
185
|
+
request_mapper = Azure::ARM::Links::Models::ResourceLink.mapper()
|
186
|
+
request_content = @client.serialize(request_mapper, parameters)
|
187
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
188
|
+
|
189
|
+
path_template = '{linkId}'
|
190
|
+
|
191
|
+
request_url = @base_url || @client.base_url
|
192
|
+
|
193
|
+
options = {
|
194
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
195
|
+
skip_encoding_path_params: {'linkId' => link_id},
|
196
|
+
query_params: {'api-version' => @client.api_version},
|
197
|
+
body: request_content,
|
198
|
+
headers: request_headers.merge(custom_headers || {}),
|
199
|
+
base_url: request_url
|
200
|
+
}
|
201
|
+
promise = @client.make_request_async(:put, path_template, options)
|
202
|
+
|
203
|
+
promise = promise.then do |result|
|
204
|
+
http_response = result.response
|
205
|
+
status_code = http_response.status
|
206
|
+
response_content = http_response.body
|
207
|
+
unless status_code == 201 || status_code == 200
|
208
|
+
error_model = JSON.load(response_content)
|
209
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
210
|
+
end
|
211
|
+
|
212
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
213
|
+
# Deserialize Response
|
214
|
+
if status_code == 201
|
215
|
+
begin
|
216
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
217
|
+
result_mapper = Azure::ARM::Links::Models::ResourceLink.mapper()
|
218
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
219
|
+
rescue Exception => e
|
220
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
# Deserialize Response
|
224
|
+
if status_code == 200
|
225
|
+
begin
|
226
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
227
|
+
result_mapper = Azure::ARM::Links::Models::ResourceLink.mapper()
|
228
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
229
|
+
rescue Exception => e
|
230
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
result
|
235
|
+
end
|
236
|
+
|
237
|
+
promise.execute
|
238
|
+
end
|
239
|
+
|
240
|
+
#
|
241
|
+
# Gets a resource link with the specified ID.
|
242
|
+
#
|
243
|
+
# @param link_id [String] The fully qualified Id of the resource link. For
|
244
|
+
# example,
|
245
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
|
246
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
247
|
+
# will be added to the HTTP request.
|
248
|
+
#
|
249
|
+
# @return [ResourceLink] operation results.
|
250
|
+
#
|
251
|
+
def get(link_id, custom_headers = nil)
|
252
|
+
response = get_async(link_id, custom_headers).value!
|
253
|
+
response.body unless response.nil?
|
254
|
+
end
|
255
|
+
|
256
|
+
#
|
257
|
+
# Gets a resource link with the specified ID.
|
258
|
+
#
|
259
|
+
# @param link_id [String] The fully qualified Id of the resource link. For
|
260
|
+
# example,
|
261
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
|
262
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
263
|
+
# will be added to the HTTP request.
|
264
|
+
#
|
265
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
266
|
+
#
|
267
|
+
def get_with_http_info(link_id, custom_headers = nil)
|
268
|
+
get_async(link_id, custom_headers).value!
|
269
|
+
end
|
270
|
+
|
271
|
+
#
|
272
|
+
# Gets a resource link with the specified ID.
|
273
|
+
#
|
274
|
+
# @param link_id [String] The fully qualified Id of the resource link. For
|
275
|
+
# example,
|
276
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
|
277
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
278
|
+
# to the HTTP request.
|
279
|
+
#
|
280
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
281
|
+
#
|
282
|
+
def get_async(link_id, custom_headers = nil)
|
283
|
+
fail ArgumentError, 'link_id is nil' if link_id.nil?
|
284
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
285
|
+
|
286
|
+
|
287
|
+
request_headers = {}
|
288
|
+
|
289
|
+
# Set Headers
|
290
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
291
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
292
|
+
path_template = '{linkId}'
|
293
|
+
|
294
|
+
request_url = @base_url || @client.base_url
|
295
|
+
|
296
|
+
options = {
|
297
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
298
|
+
skip_encoding_path_params: {'linkId' => link_id},
|
299
|
+
query_params: {'api-version' => @client.api_version},
|
300
|
+
headers: request_headers.merge(custom_headers || {}),
|
301
|
+
base_url: request_url
|
302
|
+
}
|
303
|
+
promise = @client.make_request_async(:get, path_template, options)
|
304
|
+
|
305
|
+
promise = promise.then do |result|
|
306
|
+
http_response = result.response
|
307
|
+
status_code = http_response.status
|
308
|
+
response_content = http_response.body
|
309
|
+
unless status_code == 200
|
310
|
+
error_model = JSON.load(response_content)
|
311
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
312
|
+
end
|
313
|
+
|
314
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
315
|
+
# Deserialize Response
|
316
|
+
if status_code == 200
|
317
|
+
begin
|
318
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
319
|
+
result_mapper = Azure::ARM::Links::Models::ResourceLink.mapper()
|
320
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
321
|
+
rescue Exception => e
|
322
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
result
|
327
|
+
end
|
328
|
+
|
329
|
+
promise.execute
|
330
|
+
end
|
331
|
+
|
332
|
+
#
|
333
|
+
# Gets all the linked resources for the subscription.
|
334
|
+
#
|
335
|
+
# @param filter [String] The filter to apply on the list resource links
|
336
|
+
# operation. The supported filter for list resource links is targetid. For
|
337
|
+
# example, $filter=targetid eq {value}
|
338
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
339
|
+
# will be added to the HTTP request.
|
340
|
+
#
|
341
|
+
# @return [Array<ResourceLink>] operation results.
|
342
|
+
#
|
343
|
+
def list_at_subscription(filter = nil, custom_headers = nil)
|
344
|
+
first_page = list_at_subscription_as_lazy(filter, custom_headers)
|
345
|
+
first_page.get_all_items
|
346
|
+
end
|
347
|
+
|
348
|
+
#
|
349
|
+
# Gets all the linked resources for the subscription.
|
350
|
+
#
|
351
|
+
# @param filter [String] The filter to apply on the list resource links
|
352
|
+
# operation. The supported filter for list resource links is targetid. For
|
353
|
+
# example, $filter=targetid eq {value}
|
354
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
355
|
+
# will be added to the HTTP request.
|
356
|
+
#
|
357
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
358
|
+
#
|
359
|
+
def list_at_subscription_with_http_info(filter = nil, custom_headers = nil)
|
360
|
+
list_at_subscription_async(filter, custom_headers).value!
|
361
|
+
end
|
362
|
+
|
363
|
+
#
|
364
|
+
# Gets all the linked resources for the subscription.
|
365
|
+
#
|
366
|
+
# @param filter [String] The filter to apply on the list resource links
|
367
|
+
# operation. The supported filter for list resource links is targetid. For
|
368
|
+
# example, $filter=targetid eq {value}
|
369
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
370
|
+
# to the HTTP request.
|
371
|
+
#
|
372
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
373
|
+
#
|
374
|
+
def list_at_subscription_async(filter = nil, custom_headers = nil)
|
375
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
376
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
377
|
+
|
378
|
+
|
379
|
+
request_headers = {}
|
380
|
+
|
381
|
+
# Set Headers
|
382
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
383
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
384
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/links'
|
385
|
+
|
386
|
+
request_url = @base_url || @client.base_url
|
387
|
+
|
388
|
+
options = {
|
389
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
390
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
391
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
392
|
+
headers: request_headers.merge(custom_headers || {}),
|
393
|
+
base_url: request_url
|
394
|
+
}
|
395
|
+
promise = @client.make_request_async(:get, path_template, options)
|
396
|
+
|
397
|
+
promise = promise.then do |result|
|
398
|
+
http_response = result.response
|
399
|
+
status_code = http_response.status
|
400
|
+
response_content = http_response.body
|
401
|
+
unless status_code == 200
|
402
|
+
error_model = JSON.load(response_content)
|
403
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
404
|
+
end
|
405
|
+
|
406
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
407
|
+
# Deserialize Response
|
408
|
+
if status_code == 200
|
409
|
+
begin
|
410
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
411
|
+
result_mapper = Azure::ARM::Links::Models::ResourceLinkResult.mapper()
|
412
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
413
|
+
rescue Exception => e
|
414
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
result
|
419
|
+
end
|
420
|
+
|
421
|
+
promise.execute
|
422
|
+
end
|
423
|
+
|
424
|
+
#
|
425
|
+
# Gets a list of resource links at and below the specified source scope.
|
426
|
+
#
|
427
|
+
# @param scope [String] The fully qualified ID of the scope for getting the
|
428
|
+
# resource links. For example, to list resource links at and under a resource
|
429
|
+
# group, set the scope to
|
430
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup.
|
431
|
+
# @param filter [String] The filter to apply when getting resource links. To
|
432
|
+
# get links only at the specified scope (not below the scope), use
|
433
|
+
# Filter.atScope().
|
434
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
435
|
+
# will be added to the HTTP request.
|
436
|
+
#
|
437
|
+
# @return [Array<ResourceLink>] operation results.
|
438
|
+
#
|
439
|
+
def list_at_source_scope(scope, filter = nil, custom_headers = nil)
|
440
|
+
first_page = list_at_source_scope_as_lazy(scope, filter, custom_headers)
|
441
|
+
first_page.get_all_items
|
442
|
+
end
|
443
|
+
|
444
|
+
#
|
445
|
+
# Gets a list of resource links at and below the specified source scope.
|
446
|
+
#
|
447
|
+
# @param scope [String] The fully qualified ID of the scope for getting the
|
448
|
+
# resource links. For example, to list resource links at and under a resource
|
449
|
+
# group, set the scope to
|
450
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup.
|
451
|
+
# @param filter [String] The filter to apply when getting resource links. To
|
452
|
+
# get links only at the specified scope (not below the scope), use
|
453
|
+
# Filter.atScope().
|
454
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
455
|
+
# will be added to the HTTP request.
|
456
|
+
#
|
457
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
458
|
+
#
|
459
|
+
def list_at_source_scope_with_http_info(scope, filter = nil, custom_headers = nil)
|
460
|
+
list_at_source_scope_async(scope, filter, custom_headers).value!
|
461
|
+
end
|
462
|
+
|
463
|
+
#
|
464
|
+
# Gets a list of resource links at and below the specified source scope.
|
465
|
+
#
|
466
|
+
# @param scope [String] The fully qualified ID of the scope for getting the
|
467
|
+
# resource links. For example, to list resource links at and under a resource
|
468
|
+
# group, set the scope to
|
469
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup.
|
470
|
+
# @param filter [String] The filter to apply when getting resource links. To
|
471
|
+
# get links only at the specified scope (not below the scope), use
|
472
|
+
# Filter.atScope().
|
473
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
474
|
+
# to the HTTP request.
|
475
|
+
#
|
476
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
477
|
+
#
|
478
|
+
def list_at_source_scope_async(scope, filter = nil, custom_headers = nil)
|
479
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
480
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
481
|
+
|
482
|
+
|
483
|
+
request_headers = {}
|
484
|
+
|
485
|
+
# Set Headers
|
486
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
487
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
488
|
+
path_template = '{scope}/providers/Microsoft.Resources/links'
|
489
|
+
|
490
|
+
request_url = @base_url || @client.base_url
|
491
|
+
|
492
|
+
options = {
|
493
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
494
|
+
skip_encoding_path_params: {'scope' => scope},
|
495
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
496
|
+
headers: request_headers.merge(custom_headers || {}),
|
497
|
+
base_url: request_url
|
498
|
+
}
|
499
|
+
promise = @client.make_request_async(:get, path_template, options)
|
500
|
+
|
501
|
+
promise = promise.then do |result|
|
502
|
+
http_response = result.response
|
503
|
+
status_code = http_response.status
|
504
|
+
response_content = http_response.body
|
505
|
+
unless status_code == 200
|
506
|
+
error_model = JSON.load(response_content)
|
507
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
508
|
+
end
|
509
|
+
|
510
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
511
|
+
# Deserialize Response
|
512
|
+
if status_code == 200
|
513
|
+
begin
|
514
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
515
|
+
result_mapper = Azure::ARM::Links::Models::ResourceLinkResult.mapper()
|
516
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
517
|
+
rescue Exception => e
|
518
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
519
|
+
end
|
520
|
+
end
|
521
|
+
|
522
|
+
result
|
523
|
+
end
|
524
|
+
|
525
|
+
promise.execute
|
526
|
+
end
|
527
|
+
|
528
|
+
#
|
529
|
+
# Gets all the linked resources for the subscription.
|
530
|
+
#
|
531
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
532
|
+
# to List operation.
|
533
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
534
|
+
# will be added to the HTTP request.
|
535
|
+
#
|
536
|
+
# @return [ResourceLinkResult] operation results.
|
537
|
+
#
|
538
|
+
def list_at_subscription_next(next_page_link, custom_headers = nil)
|
539
|
+
response = list_at_subscription_next_async(next_page_link, custom_headers).value!
|
540
|
+
response.body unless response.nil?
|
541
|
+
end
|
542
|
+
|
543
|
+
#
|
544
|
+
# Gets all the linked resources for the subscription.
|
545
|
+
#
|
546
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
547
|
+
# to List operation.
|
548
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
549
|
+
# will be added to the HTTP request.
|
550
|
+
#
|
551
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
552
|
+
#
|
553
|
+
def list_at_subscription_next_with_http_info(next_page_link, custom_headers = nil)
|
554
|
+
list_at_subscription_next_async(next_page_link, custom_headers).value!
|
555
|
+
end
|
556
|
+
|
557
|
+
#
|
558
|
+
# Gets all the linked resources for the subscription.
|
559
|
+
#
|
560
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
561
|
+
# to List operation.
|
562
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
563
|
+
# to the HTTP request.
|
564
|
+
#
|
565
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
566
|
+
#
|
567
|
+
def list_at_subscription_next_async(next_page_link, custom_headers = nil)
|
568
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
569
|
+
|
570
|
+
|
571
|
+
request_headers = {}
|
572
|
+
|
573
|
+
# Set Headers
|
574
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
575
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
576
|
+
path_template = '{nextLink}'
|
577
|
+
|
578
|
+
request_url = @base_url || @client.base_url
|
579
|
+
|
580
|
+
options = {
|
581
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
582
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
583
|
+
headers: request_headers.merge(custom_headers || {}),
|
584
|
+
base_url: request_url
|
585
|
+
}
|
586
|
+
promise = @client.make_request_async(:get, path_template, options)
|
587
|
+
|
588
|
+
promise = promise.then do |result|
|
589
|
+
http_response = result.response
|
590
|
+
status_code = http_response.status
|
591
|
+
response_content = http_response.body
|
592
|
+
unless status_code == 200
|
593
|
+
error_model = JSON.load(response_content)
|
594
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
595
|
+
end
|
596
|
+
|
597
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
598
|
+
# Deserialize Response
|
599
|
+
if status_code == 200
|
600
|
+
begin
|
601
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
602
|
+
result_mapper = Azure::ARM::Links::Models::ResourceLinkResult.mapper()
|
603
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
604
|
+
rescue Exception => e
|
605
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
result
|
610
|
+
end
|
611
|
+
|
612
|
+
promise.execute
|
613
|
+
end
|
614
|
+
|
615
|
+
#
|
616
|
+
# Gets a list of resource links at and below the specified source scope.
|
617
|
+
#
|
618
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
619
|
+
# to List operation.
|
620
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
621
|
+
# will be added to the HTTP request.
|
622
|
+
#
|
623
|
+
# @return [ResourceLinkResult] operation results.
|
624
|
+
#
|
625
|
+
def list_at_source_scope_next(next_page_link, custom_headers = nil)
|
626
|
+
response = list_at_source_scope_next_async(next_page_link, custom_headers).value!
|
627
|
+
response.body unless response.nil?
|
628
|
+
end
|
629
|
+
|
630
|
+
#
|
631
|
+
# Gets a list of resource links at and below the specified source scope.
|
632
|
+
#
|
633
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
634
|
+
# to List operation.
|
635
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
636
|
+
# will be added to the HTTP request.
|
637
|
+
#
|
638
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
639
|
+
#
|
640
|
+
def list_at_source_scope_next_with_http_info(next_page_link, custom_headers = nil)
|
641
|
+
list_at_source_scope_next_async(next_page_link, custom_headers).value!
|
642
|
+
end
|
643
|
+
|
644
|
+
#
|
645
|
+
# Gets a list of resource links at and below the specified source scope.
|
646
|
+
#
|
647
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
648
|
+
# to List operation.
|
649
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
650
|
+
# to the HTTP request.
|
651
|
+
#
|
652
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
653
|
+
#
|
654
|
+
def list_at_source_scope_next_async(next_page_link, custom_headers = nil)
|
655
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
656
|
+
|
657
|
+
|
658
|
+
request_headers = {}
|
659
|
+
|
660
|
+
# Set Headers
|
661
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
662
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
663
|
+
path_template = '{nextLink}'
|
664
|
+
|
665
|
+
request_url = @base_url || @client.base_url
|
666
|
+
|
667
|
+
options = {
|
668
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
669
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
670
|
+
headers: request_headers.merge(custom_headers || {}),
|
671
|
+
base_url: request_url
|
672
|
+
}
|
673
|
+
promise = @client.make_request_async(:get, path_template, options)
|
674
|
+
|
675
|
+
promise = promise.then do |result|
|
676
|
+
http_response = result.response
|
677
|
+
status_code = http_response.status
|
678
|
+
response_content = http_response.body
|
679
|
+
unless status_code == 200
|
680
|
+
error_model = JSON.load(response_content)
|
681
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
682
|
+
end
|
683
|
+
|
684
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
685
|
+
# Deserialize Response
|
686
|
+
if status_code == 200
|
687
|
+
begin
|
688
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
689
|
+
result_mapper = Azure::ARM::Links::Models::ResourceLinkResult.mapper()
|
690
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
691
|
+
rescue Exception => e
|
692
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
693
|
+
end
|
694
|
+
end
|
695
|
+
|
696
|
+
result
|
697
|
+
end
|
698
|
+
|
699
|
+
promise.execute
|
700
|
+
end
|
701
|
+
|
702
|
+
#
|
703
|
+
# Gets all the linked resources for the subscription.
|
704
|
+
#
|
705
|
+
# @param filter [String] The filter to apply on the list resource links
|
706
|
+
# operation. The supported filter for list resource links is targetid. For
|
707
|
+
# example, $filter=targetid eq {value}
|
708
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
709
|
+
# will be added to the HTTP request.
|
710
|
+
#
|
711
|
+
# @return [ResourceLinkResult] which provide lazy access to pages of the
|
712
|
+
# response.
|
713
|
+
#
|
714
|
+
def list_at_subscription_as_lazy(filter = nil, custom_headers = nil)
|
715
|
+
response = list_at_subscription_async(filter, custom_headers).value!
|
716
|
+
unless response.nil?
|
717
|
+
page = response.body
|
718
|
+
page.next_method = Proc.new do |next_page_link|
|
719
|
+
list_at_subscription_next_async(next_page_link, custom_headers)
|
720
|
+
end
|
721
|
+
page
|
722
|
+
end
|
723
|
+
end
|
724
|
+
|
725
|
+
#
|
726
|
+
# Gets a list of resource links at and below the specified source scope.
|
727
|
+
#
|
728
|
+
# @param scope [String] The fully qualified ID of the scope for getting the
|
729
|
+
# resource links. For example, to list resource links at and under a resource
|
730
|
+
# group, set the scope to
|
731
|
+
# /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup.
|
732
|
+
# @param filter [String] The filter to apply when getting resource links. To
|
733
|
+
# get links only at the specified scope (not below the scope), use
|
734
|
+
# Filter.atScope().
|
735
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
736
|
+
# will be added to the HTTP request.
|
737
|
+
#
|
738
|
+
# @return [ResourceLinkResult] which provide lazy access to pages of the
|
739
|
+
# response.
|
740
|
+
#
|
741
|
+
def list_at_source_scope_as_lazy(scope, filter = nil, custom_headers = nil)
|
742
|
+
response = list_at_source_scope_async(scope, filter, custom_headers).value!
|
743
|
+
unless response.nil?
|
744
|
+
page = response.body
|
745
|
+
page.next_method = Proc.new do |next_page_link|
|
746
|
+
list_at_source_scope_next_async(next_page_link, custom_headers)
|
747
|
+
end
|
748
|
+
page
|
749
|
+
end
|
750
|
+
end
|
751
|
+
|
752
|
+
end
|
753
|
+
end
|