Method: GoodData::Project#export_clone

Defined in:
lib/gooddata/models/project.rb

#export_clone(options = {}) ⇒ String

Export a clone from a project to be later imported. If you do not want to do anything special and you do not need fine grained controle use clone method which does all the heavy lifting for you.

Parameters:

  • (defaults to: {})

    Export options

Options Hash (options):

  • :data (Boolean)

    Clone project with data

  • :users (Boolean)

    Clone project with users

  • :authorized_users (String)

    Comma separated logins of authorized users. Users that can use the export

  • :exclude_schedules (Boolean)

    Specifies whether to include scheduled notifications in the export

  • :cross_data_center_export (Boolean)

    Specifies whether export can be used in any data center

Returns:

  • token of the export



919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
# File 'lib/gooddata/models/project.rb', line 919

def export_clone(options = {})
  with_data = options[:data].nil? ? true : options[:data]
  with_users = options[:users].nil? ? false : options[:users]

  export = {
    :exportProject => {
      :exportUsers => with_users ? 1 : 0,
      :exportData => with_data ? 1 : 0
    }
  }
  export[:exportProject][:authorizedUsers] = options[:authorized_users] if options[:authorized_users]
  if options[:exclude_schedules]
    exclude_notifications = options[:exclude_schedules] ? 1 : 0
    export[:exportProject][:excludeSchedules] = exclude_notifications
  end
  if options[:cross_data_center_export]
    cross_data_center = options[:cross_data_center_export] ? 1 : 0
    export[:exportProject][:crossDataCenterExport] = cross_data_center
  end

  result = client.post("/gdc/md/#{obj_id}/maintenance/export", export)
  status_url = result['exportArtifact']['status']['uri']
  polling_result = client.poll_on_response(status_url) do |body|
    body['taskState']['status'] == 'RUNNING'
  end

  ensure_clone_task_ok(polling_result, GoodData::ExportCloneError)
  result['exportArtifact']['token']
end