Class: Azure::Authorization::Mgmt::V2015_07_01::RoleAssignments

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb

Overview

Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role definitions and role assignments. A role definition describes the set of actions that can be performed on resources. A role assignment grants access to Azure Active Directory users.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ RoleAssignments

Creates and initializes a new instance of the RoleAssignments class.

Parameters:

  • client

    service class for accessing basic functionality.



21
22
23
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 21

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientAuthorizationManagementClient (readonly)

Returns reference to the AuthorizationManagementClient.

Returns:



26
27
28
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 26

def client
  @client
end

Instance Method Details

#create(scope, role_assignment_name, parameters, custom_headers: nil) ⇒ RoleAssignment

Creates a role assignment.

can be any REST resource instance. For example, use '/subscriptions/subscription-id/' for a subscription, '/subscriptions/subscription-id/resourceGroups/resource-group-name' for a resource group, and '/subscriptions/subscription-id/resourceGroups/resource-group-name/providers/resource-provider/resource-type/resource-name' for a resource. create. It can be any valid GUID. assignment. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignment to create. The scope

  • role_assignment_name (String)

    The name of the role assignment to

  • parameters (RoleAssignmentCreateParameters)

    Parameters for the role

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

    A hash of custom headers that

Returns:

  • (RoleAssignment)

    operation results.



365
366
367
368
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 365

