Class: Azure::Armrest::RoleService
- Inherits:
-
ArmrestService
- Object
- ArmrestService
- Azure::Armrest::RoleService
- Defined in:
- lib/azure/armrest/role.rb
Overview
Abstract base class for use by role related service classes.
Direct Known Subclasses
Azure::Armrest::Role::AssignmentService, Azure::Armrest::Role::DefinitionService
Instance Attribute Summary
Attributes inherited from ArmrestService
#api_version, #armrest_configuration, #base_url, #provider, #service_name
Instance Method Summary collapse
-
#get_by_id(role_id, options = {}) ⇒ Object
(also: #get_by_resource)
Gets information for the role assignment via a resource string ID.
-
#get_by_name(role_name, options = {}) ⇒ Object
(also: #get)
Gets information for the role assignment by name, where the “name” is really just the last portion (GUID) of an ID string.
-
#list(resource_group, options = {}) ⇒ Object
(also: #list_for_resource_group)
List all role assignments for the given
resource_group
. -
#list_all(options = {}) ⇒ Object
(also: #list_for_subscription)
List all role assignments for the current subscription.
-
#list_for_resource(resource, options = {}) ⇒ Object
List all role assignments for the given
resource
.
Methods inherited from ArmrestService
configure, #get_provider, #get_subscription, #initialize, #list_locations, #list_resource_groups, #list_resources, #list_subscriptions, #locations, #poll, #tags, #tenants, #wait
Constructor Details
This class inherits a constructor from Azure::Armrest::ArmrestService
Instance Method Details
#get_by_id(role_id, options = {}) ⇒ Object Also known as: get_by_resource
Gets information for the role assignment via a resource string ID.
36 37 38 39 40 |
# File 'lib/azure/armrest/role.rb', line 36 def get_by_id(role_id, = {}) url = build_url(.merge(:resource => role_id)) response = rest_get(url) model_class.new(response.body) end |
#get_by_name(role_name, options = {}) ⇒ Object Also known as: get
Gets information for the role assignment by name, where the “name” is really just the last portion (GUID) of an ID string.
26 27 28 29 30 |
# File 'lib/azure/armrest/role.rb', line 26 def get_by_name(role_name, = {}) url = build_url(.merge(:subscription => true), role_name) response = rest_get(url) model_class.new(response.body) end |
#list(resource_group, options = {}) ⇒ Object Also known as: list_for_resource_group
List all role assignments for the given resource_group
.
56 57 58 59 60 |
# File 'lib/azure/armrest/role.rb', line 56 def list(resource_group, = {}) url = build_url(.merge(:resource_group => resource_group)) response = rest_get(url) Azure::Armrest::ArmrestCollection.create_from_response(response, model_class) end |
#list_all(options = {}) ⇒ Object Also known as: list_for_subscription
List all role assignments for the current subscription.
46 47 48 49 50 |
# File 'lib/azure/armrest/role.rb', line 46 def list_all( = {}) url = build_url(.merge(:subscription => true)) response = rest_get(url) Azure::Armrest::ArmrestCollection.create_from_response(response, model_class) end |
#list_for_resource(resource, options = {}) ⇒ Object
List all role assignments for the given resource
.
Example:
vms = Azure::Armrest::VirtualMachineService.new(conf)
ads = Azure::Armrest::Role::AssignmentService.new(conf)
vm = vms.get('some_vm', 'some_group')
ads.list_for_resource(vm.id)
74 75 76 77 78 |
# File 'lib/azure/armrest/role.rb', line 74 def list_for_resource(resource, = {}) url = build_url(.merge(:resource => resource)) response = rest_get(url) Azure::Armrest::ArmrestCollection.create_from_response(response, model_class) end |