All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aeontronix.anypointsdk.cli.ImportCmd Maven / Gradle / Ivy

There is a newer version: 1.0.0-beta35
Show newest version
/*
 * Copyright (c) 2023. Aeontronix Inc
 */

package com.aeontronix.anypointsdk.cli;

import com.aeontronix.anypointsdk.export.AnypointExportFile;
import com.aeontronix.anypointsdk.export.ExportFilters;
import com.fasterxml.jackson.databind.ObjectMapper;
import picocli.CommandLine;

import java.io.File;
import java.util.Set;
import java.util.concurrent.Callable;

@CommandLine.Command(name = "import")
public class ImportCmd extends AbstractCmd implements Callable {
    @CommandLine.Parameters(defaultValue = "anypoint-export.json")
    private File file;
    @CommandLine.Option(names = {"-o"})
    private Set orgs;
    @CommandLine.Option(names = {"-e"})
    private Set envs;

    @Override
    public Integer call() throws Exception {
        ExportFilters exportFilters = new ExportFilters(orgs, envs);
        AnypointExportFile exportFile = new ObjectMapper().readValue(file, AnypointExportFile.class);
        exportFile.doImport(exportFilters, getClient());
        return 0;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy