Class: Fog::Event::HuaweiCloud::Real
- Inherits:
-
Object
- Object
- Fog::Event::HuaweiCloud::Real
show all
- Includes:
- HuaweiCloud::Core
- Defined in:
- lib/fog/event/huaweicloud.rb,
lib/fog/event/huaweicloud/requests/get_event.rb,
lib/fog/event/huaweicloud/requests/list_events.rb
Instance Attribute Summary
#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #huaweicloud_cache_ttl, #huaweicloud_domain_id, #huaweicloud_domain_name, #huaweicloud_identity_prefix, #huaweicloud_path, #huaweicloud_project_domain, #huaweicloud_project_domain_id, #huaweicloud_project_id, #huaweicloud_user_domain, #huaweicloud_user_domain_id, #unscoped_token
Class Method Summary
collapse
Instance Method Summary
collapse
#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/huaweicloud.rb', line 91
def initialize(options = {})
initialize_identity options
@huaweicloud_service_type = options[:huaweicloud_service_type] || ['event']
@huaweicloud_service_name = options[:huaweicloud_service_name]
@huaweicloud_endpoint_type = options[:huaweicloud_endpoint_type] || 'publicURL'
@connection_options = options[:connection_options] || {}
authenticate
set_api_path
@persistent = options[:persistent] || false
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
end
|
Class Method Details
.not_found_class ⇒ Object
87
88
89
|
# File 'lib/fog/event/huaweicloud.rb', line 87
def self.not_found_class
Fog::Event::HuaweiCloud::NotFound
end
|
Instance Method Details
#get_event(message_id) ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/fog/event/huaweicloud/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/event/huaweicloud/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
|