Sha256: 0fba4a87068e5c00f1bbb3cb78e43b1c34abae23c13f967f7b53d0d4518f1f24

Contents?: true

Size: 1003 Bytes

Versions: 6

Compression:

Stored size: 1003 Bytes

Contents

# frozen_string_literal: true

module Aserto
  module Directory
    module V3
      module Exporter
        DATA_TYPE = {
          unknown: ::Aserto::Directory::Exporter::V3::Option::OPTION_UNKNOWN,
          objects: ::Aserto::Directory::Exporter::V3::Option::OPTION_DATA_OBJECTS,
          relations: ::Aserto::Directory::Exporter::V3::Option::OPTION_DATA_RELATIONS,
          all: ::Aserto::Directory::Exporter::V3::Option::OPTION_DATA
        }.freeze

        #
        # Exports directory data
        #
        # @param [String] data_type one of [:unknown, :objects, :relations, :all]
        #
        def export(data_type: :unknown)
          data = []
          operation = exporter.export(
            Aserto::Directory::Exporter::V3::ExportRequest.new(options: DATA_TYPE[data_type]),
            return_op: true
          )

          response = operation.execute
          response.each { |r| data.push(r) }
          operation.wait

          data
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
aserto-0.31.0 lib/aserto/directory/v3/exporter.rb
aserto-0.30.6 lib/aserto/directory/v3/exporter.rb
aserto-0.30.5 lib/aserto/directory/v3/exporter.rb
aserto-0.30.4 lib/aserto/directory/v3/exporter.rb
aserto-0.30.1 lib/aserto/directory/v3/exporter.rb
aserto-0.30.0 lib/aserto/directory/v3/exporter.rb