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
key
service. -
#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
.
21638 21639 21640 |
# File 'lib/ovirtsdk4/services.rb', line 21638 def add(key, opts = {}) internal_add(key, SshPublicKey, ADD, opts) end |
#key_service(id) ⇒ SshPublicKeyService
Locates the key
service.
21722 21723 21724 |
# File 'lib/ovirtsdk4/services.rb', line 21722 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
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.
21711 21712 21713 |
# File 'lib/ovirtsdk4/services.rb', line 21711 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
21733 21734 21735 21736 21737 21738 21739 21740 21741 21742 |
# File 'lib/ovirtsdk4/services.rb', line 21733 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 |