def create(scope, role_assignment_name, parameters, custom_headers:nil)
  response = create_async(scope, role_assignment_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_async(scope, role_assignment_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates a role assignment.

can be any REST resource instance. For example, use '/subscriptions/subscription-id/' for a subscription, '/subscriptions/subscription-id/resourceGroups/resource-group-name' for a resource group, and '/subscriptions/subscription-id/resourceGroups/resource-group-name/providers/resource-provider/resource-type/resource-name' for a resource. create. It can be any valid GUID. assignment. to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignment to create. The scope

  • role_assignment_name (String)

    The name of the role assignment to

  • parameters (RoleAssignmentCreateParameters)

    Parameters for the role

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 412

def create_async(scope, role_assignment_name, parameters, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'role_assignment_name is nil' if role_assignment_name.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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentCreateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleAssignmentName' => role_assignment_name},
      skip_encoding_path_params: {'scope' => scope},
      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
      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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignment.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_by_id(role_assignment_id, parameters, custom_headers: nil) ⇒ RoleAssignment

Creates a role assignment by ID.

assignment, including the scope, resource name and resource type. Use the format, /scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. Example: /subscriptions/subId/resourcegroups/rgname//providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. assignment. will be added to the HTTP request.

Parameters:

  • role_assignment_id (String)

    The fully qualified ID of the role

  • parameters (RoleAssignmentCreateParameters)

    Parameters for the role

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

    A hash of custom headers that

Returns:

  • (RoleAssignment)

    operation results.



683
684
685
686
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 683

def create_by_id(role_assignment_id, parameters, custom_headers:nil)
  response = create_by_id_async(role_assignment_id, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_by_id_async(role_assignment_id, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates a role assignment by ID.

assignment, including the scope, resource name and resource type. Use the format, /scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. Example: /subscriptions/subId/resourcegroups/rgname//providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. assignment. to the HTTP request.

Parameters:

  • role_assignment_id (String)

    The fully qualified ID of the role

  • parameters (RoleAssignmentCreateParameters)

    Parameters for the role

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 724

def create_by_id_async(role_assignment_id, parameters, custom_headers:nil)
  fail ArgumentError, 'role_assignment_id is nil' if role_assignment_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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentCreateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{roleAssignmentId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'roleAssignmentId' => role_assignment_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
      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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignment.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_by_id_with_http_info(role_assignment_id, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a role assignment by ID.

assignment, including the scope, resource name and resource type. Use the format, /scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. Example: /subscriptions/subId/resourcegroups/rgname//providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. assignment. will be added to the HTTP request.

Parameters:

  • role_assignment_id (String)

    The fully qualified ID of the role

  • parameters (RoleAssignmentCreateParameters)

    Parameters for the role

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



704
705
706
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 704

def create_by_id_with_http_info(role_assignment_id, parameters, custom_headers:nil)
  create_by_id_async(role_assignment_id, parameters, custom_headers:custom_headers).value!
end

#create_with_http_info(scope, role_assignment_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a role assignment.

can be any REST resource instance. For example, use '/subscriptions/subscription-id/' for a subscription, '/subscriptions/subscription-id/resourceGroups/resource-group-name' for a resource group, and '/subscriptions/subscription-id/resourceGroups/resource-group-name/providers/resource-provider/resource-type/resource-name' for a resource. create. It can be any valid GUID. assignment. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignment to create. The scope

  • role_assignment_name (String)

    The name of the role assignment to

  • parameters (RoleAssignmentCreateParameters)

    Parameters for the role

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



389
390
391
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 389

def create_with_http_info(scope, role_assignment_name, parameters, custom_headers:nil)
  create_async(scope, role_assignment_name, parameters, custom_headers:custom_headers).value!
end

#delete(scope, role_assignment_name, custom_headers: nil) ⇒ RoleAssignment

Deletes a role assignment.

delete. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignment to delete.

  • role_assignment_name (String)

    The name of the role assignment to

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

    A hash of custom headers that

Returns:

  • (RoleAssignment)

    operation results.



262
263
264
265
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 262

def delete(scope, role_assignment_name, custom_headers:nil)
  response = delete_async(scope, role_assignment_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#delete_async(scope, role_assignment_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a role assignment.

delete. to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignment to delete.

  • role_assignment_name (String)

    The name of the role assignment to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 293

def delete_async(scope, role_assignment_name, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'role_assignment_name is nil' if role_assignment_name.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.Authorization/roleAssignments/{roleAssignmentName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleAssignmentName' => role_assignment_name},
      skip_encoding_path_params: {'scope' => scope},
      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
      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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignment.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

#delete_by_id(role_assignment_id, custom_headers: nil) ⇒ RoleAssignment

Deletes a role assignment.

assignment, including the scope, resource name and resource type. Use the format, /scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. Example: /subscriptions/subId/resourcegroups/rgname//providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. will be added to the HTTP request.

Parameters:

  • role_assignment_id (String)

    The fully qualified ID of the role

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

    A hash of custom headers that

Returns:

  • (RoleAssignment)

    operation results.



579
580
581
582
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 579

def delete_by_id(role_assignment_id, custom_headers:nil)
  response = delete_by_id_async(role_assignment_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#delete_by_id_async(role_assignment_id, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a role assignment.

assignment, including the scope, resource name and resource type. Use the format, /scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. Example: /subscriptions/subId/resourcegroups/rgname//providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. to the HTTP request.

Parameters:

  • role_assignment_id (String)

    The fully qualified ID of the role

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 616

def delete_by_id_async(role_assignment_id, custom_headers:nil)
  fail ArgumentError, 'role_assignment_id is nil' if role_assignment_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 = '{roleAssignmentId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'roleAssignmentId' => role_assignment_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
      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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignment.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

#delete_by_id_with_http_info(role_assignment_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a role assignment.

assignment, including the scope, resource name and resource type. Use the format, /scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. Example: /subscriptions/subId/resourcegroups/rgname//providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. will be added to the HTTP request.

Parameters:

  • role_assignment_id (String)

    The fully qualified ID of the role

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



598
599
600
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 598

def delete_by_id_with_http_info(role_assignment_id, custom_headers:nil)
  delete_by_id_async(role_assignment_id, custom_headers:custom_headers).value!
end

#delete_with_http_info(scope, role_assignment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a role assignment.

delete. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignment to delete.

  • role_assignment_name (String)

    The name of the role assignment to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



278
279
280
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 278

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

#get(scope, role_assignment_name, custom_headers: nil) ⇒ RoleAssignment

Get the specified role assignment.

will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignment.

  • role_assignment_name (String)

    The name of the role assignment to get.

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

    A hash of custom headers that

Returns:

  • (RoleAssignment)

    operation results.



483
484
485
486
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 483

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

#get_async(scope, role_assignment_name, custom_headers: nil) ⇒ Concurrent::Promise

Get the specified role assignment.

to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignment.

  • role_assignment_name (String)

    The name of the role assignment to get.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 512

def get_async(scope, role_assignment_name, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'role_assignment_name is nil' if role_assignment_name.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.Authorization/roleAssignments/{roleAssignmentName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleAssignmentName' => role_assignment_name},
      skip_encoding_path_params: {'scope' => scope},
      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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignment.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_by_id(role_assignment_id, custom_headers: nil) ⇒ RoleAssignment

Gets a role assignment by ID.

assignment, including the scope, resource name and resource type. Use the format, /scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. Example: /subscriptions/subId/resourcegroups/rgname//providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. will be added to the HTTP request.

Parameters:

  • role_assignment_id (String)

    The fully qualified ID of the role

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

    A hash of custom headers that

Returns:

  • (RoleAssignment)

    operation results.



797
798
799
800
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 797

def get_by_id(role_assignment_id, custom_headers:nil)
  response = get_by_id_async(role_assignment_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_by_id_async(role_assignment_id, custom_headers: nil) ⇒ Concurrent::Promise

Gets a role assignment by ID.

assignment, including the scope, resource name and resource type. Use the format, /scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. Example: /subscriptions/subId/resourcegroups/rgname//providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. to the HTTP request.

Parameters:

  • role_assignment_id (String)

    The fully qualified ID of the role

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 834

def get_by_id_async(role_assignment_id, custom_headers:nil)
  fail ArgumentError, 'role_assignment_id is nil' if role_assignment_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 = '{roleAssignmentId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'roleAssignmentId' => role_assignment_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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignment.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_by_id_with_http_info(role_assignment_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a role assignment by ID.

assignment, including the scope, resource name and resource type. Use the format, /scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. Example: /subscriptions/subId/resourcegroups/rgname//providers/Microsoft.Authorization/roleAssignments/roleAssignmentName. will be added to the HTTP request.

Parameters:

  • role_assignment_id (String)

    The fully qualified ID of the role

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



816
817
818
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 816

def get_by_id_with_http_info(role_assignment_id, custom_headers:nil)
  get_by_id_async(role_assignment_id, custom_headers:custom_headers).value!
end

#get_with_http_info(scope, role_assignment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get the specified role assignment.

will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignment.

  • role_assignment_name (String)

    The name of the role assignment to get.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



498
499
500
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 498

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

#list(filter: nil, custom_headers: nil) ⇒ Array<RoleAssignment>

Gets all role assignments for the subscription.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (Array<RoleAssignment>)

    operation results.



897
898
899
900
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 897

def list(filter:nil, custom_headers:nil)
  first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_as_lazy(filter: nil, custom_headers: nil) ⇒ RoleAssignmentListResult

Gets all role assignments for the subscription.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

response.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (RoleAssignmentListResult)

    which provide lazy access to pages of the



1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1501

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

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

Gets all role assignments for the subscription.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 930

def list_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.Authorization/roleAssignments'

  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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentListResult.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_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter: nil, custom_headers: nil) ⇒ Array<RoleAssignment>

Gets role assignments for a resource.

provider. assignments for. $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource.

  • resource_name (String)

    The name of the resource to get role

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (Array<RoleAssignment>)

    operation results.



47
48
49
50
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 47

def list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
  first_page = list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter: nil, custom_headers: nil) ⇒ RoleAssignmentListResult

Gets role assignments for a resource.

provider. assignments for. $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource.

  • resource_name (String)

    The name of the resource to get role

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (RoleAssignmentListResult)

    which provide lazy access to pages of the



1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1452

def list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
  response = list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_for_resource_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter: nil, custom_headers: nil) ⇒ Concurrent::Promise

Gets role assignments for a resource.

provider. assignments for. $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource.

  • resource_name (String)

    The name of the resource to get role

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 94

def list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.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}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentListResult.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_for_resource_group(resource_group_name, filter: nil, custom_headers: nil) ⇒ Array<RoleAssignment>

Gets role assignments for a resource group.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (Array<RoleAssignment>)

    operation results.



164
165
166
167
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 164

def list_for_resource_group(resource_group_name, filter:nil, custom_headers:nil)
  first_page = list_for_resource_group_as_lazy(resource_group_name, filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_for_resource_group_as_lazy(resource_group_name, filter: nil, custom_headers: nil) ⇒ RoleAssignmentListResult

Gets role assignments for a resource group.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (RoleAssignmentListResult)

    which provide lazy access to pages of the



1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1477

def list_for_resource_group_as_lazy(resource_group_name, filter:nil, custom_headers:nil)
  response = list_for_resource_group_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_for_resource_group_async(resource_group_name, filter: nil, custom_headers: nil) ⇒ Concurrent::Promise

Gets role assignments for a resource group.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 199

def list_for_resource_group_async(resource_group_name, filter:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentListResult.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_for_resource_group_next(next_page_link, custom_headers: nil) ⇒ RoleAssignmentListResult

Gets role assignments for a resource group.

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:

  • (RoleAssignmentListResult)

    operation results.



1178
1179
1180
1181
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1178

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

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

Gets role assignments for a resource group.

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.



1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1207

def list_for_resource_group_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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentListResult.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_for_resource_group_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets role assignments for a resource group.

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.



1193
1194
1195
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1193

def list_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_for_resource_group_with_http_info(resource_group_name, filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets role assignments for a resource group.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



182
183
184
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 182

def list_for_resource_group_with_http_info(resource_group_name, filter:nil, custom_headers:nil)
  list_for_resource_group_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
end

#list_for_resource_next(next_page_link, custom_headers: nil) ⇒ RoleAssignmentListResult

Gets role assignments for a resource.

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:

  • (RoleAssignmentListResult)

    operation results.



1090
1091
1092
1093
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1090

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

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

Gets role assignments for a resource.

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.



1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1119

def list_for_resource_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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentListResult.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_for_resource_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets role assignments for a resource.

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.



1105
1106
1107
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1105

def list_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
  list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_for_resource_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets role assignments for a resource.

provider. assignments for. $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource.

  • resource_name (String)

    The name of the resource to get role

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



71
72
73
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 71

def list_for_resource_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
  list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers).value!
end

#list_for_scope(scope, filter: nil, custom_headers: nil) ⇒ Array<RoleAssignment>

Gets role assignments for a scope.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignments.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (Array<RoleAssignment>)

    operation results.



994
995
996
997
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 994

def list_for_scope(scope, filter:nil, custom_headers:nil)
  first_page = list_for_scope_as_lazy(scope, filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_for_scope_as_lazy(scope, filter: nil, custom_headers: nil) ⇒ RoleAssignmentListResult

Gets role assignments for a scope.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

response.

Parameters:

  • scope (String)

    The scope of the role assignments.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (RoleAssignmentListResult)

    which provide lazy access to pages of the



1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1526

def list_for_scope_as_lazy(scope, filter:nil, custom_headers:nil)
  response = list_for_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_for_scope_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

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

Gets role assignments for a scope.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignments.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1029

def list_for_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.Authorization/roleAssignments'

  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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentListResult.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_for_scope_next(next_page_link, custom_headers: nil) ⇒ RoleAssignmentListResult

Gets role assignments for a 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:

  • (RoleAssignmentListResult)

    operation results.



1354
1355
1356
1357
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1354

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

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

Gets role assignments for a 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.



1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1383

def list_for_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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentListResult.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_for_scope_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets role assignments for a 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.



1369
1370
1371
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1369

def list_for_scope_next_with_http_info(next_page_link, custom_headers:nil)
  list_for_scope_next_async(next_page_link, custom_headers:custom_headers).value!
end

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

Gets role assignments for a scope.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope of the role assignments.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1012
1013
1014
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1012

def list_for_scope_with_http_info(scope, filter:nil, custom_headers:nil)
  list_for_scope_async(scope, filter:filter, custom_headers:custom_headers).value!
end

#list_next(next_page_link, custom_headers: nil) ⇒ RoleAssignmentListResult

Gets all role assignments 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:

  • (RoleAssignmentListResult)

    operation results.



1266
1267
1268
1269
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1266

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

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

Gets all role assignments 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.



1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1295

def list_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::Authorization::Mgmt::V2015_07_01::Models::RoleAssignmentListResult.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_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all role assignments 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.



1281
1282
1283
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 1281

def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end

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

Gets all role assignments for the subscription.

$filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq id to return all role assignments at, above or below the scope for the specified principal. will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. Use

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



914
915
916
# File 'lib/2015-07-01/generated/azure_mgmt_authorization/role_assignments.rb', line 914

def list_with_http_info(filter:nil, custom_headers:nil)
  list_async(filter:filter, custom_headers:custom_headers).value!
end