Sha256: 914b53189df51f2196e93bdb5b5a0e6f93aebe413ddde85c0d34c1026271f42a

Contents?: true

Size: 1.78 KB

Versions: 66

Compression:

Stored size: 1.78 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require_relative 'base_action'

module GoodData
  module LCM2
    class CollectComputedAttributeMetrics < BaseAction
      DESCRIPTION = 'Collect all metrics which is used in computed attributes in development projects'

      PARAMS = define_params(self) do
        description 'Client Used for Connecting to GD'
        param :gdc_gd_client, instance_of(Type::GdClientType), required: false

        description 'Client used to connecting to development domain'
        param :development_client, instance_of(Type::GdClientType), required: true

        description 'Synchronization Info'
        param :synchronize, array_of(instance_of(Type::AnyType)), required: true, generated: true
      end

      class << self
        def call(params)
          results = []
          development_client = params.development_client

          synchronize = params.synchronize.pmap do |info|
            from = info.from
            from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")

            metric_uris = from_project.computed_attributes.flat_map { |a| a.using('metric').map { |m| m['link'] } }

            info[:transfer_uris] ||= []
            info[:transfer_uris] += metric_uris

            results += metric_uris.map do |uri|
              {
                project: from,
                transfer_uri: uri
              }
            end

            info
          end

          {
            results: results,
            params: {
              synchronize: synchronize
            }
          }
        end
      end
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
gooddata-2.1.0-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-2.1.0 lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-2.0.1-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-2.0.1 lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-2.0.0-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-2.0.0 lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.6-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.6 lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.5-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.5 lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.4-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.4 lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.3-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.3 lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.2-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.2 lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.1-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.1 lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.0-java lib/gooddata/lcm/actions/collect_ca_metrics.rb
gooddata-1.3.0 lib/gooddata/lcm/actions/collect_ca_metrics.rb