Sha256: c5aaa92bb3d3336c6127d2383a5268d4f71050c4c3165f946382a2048f0464e4

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 SynchronizeMeta < BaseAction
      DESCRIPTION = 'Synchronize Metadata'

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

        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::SynchronizationInfoType)), required: true

        description 'Additional Hidden Parameters'
        param :additional_hidden_params, instance_of(Type::HashType), required: false
      end

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

          client = params.gdc_gd_client
          development_client = params.development_client

          params.synchronize.each do |info|
            from = info.from
            to = info.to

            from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")
            to_projects = to.map do |entry|
              client.projects(entry[:pid])
            end

            GoodData::LCM.transfer_meta(from_project, to_projects)

            to_projects.each do |project|
              results << {
                from: from,
                to: project.pid,
                status: 'ok'
              }
            end
          end

          # Return results
          results
        end
      end
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
gooddata-2.3.1-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.3.1 lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.3.0-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.3.0 lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.2.0-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.2.0 lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.19-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.19 lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.17-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.17 lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.15-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.15 lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.14-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.14 lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.13-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.13 lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.12-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.12 lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.11-java lib/gooddata/lcm/actions/synchronize_meta.rb
gooddata-2.1.11 lib/gooddata/lcm/actions/synchronize_meta.rb