Class: Fog::OpenStack::Event::Real

Inherits:
Object
  • Object
show all
Includes:
Core
Defined in:
lib/fog/openstack/event.rb,
lib/fog/openstack/event/requests/get_event.rb,
lib/fog/openstack/event/requests/list_events.rb

Instance Attribute Summary

Attributes included from Core

#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_api_version, #openstack_project_domain, #openstack_project_domain_id, #openstack_project_id, #openstack_user_domain, #openstack_user_domain_id, #unscoped_token

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Core

#credentials, #initialize, #reload

Class Method Details

.not_found_classObject



87
88
89
# File 'lib/fog/openstack/event.rb', line 87

def self.not_found_class
  Fog::OpenStack::Event::NotFound
end

Instance Method Details

#default_path_prefixObject



91
92
93
# File 'lib/fog/openstack/event.rb', line 91

def default_path_prefix
  'v2'
end

#default_service_typeObject



95
96
97
# File 'lib/fog/openstack/event.rb', line 95

def default_service_type
  %w[event]
end

#get_event(message_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/event/requests/get_event.rb', line 5

def get_event(message_id)
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => "events/#{message_id}"
  )
end

#list_events(options = []) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/openstack/event/requests/list_events.rb', line 5

def list_events(options = [])
  data = {
    'q' => []
  }

  options.each do |opt|
    filter = {}

    ['field', 'op', 'value'].each do |key|
      filter[key] = opt[key] if opt[key]
    end

    data['q'] << filter unless filter.empty?
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'GET',
    :path    => 'events'
  )
end