Class: OvirtSDK4::EventSubscriptionsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(event_subscription, opts = {}) ⇒ EventSubscription
Add a new event-subscription to the system.
-
#event_subscription_service(id) ⇒ EventSubscriptionService
Reference to the service that manages a specific event-subscription.
-
#list(opts = {}) ⇒ Array<EventSubscription>
List the event-subscriptions for the provided user.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#add(event_subscription, opts = {}) ⇒ EventSubscription
Add a new event-subscription to the system.
An event-subscription is always added in the context of a user. For example, to add new
event-subscription for host_high_cpu_use
for user 123
, and have the notification
sent to the e-mail address: [email protected]
, send a request like this:
POST /ovirt-engine/api/users/123/eventsubscriptions
With a request body like this:
<event_subscription>
<event>host_high_cpu_use</event>
<address>[email protected]</address>
</event_subscription>
The event name will become the ID of the new event-subscription entity: GET …/api/users/123/eventsubscriptions/host_high_cpu_use
Note that no user id is provided in the request body. This is because the user-id (in this case 123) is already known to the API from the context. Note also that event-subscription entity contains notification-method field, but it is not provided either in the request body. This is because currently it’s always set to SMTP as SNMP notifications are still unsupported by the API layer.
8831 8832 8833 |
# File 'lib/ovirtsdk4/services.rb', line 8831 def add(event_subscription, opts = {}) internal_add(event_subscription, EventSubscription, ADD, opts) end |
#event_subscription_service(id) ⇒ EventSubscriptionService
Reference to the service that manages a specific event-subscription.
8899 8900 8901 |
# File 'lib/ovirtsdk4/services.rb', line 8899 def event_subscription_service(id) EventSubscriptionService.new(self, id) end |
#list(opts = {}) ⇒ Array<EventSubscription>
List the event-subscriptions for the provided user.
For example to list event-subscriptions for user 123
:
GET /ovirt-engine/api/users/123/event-subscriptions
<event-subscriptions>
<event-subscription href="/ovirt-engine/api/users/123/event-subscriptions/host_install_failed">
<event>host_install_failed</event>
<notification_method>smtp</notification_method>
<user href="/ovirt-engine/api/users/123" id="123"/>
<address>[email protected]</address>
</event-subscription>
<event-subscription href="/ovirt-engine/api/users/123/event-subscriptions/vm_paused">
<event>vm_paused</event>
<notification_method>smtp</notification_method>
<user href="/ovirt-engine/api/users/123" id="123"/>
<address>[email protected]</address>
</event-subscription>
</event-subscriptions>
8888 8889 8890 |
# File 'lib/ovirtsdk4/services.rb', line 8888 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 |
# File 'lib/ovirtsdk4/services.rb', line 8910 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return event_subscription_service(path) end return event_subscription_service(path[0..(index - 1)]).service(path[(index + 1)..-1]) end |