Class: OvirtSDK4::RoleService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#get(opts = {}) ⇒ Role

Get the role.

GET /ovirt-engine/api/roles/123

You will receive XML response like this one:

<role id="123">
  <name>MyRole</name>
  <description>MyRole description</description>
  <link href="/ovirt-engine/api/roles/123/permits" rel="permits"/>
  <administrative>true</administrative>
  <mutable>false</mutable>
</role>

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



18727
18728
18729
# File 'lib/ovirtsdk4/services.rb', line 18727

def get(opts = {})
  internal_get(GET, opts)
end

#permits_servicePermitsService

Sub-resource locator method, returns permits service.

Returns:



18817
18818
18819
# File 'lib/ovirtsdk4/services.rb', line 18817

def permits_service
  @permits_service ||= PermitsService.new(self, 'permits')
end

#remove(opts = {}) ⇒ Object

Removes the role.

To remove the role you need to know its id, then send request like this:

DELETE /ovirt-engine/api/roles/{role_id}

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.



18759
18760
18761
# File 'lib/ovirtsdk4/services.rb', line 18759

def remove(opts = {})
  internal_remove(REMOVE, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.

Raises:



18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
# File 'lib/ovirtsdk4/services.rb', line 18828

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'permits'
    return permits_service
  end
  if path.start_with?('permits/')
    return permits_service.service(path[8..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

#update(role, opts = {}) ⇒ Role

Updates a role. You are allowed to update name, description and administrative attributes after role is created. Within this endpoint you can’t add or remove roles permits you need to use service that manages permits of role.

For example to update role’s name, description and administrative attributes send a request like this:

PUT /ovirt-engine/api/roles/123

With a request body like this:

<role>
  <name>MyNewRoleName</name>
  <description>My new description of the role</description>
  <administrative>true</administrative>
</group>

Parameters:

  • role (Role)

    Updated role.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the update should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



18808
18809
18810
# File 'lib/ovirtsdk4/services.rb', line 18808

def update(role, opts = {})
  internal_update(role, Role, UPDATE, opts)
end