Class: OvirtSDK4::SshPublicKeysService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(key, opts = {}) ⇒ SshPublicKey
Adds a new
key. -
#key_service(id) ⇒ SshPublicKeyService
Locates the
keyservice. -
#list(opts = {}) ⇒ Array<SshPublicKey>
Returns a list of SSH public keys of the user.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#add(key, opts = {}) ⇒ SshPublicKey
Adds a new key.
21354 21355 21356 |
# File 'lib/ovirtsdk4/services.rb', line 21354 def add(key, opts = {}) internal_add(key, SshPublicKey, ADD, opts) end |
#key_service(id) ⇒ SshPublicKeyService
Locates the key service.
21435 21436 21437 |
# File 'lib/ovirtsdk4/services.rb', line 21435 def key_service(id) SshPublicKeyService.new(self, id) end |
#list(opts = {}) ⇒ Array<SshPublicKey>
Returns a list of SSH public keys of the user.
For example, to retrieve the list of SSH keys of user with identifier 123,
send a request like this:
GET /ovirt-engine/api/users/123/sshpublickeys HTTP/1.1
The result will be the following XML document:
<ssh_public_keys>
<ssh_public_key href="/ovirt-engine/api/users/123/sshpublickeys/456" id="456">
<content>ssh-rsa ...</content>
<user href="/ovirt-engine/api/users/123" id="123"/>
</ssh_public_key>
</ssh_public_keys>
Or the following JSON object
{
"ssh_public_key": [
{
"content": "ssh-rsa ...",
"user": {
"href": "/ovirt-engine/api/users/123",
"id": "123"
},
"href": "/ovirt-engine/api/users/123/sshpublickeys/456",
"id": "456"
}
]
}
The order of the returned list of keys is not guaranteed.
21424 21425 21426 |
# File 'lib/ovirtsdk4/services.rb', line 21424 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
21446 21447 21448 21449 21450 21451 21452 21453 21454 21455 |
# File 'lib/ovirtsdk4/services.rb', line 21446 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return key_service(path) end return key_service(path[0..(index - 1)]).service(path[(index + 1)..-1]) end |