lib/gooddata/models/project.rb
# Transfer objects from one project to another
#
# @param [Array<GoodData::MdObject | String>, String, GoodData::MdObject] objects Any representation of the object or a list of those
# @param [Hash] options The options to migration.
# @option options [GoodData::Project | String | Array<String> | Array<GoodData::Project>] :project Project(s) to migrate to
# @option options [Number] :batch_size Number of projects that are migrated at the same time. Default is 10
#
# @return [Boolean | Array<Hash>] Return either true or throws exception if you passed only one project. If you provided an array returns list of hashes signifying sucees or failure. Take note that in case of list of projects it does not throw exception
Transfer objects from one project to another
Transfer objects from one project to another
def partial_md_export(objects, options = {})
      projects = options[:project]
      batch_size = options[:batch_size] || 10
      token = objects_export(objects)
      if projects.is_a?(Array)
        projects.each_slice(batch_size).flat_map do |batch|
          batch.pmap do |proj|
            begin
              target_project = client.projects(proj)
              target_project.objects_import(token, options)
              {
                project: target_project,
                result: true
              }
            rescue RestClient::Exception => e
              {
                project: proj,
                exception: e,
                result: false,
                reason: GoodData::Helpers.interpolate_error_message(MultiJson.load(e.response))
              }
            rescue GoodData::ObjectsImportError => e
              {
                project: target_project,
                result: false,
                reason: e.message
              }
            end
          end
        end
      else
        target_project = client.projects(projects)
        target_project.objects_import(token, options)
      end
    end
def partial_md_export ( objects , options = { } ) projects = options [ :project ] batch_size = options [ :batch_size ] || 10 token = objects_export ( objects ) if projects . is_a? ( Array ) projects . each_slice ( batch_size ) . flat_map do | batch | batch . pmap do | proj | begin target_project = client . projects ( proj ) target_project . objects_import ( token , options ) { project : target_project , result : true } rescue RestClient :: Exception => e { project : proj , exception : e , result : false , reason : GoodData :: Helpers . interpolate_error_message ( MultiJson . load ( e . response ) ) } rescue GoodData :: ObjectsImportError => e { project : target_project , result : false , reason : e . message } end end end else target_project = client . projects ( projects ) target_project . objects_import ( token , options ) end end
Transfer objects from one project to another
Transfer objects from one project to another
Return either true or throws exception if you passed only one project. If you provided an array returns list of hashes signifying sucees or failure. Take note that in case of list of projects it does not throw exception
Return either true or throws exception if you passed only one project . If you provided an array returns list of hashes signifying sucees or failure . Take note that in case of list of projects it does not throw exception
Boolean | Array<Hash>
objects
options
:batch_size Number of projects that are migrated at the same time. Default is 10
: batch_size Number of projects that are migrated at the same time . Default is 10
options The options to migration.
options The options to migration .