@Override public void duplicate(KubectlExecSpec duplicate) { // nothing more to do super.duplicate(duplicate); }
public KubectlExecResult exec(String command) { KubectlExecSpec spec = new KubectlExecSpec(); spec.setCommandLine(command); return exec(spec); }
@Input public OutputFormat getOutputFormat() { return spec.getOutputFormat(); }
protected KubectlExecResult exec(KubectlExecSpec execSpec1) { final KubectlExecSpec spec = execSpec1.duplicate(); List<String> commandLine = spec.getCommandLine(); int pipeIndex = commandLine.indexOf("|"); if (pipeIndex == -1) { if (spec.getOutputFormat() == OutputFormat.JSON) { commandLine.add(" --output=json"); project.exec(execSpec -> { client.configureExec(execSpec, spec); if (spec.getInput() != null) { execSpec.setStandardInput(new ByteArrayInputStream(spec.getInput().getBytes())); if (spec.getOutputFormat() != OutputFormat.CONSOLE) { execSpec.setStandardOutput(outputStream); KubectlExecSpec leftSpec = spec.duplicate(); leftSpec.setCommandLine(commandLine.subList(0, pipeIndex)); leftSpec.setOutputFormat(OutputFormat.TEXT); KubectlExecResult leftResult = exec(leftSpec); KubectlExecSpec rightSpec = spec.duplicate(); rightSpec.setCommandLine(commandLine.subList(pipeIndex + 1, commandLine.size())); rightSpec.setInput(leftResult.getText()); return exec(rightSpec);
@Override protected KubectlExecSpec newSpec() { return new KubectlExecSpec(); }
public void setOutputFormat(OutputFormat outputFormat) { spec.setOutputFormat(outputFormat); }
protected KubectlExecResult exec(KubectlExecSpec execSpec1) { final KubectlExecSpec spec = execSpec1.duplicate(); List<String> commandLine = spec.getCommandLine(); int pipeIndex = commandLine.indexOf("|"); if (pipeIndex == -1) { if (spec.getOutputFormat() == OutputFormat.JSON) { commandLine.add(" --output=json"); project.exec(execSpec -> { client.configureExec(execSpec, spec); if (spec.getInput() != null) { execSpec.setStandardInput(new ByteArrayInputStream(spec.getInput().getBytes())); if (spec.getOutputFormat() != OutputFormat.CONSOLE) { execSpec.setStandardOutput(outputStream); KubectlExecSpec leftSpec = spec.duplicate(); leftSpec.setCommandLine(commandLine.subList(0, pipeIndex)); leftSpec.setOutputFormat(OutputFormat.TEXT); KubectlExecResult leftResult = exec(leftSpec); KubectlExecSpec rightSpec = spec.duplicate(); rightSpec.setCommandLine(commandLine.subList(pipeIndex + 1, commandLine.size())); rightSpec.setInput(leftResult.getText()); return exec(rightSpec);
protected KubectlExecSpec createSpec() { return new KubectlExecSpec(); }
public void setOutputFormat(OutputFormat outputFormat) { spec.setOutputFormat(outputFormat); }
public KubectlExecResult exec(String command) { KubectlExecSpec spec = new KubectlExecSpec(); spec.setCommandLine(command); return exec(spec); }
@Override protected KubectlExecSpec newSpec() { return new KubectlExecSpec(); }
@Input public OutputFormat getOutputFormat() { return spec.getOutputFormat(); }
private void exec(String command) { KubectlExtension extension = getExtension(); KubectlExecSpec spec = new KubectlExecSpec(); spec.setCommandLine(command); extension.exec(spec); }
protected KubectlExecSpec createSpec() { return new KubectlExecSpec(); }
private void exec(String command) { KubectlExtension extension = getExtension(); KubectlExecSpec spec = new KubectlExecSpec(); spec.setCommandLine(command); extension.exec(spec); }
public KubectlExecResult exec(Closure<KubectlExecSpec> closure) { KubectlExecSpec spec = new KubectlExecSpec(); project.configure(spec, closure); return exec(spec); } }
public String getToken(String serviceAccount) { KubectlExecSpec spec = new KubectlExecSpec(); spec.setCommandLine(client.getBinName() + " describe serviceaccount " + serviceAccount); KubectlExecResult result = exec(spec); String tokenName = result.getProperty("tokens"); spec.setCommandLine(client.getBinName() + " describe secret " + tokenName); result = exec(spec); return result.getProperty("token"); }
public KubectlExecResult exec(Closure<KubectlExecSpec> closure) { KubectlExecSpec spec = new KubectlExecSpec(); project.configure(spec, closure); return exec(spec); } }
public String getToken(String serviceAccount) { KubectlExecSpec spec = new KubectlExecSpec(); spec.setCommandLine(client.getBinName() + " describe serviceaccount " + serviceAccount); KubectlExecResult result = exec(spec); String tokenName = result.getProperty("tokens"); spec.setCommandLine(client.getBinName() + " describe secret " + tokenName); result = exec(spec); return result.getProperty("token"); }