Class: Fog::Metric::HuaweiCloud::Real
- Inherits:
-
Object
- Object
- Fog::Metric::HuaweiCloud::Real
- Includes:
- HuaweiCloud::Core
- Defined in:
- lib/fog/metric/huaweicloud.rb,
lib/fog/metric/huaweicloud/requests/get_metric.rb,
lib/fog/metric/huaweicloud/requests/get_resource.rb,
lib/fog/metric/huaweicloud/requests/list_metrics.rb,
lib/fog/metric/huaweicloud/requests/list_resources.rb,
lib/fog/metric/huaweicloud/requests/get_metric_measures.rb,
lib/fog/metric/huaweicloud/requests/get_resource_metric_measures.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get_metric(metric_id) ⇒ Object
- #get_metric_measures(metric_id, options = {}) ⇒ Object
- #get_resource(resource_id) ⇒ Object
- #get_resource_metric_measures(resource_id, metric_name, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #list_metrics(options = {}) ⇒ Object
- #list_resources(type = "generic", options = {}) ⇒ Object
- #set_api_path ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/fog/metric/huaweicloud.rb', line 97 def initialize( = {}) initialize_identity @huaweicloud_service_type = [:huaweicloud_service_type] || ['metric'] @huaweicloud_service_name = [:huaweicloud_service_name] @huaweicloud_endpoint_type = [:huaweicloud_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
.not_found_class ⇒ Object
93 94 95 |
# File 'lib/fog/metric/huaweicloud.rb', line 93 def self.not_found_class Fog::Metric::HuaweiCloud::NotFound end |
Instance Method Details
#get_metric(metric_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/metric/huaweicloud/requests/get_metric.rb', line 5 def get_metric(metric_id) request( :expects => 200, :method => 'GET', :path => "metric/#{metric_id}" ) end |
#get_metric_measures(metric_id, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/metric/huaweicloud/requests/get_metric_measures.rb', line 5 def get_metric_measures(metric_id, = {}) request( :expects => 200, :method => 'GET', :path => "metric/#{metric_id}/measures", :query => , ) end |
#get_resource(resource_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/metric/huaweicloud/requests/get_resource.rb', line 5 def get_resource(resource_id) request( :expects => 200, :method => 'GET', :path => "resource/generic/#{resource_id}" ) end |
#get_resource_metric_measures(resource_id, metric_name, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/metric/huaweicloud/requests/get_resource_metric_measures.rb', line 5 def get_resource_metric_measures(resource_id, metric_name, = {}) request( :expects => 200, :method => 'GET', :path => "resource/generic/#{resource_id}/metric/#{metric_name}/measures", :query => ) end |
#list_metrics(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/metric/huaweicloud/requests/list_metrics.rb', line 5 def list_metrics( = {}) request( :expects => 200, :method => 'GET', :path => 'metric', :query => ) end |
#list_resources(type = "generic", options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/metric/huaweicloud/requests/list_resources.rb', line 5 def list_resources(type = "generic", = {}) request( :expects => 200, :method => 'GET', :path => "resource/#{Fog::HuaweiCloud.escape(type)}", :query => ) end |
#set_api_path ⇒ Object
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/fog/metric/huaweicloud.rb', line 113 def set_api_path unless @path.match(SUPPORTED_VERSIONS) @path = Fog::HuaweiCloud.get_supported_version_path( SUPPORTED_VERSIONS, @huaweicloud_management_uri, @auth_token, @connection_options ) end end |