class OvirtSDK4::EventSubscriptionsService

Constants

ADD
LIST

Public Instance Methods

add(event_subscription, opts = {}) click to toggle source

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: `a@b.com`, send a request like this:

.… POST /ovirt-engine/api/users/123/eventsubscriptions .…

With a request body like this:

source,xml

<event_subscription>

<event>host_high_cpu_use</event>
<address>a@b.com</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.

@param event_subscription [EventSubscription] The added event-subscription.

@param opts [Hash] Additional options.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (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.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [EventSubscription]

# File lib/ovirtsdk4/services.rb, line 8851
def add(event_subscription, opts = {})
  internal_add(event_subscription, EventSubscription, ADD, opts)
end
event_subscription_service(id) click to toggle source

Reference to the service that manages a specific event-subscription.

@param id [String] The identifier of the `event_subscription`.

@return [EventSubscriptionService] A reference to the `event_subscription` service.

# File lib/ovirtsdk4/services.rb, line 8919
def event_subscription_service(id)
  EventSubscriptionService.new(self, id)
end
list(opts = {}) click to toggle source

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 .…

source,xml

<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>a@b.com</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>a@b.com</address>
</event-subscription>

</event-subscriptions>


@param opts [Hash] Additional options.

@option opts [String] :follow Indicates which inner links should be followed. The objects referenced by these links will be fetched as part

of the current request. See <<documents/003_common_concepts/follow, here>> for details.

@option opts [Integer] :max Sets the maximum number of event-subscriptions to return.

If not specified all the event-subscriptions are returned.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (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.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Array<EventSubscription>]

# File lib/ovirtsdk4/services.rb, line 8908
def list(opts = {})
  internal_get(LIST, opts)
end
service(path) click to toggle source

Locates the service corresponding to the given path.

@param path [String] The path of the service.

@return [Service] A reference to the service.

# File lib/ovirtsdk4/services.rb, line 8930
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