/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getScriptBootstrapAction() != null) sb.append("ScriptBootstrapAction: ").append(getScriptBootstrapAction()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof BootstrapActionConfig == false) return false; BootstrapActionConfig other = (BootstrapActionConfig) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getScriptBootstrapAction() == null ^ this.getScriptBootstrapAction() == null) return false; if (other.getScriptBootstrapAction() != null && other.getScriptBootstrapAction().equals(this.getScriptBootstrapAction()) == false) return false; return true; }
/** * Marshall the given parameter object. */ public void marshall(BootstrapActionConfig bootstrapActionConfig, ProtocolMarshaller protocolMarshaller) { if (bootstrapActionConfig == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(bootstrapActionConfig.getName(), NAME_BINDING); protocolMarshaller.marshall(bootstrapActionConfig.getScriptBootstrapAction(), SCRIPTBOOTSTRAPACTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
/** * Create a new run-if bootstrap action which lets you conditionally run bootstrap actions. * @param condition The condition to evaluate, if true the bootstrap action executes. * @param config The bootstrap action to execute in case of successful evaluation. * @return A BootstrapActionConfig to be provided when running a job flow. */ public BootstrapActionConfig newRunIf(String condition, BootstrapActionConfig config) { List<String> args = config.getScriptBootstrapAction().getArgs(); args.add(0, condition); args.add(1, config.getScriptBootstrapAction().getPath()); return new BootstrapActionConfig() .withName("Run If, " + config.getName()) .withScriptBootstrapAction(new ScriptBootstrapActionConfig() .withPath("s3://" + bucket + "/bootstrap-actions/run-if") .withArgs(args)); }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getScriptBootstrapAction() != null) sb.append("ScriptBootstrapAction: ").append(getScriptBootstrapAction()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof BootstrapActionConfig == false) return false; BootstrapActionConfig other = (BootstrapActionConfig) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getScriptBootstrapAction() == null ^ this.getScriptBootstrapAction() == null) return false; if (other.getScriptBootstrapAction() != null && other.getScriptBootstrapAction().equals(this.getScriptBootstrapAction()) == false) return false; return true; }
/** * Marshall the given parameter object. */ public void marshall(BootstrapActionConfig bootstrapActionConfig, ProtocolMarshaller protocolMarshaller) { if (bootstrapActionConfig == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(bootstrapActionConfig.getName(), NAME_BINDING); protocolMarshaller.marshall(bootstrapActionConfig.getScriptBootstrapAction(), SCRIPTBOOTSTRAPACTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
/** * Create a new run-if bootstrap action which lets you conditionally run bootstrap actions. * @param condition The condition to evaluate, if true the bootstrap action executes. * @param config The bootstrap action to execute in case of successful evaluation. * @return A BootstrapActionConfig to be provided when running a job flow. */ public BootstrapActionConfig newRunIf(String condition, BootstrapActionConfig config) { List<String> args = config.getScriptBootstrapAction().getArgs(); args.add(0, condition); args.add(1, config.getScriptBootstrapAction().getPath()); return new BootstrapActionConfig() .withName("Run If, " + config.getName()) .withScriptBootstrapAction(new ScriptBootstrapActionConfig() .withPath("s3://" + bucket + "/bootstrap-actions/run-if") .withArgs(args)); }
assertEquals("emr.encryption.script", bootstrapActionConfig.getName()); ScriptBootstrapActionConfig scriptBootstrapAction = bootstrapActionConfig.getScriptBootstrapAction(); assertEquals("s3:////herd_SCRIPTS/encrypt_disks.sh", scriptBootstrapAction.getPath()); assertEquals("emr.aws.configure.daemon", bootstrapActionConfig.getName()); ScriptBootstrapActionConfig scriptBootstrapAction = bootstrapActionConfig.getScriptBootstrapAction(); assertEquals("s3://elasticmapreduce/bootstrap-actions/configure-daemons", scriptBootstrapAction.getPath()); assertEquals("emr.aws.configure.hadoop", bootstrapActionConfig.getName()); ScriptBootstrapActionConfig scriptBootstrapAction = bootstrapActionConfig.getScriptBootstrapAction(); assertEquals("s3://us-east-1.elasticmapreduce/bootstrap-actions/configure-hadoop", scriptBootstrapAction.getPath()); assertEquals("scriptDefinitionAllName1", bootstrapActionConfig.getName()); ScriptBootstrapActionConfig scriptBootstrapAction = bootstrapActionConfig.getScriptBootstrapAction(); assertEquals("scriptDefinitionAllLocation1", scriptBootstrapAction.getPath()); assertEquals("scriptDefinitionMasterName1", bootstrapActionConfig.getName()); ScriptBootstrapActionConfig scriptBootstrapAction = bootstrapActionConfig.getScriptBootstrapAction(); assertEquals("s3://elasticmapreduce/bootstrap-actions/run-if", scriptBootstrapAction.getPath());