Class: Azure::Links::Mgmt::V2016_09_01::ResourceLinks

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb

Overview

Azure resources can be linked together to form logical relationships. You can establish links between resources belonging to different resource groups. However, all the linked resources must belong to the same subscription. Each resource can be linked to 50 other resources. If any of the linked resources are deleted or moved, the link owner must clean up the remaining link.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ResourceLinks

Creates and initializes a new instance of the ResourceLinks class.

Parameters:

  • client

    service class for accessing basic functionality.



22
23
24
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 22

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientManagementLinkClient (readonly)

Returns reference to the ManagementLinkClient.

Returns:



27
28
29
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 27

def client
  @client
end

Instance Method Details

#create_or_update(link_id, parameters, custom_headers: nil) ⇒ ResourceLink

Creates or updates a resource link between the specified resources.

format, /subscriptions/subscription-id/resourceGroups/resource-group-name/provider-namespace/resource-type/resource-name/Microsoft.Resources/links/link-name. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink resource link. will be added to the HTTP request.

Parameters:

  • link_id (String)

    The fully qualified ID of the resource link. Use the

  • parameters (ResourceLink)

    Parameters for creating or updating a

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ResourceLink)

    operation results.



132
133
134
135
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 132

def create_or_update(link_id, parameters, custom_headers:nil)
  response = create_or_update_async(link_id, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(link_id, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a resource link between the specified resources.

format, /subscriptions/subscription-id/resourceGroups/resource-group-name/provider-namespace/resource-type/resource-name/Microsoft.Resources/links/link-name. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink resource link. to the HTTP request.

Parameters:

  • link_id (String)

    The fully qualified ID of the resource link. Use the

  • parameters (ResourceLink)

    Parameters for creating or updating a

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 171

def create_or_update_async(link_id, parameters, custom_headers:nil)
  fail ArgumentError, 'link_id is nil' if link_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Links::Mgmt::V2016_09_01::Models::ResourceLink.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{linkId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'linkId' => link_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201 || status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Links::Mgmt::V2016_09_01::Models::ResourceLink.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Links::Mgmt::V2016_09_01::Models::ResourceLink.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#create_or_update_with_http_info(link_id, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a resource link between the specified resources.

format, /subscriptions/subscription-id/resourceGroups/resource-group-name/provider-namespace/resource-type/resource-name/Microsoft.Resources/links/link-name. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink resource link. will be added to the HTTP request.

Parameters:

  • link_id (String)

    The fully qualified ID of the resource link. Use the

  • parameters (ResourceLink)

    Parameters for creating or updating a

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



152
153
154
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 152

def create_or_update_with_http_info(link_id, parameters, custom_headers:nil)
  create_or_update_async(link_id, parameters, custom_headers:custom_headers).value!
end

#delete(link_id, custom_headers: nil) ⇒ Object

Deletes a resource link with the specified ID.

format, /subscriptions/subscription-id/resourceGroups/resource-group-name/provider-namespace/resource-type/resource-name/Microsoft.Resources/links/link-name. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink will be added to the HTTP request.

Parameters:

  • link_id (String)

    The fully qualified ID of the resource link. Use the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



41
42
43
44
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 41

def delete(link_id, custom_headers:nil)
  response = delete_async(link_id, custom_headers:custom_headers).value!
  nil
end

#delete_async(link_id, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a resource link with the specified ID.

format, /subscriptions/subscription-id/resourceGroups/resource-group-name/provider-namespace/resource-type/resource-name/Microsoft.Resources/links/link-name. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink to the HTTP request.

Parameters:

  • link_id (String)

    The fully qualified ID of the resource link. Use the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 76

def delete_async(link_id, custom_headers:nil)
  fail ArgumentError, 'link_id is nil' if link_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{linkId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'linkId' => link_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#delete_with_http_info(link_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a resource link with the specified ID.

format, /subscriptions/subscription-id/resourceGroups/resource-group-name/provider-namespace/resource-type/resource-name/Microsoft.Resources/links/link-name. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink will be added to the HTTP request.

Parameters:

  • link_id (String)

    The fully qualified ID of the resource link. Use the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



59
60
61
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 59

def delete_with_http_info(link_id, custom_headers:nil)
  delete_async(link_id, custom_headers:custom_headers).value!
end

#get(link_id, custom_headers: nil) ⇒ ResourceLink

Gets a resource link with the specified ID.

example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink will be added to the HTTP request.

Parameters:

  • link_id (String)

    The fully qualified Id of the resource link. For

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ResourceLink)

    operation results.



251
252
253
254
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 251

def get(link_id, custom_headers:nil)
  response = get_async(link_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(link_id, custom_headers: nil) ⇒ Concurrent::Promise

Gets a resource link with the specified ID.

example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink to the HTTP request.

Parameters:

  • link_id (String)

    The fully qualified Id of the resource link. For

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 282

def get_async(link_id, custom_headers:nil)
  fail ArgumentError, 'link_id is nil' if link_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{linkId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'linkId' => link_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Links::Mgmt::V2016_09_01::Models::ResourceLink.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_with_http_info(link_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a resource link with the specified ID.

example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink will be added to the HTTP request.

Parameters:

  • link_id (String)

    The fully qualified Id of the resource link. For

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



267
268
269
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 267

def get_with_http_info(link_id, custom_headers:nil)
  get_async(link_id, custom_headers:custom_headers).value!
end

#list_at_source_scope(scope, filter: nil, custom_headers: nil) ⇒ Array<ResourceLink>

Gets a list of resource links at and below the specified source scope.

resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. get links only at the specified scope (not below the scope), use Filter.atScope(). will be added to the HTTP request.

Parameters:

  • scope (String)

    The fully qualified ID of the scope for getting the

  • filter (String) (defaults to: nil)

    The filter to apply when getting resource links. To

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<ResourceLink>)

    operation results.



441
442
443
444
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 441

def list_at_source_scope(scope, filter:nil, custom_headers:nil)
  first_page = list_at_source_scope_as_lazy(scope, filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_at_source_scope_as_lazy(scope, filter: nil, custom_headers: nil) ⇒ ResourceLinkResult

Gets a list of resource links at and below the specified source scope.

resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. get links only at the specified scope (not below the scope), use Filter.atScope(). will be added to the HTTP request.

response.

Parameters:

  • scope (String)

    The fully qualified ID of the scope for getting the

  • filter (String) (defaults to: nil)

    The filter to apply when getting resource links. To

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ResourceLinkResult)

    which provide lazy access to pages of the



746
747
748
749
750
751
752
753
754
755
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 746

def list_at_source_scope_as_lazy(scope, filter:nil, custom_headers:nil)
  response = list_at_source_scope_async(scope, filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_at_source_scope_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_at_source_scope_async(scope, filter: nil, custom_headers: nil) ⇒ Concurrent::Promise

Gets a list of resource links at and below the specified source scope.

resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. get links only at the specified scope (not below the scope), use Filter.atScope(). to the HTTP request.

Parameters:

  • scope (String)

    The fully qualified ID of the scope for getting the

  • filter (String) (defaults to: nil)

    The filter to apply when getting resource links. To

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 480

def list_at_source_scope_async(scope, filter:nil, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{scope}/providers/Microsoft.Resources/links'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'scope' => scope},
      query_params: {'$filter' => filter,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Links::Mgmt::V2016_09_01::Models::ResourceLinkResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_at_source_scope_next(next_page_link, custom_headers: nil) ⇒ ResourceLinkResult

Gets a list of resource links at and below the specified source scope.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ResourceLinkResult)

    operation results.



629
630
631
632
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 629

def list_at_source_scope_next(next_page_link, custom_headers:nil)
  response = list_at_source_scope_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_at_source_scope_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Gets a list of resource links at and below the specified source scope.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 658

def list_at_source_scope_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Links::Mgmt::V2016_09_01::Models::ResourceLinkResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_at_source_scope_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of resource links at and below the specified source scope.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



644
645
646
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 644

def list_at_source_scope_next_with_http_info(next_page_link, custom_headers:nil)
  list_at_source_scope_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_at_source_scope_with_http_info(scope, filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of resource links at and below the specified source scope.

resource links. For example, to list resource links at and under a resource group, set the scope to /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. get links only at the specified scope (not below the scope), use Filter.atScope(). will be added to the HTTP request.

Parameters:

  • scope (String)

    The fully qualified ID of the scope for getting the

  • filter (String) (defaults to: nil)

    The filter to apply when getting resource links. To

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



461
462
463
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 461

def list_at_source_scope_with_http_info(scope, filter:nil, custom_headers:nil)
  list_at_source_scope_async(scope, filter:filter, custom_headers:custom_headers).value!
end

#list_at_subscription(filter: nil, custom_headers: nil) ⇒ Array<ResourceLink>

Gets all the linked resources for the subscription.

operation. The supported filter for list resource links is targetid. For example, $filter=targetid eq value will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the list resource links

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<ResourceLink>)

    operation results.



344
345
346
347
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 344

def list_at_subscription(filter:nil, custom_headers:nil)
  first_page = list_at_subscription_as_lazy(filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_at_subscription_as_lazy(filter: nil, custom_headers: nil) ⇒ ResourceLinkResult

Gets all the linked resources for the subscription.

operation. The supported filter for list resource links is targetid. For example, $filter=targetid eq value will be added to the HTTP request.

response.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the list resource links

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ResourceLinkResult)

    which provide lazy access to pages of the



719
720
721
722
723
724
725
726
727
728
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 719

def list_at_subscription_as_lazy(filter:nil, custom_headers:nil)
  response = list_at_subscription_async(filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_at_subscription_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_at_subscription_async(filter: nil, custom_headers: nil) ⇒ Concurrent::Promise

Gets all the linked resources for the subscription.

operation. The supported filter for list resource links is targetid. For example, $filter=targetid eq value to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the list resource links

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 375

def list_at_subscription_async(filter:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/links'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'$filter' => filter,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Links::Mgmt::V2016_09_01::Models::ResourceLinkResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_at_subscription_next(next_page_link, custom_headers: nil) ⇒ ResourceLinkResult

Gets all the linked resources for the subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ResourceLinkResult)

    operation results.



541
542
543
544
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 541

def list_at_subscription_next(next_page_link, custom_headers:nil)
  response = list_at_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_at_subscription_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Gets all the linked resources for the subscription.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 570

def list_at_subscription_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Links::Mgmt::V2016_09_01::Models::ResourceLinkResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_at_subscription_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the linked resources for the subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



556
557
558
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 556

def list_at_subscription_next_with_http_info(next_page_link, custom_headers:nil)
  list_at_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_at_subscription_with_http_info(filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the linked resources for the subscription.

operation. The supported filter for list resource links is targetid. For example, $filter=targetid eq value will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the list resource links

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



360
361
362
# File 'lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb', line 360

def list_at_subscription_with_http_info(filter:nil, custom_headers:nil)
  list_at_subscription_async(filter:filter, custom_headers:custom_headers).value!
end