use of org.apache.commons.cli.DefaultParser in project athenz by yahoo.
the class HttpExampleClient method parseCommandLine.
private static CommandLine parseCommandLine(String[] args) {
Options options = new Options();
Option domain = new Option("d", "domain", true, "domain name");
domain.setRequired(true);
options.addOption(domain);
Option service = new Option("s", "service", true, "service name");
service.setRequired(true);
options.addOption(service);
Option privateKey = new Option("p", "pkey", true, "private key path");
privateKey.setRequired(true);
options.addOption(privateKey);
Option keyId = new Option("k", "keyid", true, "key identifier");
keyId.setRequired(true);
options.addOption(keyId);
Option url = new Option("u", "url", true, "request url");
url.setRequired(true);
options.addOption(url);
Option ztsUrl = new Option("z", "ztsurl", true, "ZTS Server url");
ztsUrl.setRequired(true);
options.addOption(ztsUrl);
Option providerDomain = new Option("pd", "provider-domain", true, "Provider domain name");
providerDomain.setRequired(true);
options.addOption(providerDomain);
Option providerRole = new Option("pr", "provider-role", true, "Provider role name");
providerRole.setRequired(true);
options.addOption(providerRole);
CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
CommandLine cmd = null;
try {
cmd = parser.parse(options, args);
} catch (ParseException e) {
System.out.println(e.getMessage());
formatter.printHelp("http-example-client", options);
System.exit(1);
}
return cmd;
}
use of org.apache.commons.cli.DefaultParser in project athenz by yahoo.
the class InstanceClientRefresh method parseCommandLine.
private static CommandLine parseCommandLine(String[] args) {
Options options = new Options();
Option domain = new Option("d", "domain", true, "domain name");
domain.setRequired(true);
options.addOption(domain);
Option service = new Option("s", "service", true, "service name");
service.setRequired(true);
options.addOption(service);
Option provider = new Option("p", "provider", true, "provider name");
provider.setRequired(true);
options.addOption(provider);
Option instance = new Option("i", "instance", true, "instance id");
instance.setRequired(true);
options.addOption(instance);
Option dnsSuffix = new Option("dns", "dnssuffix", true, "provider dns suffix");
dnsSuffix.setRequired(true);
options.addOption(dnsSuffix);
Option instanceKey = new Option("ik", "instancekey", true, "instance private key path");
instanceKey.setRequired(true);
options.addOption(instanceKey);
Option ztsUrl = new Option("z", "ztsurl", true, "ZTS Server url");
ztsUrl.setRequired(true);
options.addOption(ztsUrl);
CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
CommandLine cmd = null;
try {
cmd = parser.parse(options, args);
} catch (ParseException e) {
System.out.println(e.getMessage());
formatter.printHelp("instance-client", options);
System.exit(1);
}
return cmd;
}
use of org.apache.commons.cli.DefaultParser in project athenz by yahoo.
the class HttpExampleClient method parseCommandLine.
private static CommandLine parseCommandLine(String[] args) {
Options options = new Options();
Option domain = new Option("d", "domain", true, "domain name");
domain.setRequired(true);
options.addOption(domain);
Option service = new Option("s", "service", true, "service name");
service.setRequired(true);
options.addOption(service);
Option privateKey = new Option("p", "pkey", true, "private key path");
privateKey.setRequired(true);
options.addOption(privateKey);
Option keyId = new Option("k", "keyid", true, "key identifier");
keyId.setRequired(true);
options.addOption(keyId);
Option url = new Option("u", "url", true, "request url");
url.setRequired(true);
options.addOption(url);
CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
CommandLine cmd = null;
try {
cmd = parser.parse(options, args);
} catch (ParseException e) {
System.out.println(e.getMessage());
formatter.printHelp("http-example-client", options);
System.exit(1);
}
return cmd;
}
use of org.apache.commons.cli.DefaultParser in project athenz by yahoo.
the class ZTSAWSCredsClient method parseCommandLine.
private static CommandLine parseCommandLine(String[] args) {
Options options = new Options();
Option domain = new Option("d", "domain", true, "domain name");
domain.setRequired(true);
options.addOption(domain);
Option role = new Option("r", "role", true, "role name");
role.setRequired(true);
options.addOption(role);
Option key = new Option("k", "key", true, "private key path");
key.setRequired(true);
options.addOption(key);
Option cert = new Option("c", "cert", true, "certficate path");
cert.setRequired(true);
options.addOption(cert);
Option trustStore = new Option("t", "trustStorePath", true, "CA TrustStore path");
trustStore.setRequired(true);
options.addOption(trustStore);
Option trustStorePassword = new Option("p", "trustStorePassword", true, "CA TrustStore password");
trustStorePassword.setRequired(true);
options.addOption(trustStorePassword);
Option ztsUrl = new Option("z", "ztsurl", true, "ZTS Server url");
ztsUrl.setRequired(true);
options.addOption(ztsUrl);
CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
CommandLine cmd = null;
try {
cmd = parser.parse(options, args);
} catch (ParseException e) {
System.out.println(e.getMessage());
formatter.printHelp("zts-aws-creds-client", options);
System.exit(1);
}
return cmd;
}
use of org.apache.commons.cli.DefaultParser in project athenz by yahoo.
the class HttpTLSClient method parseCommandLine.
private static CommandLine parseCommandLine(String[] args) {
Options options = new Options();
Option key = new Option("k", "key", true, "private key path");
key.setRequired(true);
options.addOption(key);
Option cert = new Option("c", "cert", true, "certficate path");
cert.setRequired(true);
options.addOption(cert);
Option trustStore = new Option("t", "trustStorePath", true, "CA TrustStore path");
trustStore.setRequired(true);
options.addOption(trustStore);
Option trustStorePassword = new Option("p", "trustStorePassword", true, "CA TrustStore password");
trustStorePassword.setRequired(true);
options.addOption(trustStorePassword);
Option ztsUrl = new Option("u", "url", true, "HTTP Server url");
ztsUrl.setRequired(true);
options.addOption(ztsUrl);
CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
CommandLine cmd = null;
try {
cmd = parser.parse(options, args);
} catch (ParseException e) {
System.out.println(e.getMessage());
formatter.printHelp("zts-tls-client", options);
System.exit(1);
}
return cmd;
}
Aggregations