Class: Fog::Event::OpenStack::Real
- Inherits:
-
Object
- Object
- Fog::Event::OpenStack::Real
- Includes:
- OpenStack::Core
- Defined in:
- lib/fog/event/openstack.rb,
lib/fog/event/openstack/requests/get_event.rb,
lib/fog/event/openstack/requests/list_events.rb
Instance Attribute Summary
Attributes included from OpenStack::Core
#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_prefix, #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
- #get_event(message_id) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #list_events(options = []) ⇒ Object
- #set_api_path ⇒ Object
Methods included from OpenStack::Core
#credentials, #initialize_identity, #reload
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/fog/event/openstack.rb', line 91 def initialize( = {}) initialize_identity @openstack_service_type = [:openstack_service_type] || ['event'] @openstack_service_name = [:openstack_service_name] @openstack_endpoint_type = [:openstack_endpoint_type] || 'publicURL' @connection_options = [:connection_options] || {} authenticate set_api_path @persistent = [:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end |
Class Method Details
Instance Method Details
#get_event(message_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/event/openstack/requests/get_event.rb', line 5 def get_event() request( :expects => 200, :method => 'GET', :path => "events/#{}" ) 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/event/openstack/requests/list_events.rb', line 5 def list_events( = []) data = { 'q' => [] } .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 |
#set_api_path ⇒ Object
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/fog/event/openstack.rb', line 107 def set_api_path unless @path.match(SUPPORTED_VERSIONS) @path = "/" + Fog::OpenStack.get_supported_version( SUPPORTED_VERSIONS, @openstack_management_uri, @auth_token, @connection_options ) end end |