Sha256: 7fb4f6b60b72b1b197b1ae48ffb17271a0a625541c71f7b3e0e5e2f16434b9b4

Contents?: true

Size: 1.91 KB

Versions: 4

Compression:

Stored size: 1.91 KB

Contents

module Fog
  module Metric
    class HuaweiCloud
      class Real
        def get_metric(metric_id)
          request(
              :expects => 200,
              :method  => 'GET',
              :path    => "metric/#{metric_id}"
          )
        end
      end

      class Mock
        def get_metric(_metric_id)
          response = Excon::Response.new
          response.status = 200
          response.body = {
              "archive_policy" => {
                  "aggregation_methods" => [
                      "95pct",
                      "median",
                      "max",
                      "count",
                      "std",
                      "sum",
                      "min",
                      "mean"
                  ],
                  "back_window" => 0,
                  "definition"  => [
                      {
                          "granularity" => "0:00:01",
                          "points"      => 3600,
                          "timespan"    => "1:00:00"
                      },
                      {
                          "granularity" => "0:01:00",
                          "points"      => 10080,
                          "timespan"    => "7 days, 0:00:00"
                      },
                      {
                          "granularity" => "1:00:00",
                          "points"      => 8760,
                          "timespan"    => "365 days, 0:00:00"
                      }
                  ],
                  "name" => "high"
              },
              "created_by_project_id" => "384a902b-6856-424c-9d30-6b5325ac20a5",
              "created_by_user_id"    => "d040def9-fd68-45f0-a19f-253014f397c3",
              "id"                    => "8bbb5f02-b654-4861-b19e-d372fcdca124",
              "name"     => nil,
              "resource" => nil,
              "unit"     => nil
          }
          response
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/metric/huaweicloud/requests/get_metric.rb
fog-huaweicloud-0.0.2 lib/fog/metric/huaweicloud/requests/get_metric.rb
fog-huaweicloud-0.1.3 lib/fog/metric/huaweicloud/requests/get_metric.rb
fog-huaweicloud-0.1.2 lib/fog/metric/huaweicloud/requests/get_metric.rb