/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.xiaomi.infra.galaxy.emr.thrift;
import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;
import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-8-18")
public class CreateClusterRequest implements libthrift091.TBase<CreateClusterRequest, CreateClusterRequest._Fields>, java.io.Serializable, Cloneable, Comparable<CreateClusterRequest> {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("CreateClusterRequest");
private static final libthrift091.protocol.TField NAME_FIELD_DESC = new libthrift091.protocol.TField("name", libthrift091.protocol.TType.STRING, (short)1);
private static final libthrift091.protocol.TField AUTO_TERMINATE_FIELD_DESC = new libthrift091.protocol.TField("autoTerminate", libthrift091.protocol.TType.BOOL, (short)2);
private static final libthrift091.protocol.TField TERMINATION_PROTECTED_FIELD_DESC = new libthrift091.protocol.TField("terminationProtected", libthrift091.protocol.TType.BOOL, (short)3);
private static final libthrift091.protocol.TField REGION_FIELD_DESC = new libthrift091.protocol.TField("region", libthrift091.protocol.TType.STRING, (short)4);
private static final libthrift091.protocol.TField PURPOSE_FIELD_DESC = new libthrift091.protocol.TField("purpose", libthrift091.protocol.TType.STRING, (short)5);
private static final libthrift091.protocol.TField KEY_PAIR_FIELD_DESC = new libthrift091.protocol.TField("keyPair", libthrift091.protocol.TType.STRING, (short)6);
private static final libthrift091.protocol.TField ADD_INSTANCE_GROUP_REQUESTS_FIELD_DESC = new libthrift091.protocol.TField("addInstanceGroupRequests", libthrift091.protocol.TType.LIST, (short)7);
private static final libthrift091.protocol.TField SUBMIT_JOB_REQUESTS_FIELD_DESC = new libthrift091.protocol.TField("submitJobRequests", libthrift091.protocol.TType.LIST, (short)8);
private static final libthrift091.protocol.TField SOFT_CONFIG_FIELD_DESC = new libthrift091.protocol.TField("softConfig", libthrift091.protocol.TType.STRUCT, (short)9);
private static final libthrift091.protocol.TField TAGS_FIELD_DESC = new libthrift091.protocol.TField("tags", libthrift091.protocol.TType.MAP, (short)10);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CreateClusterRequestStandardSchemeFactory());
schemes.put(TupleScheme.class, new CreateClusterRequestTupleSchemeFactory());
}
public String name; // required
public boolean autoTerminate; // optional
public boolean terminationProtected; // optional
public String region; // optional
public String purpose; // optional
public String keyPair; // optional
public List<AddInstanceGroupRequest> addInstanceGroupRequests; // optional
public List<SubmitJobRequest> submitJobRequests; // optional
public ApplicationSuite softConfig; // optional
public Map<String,String> tags; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
NAME((short)1, "name"),
AUTO_TERMINATE((short)2, "autoTerminate"),
TERMINATION_PROTECTED((short)3, "terminationProtected"),
REGION((short)4, "region"),
PURPOSE((short)5, "purpose"),
KEY_PAIR((short)6, "keyPair"),
ADD_INSTANCE_GROUP_REQUESTS((short)7, "addInstanceGroupRequests"),
SUBMIT_JOB_REQUESTS((short)8, "submitJobRequests"),
SOFT_CONFIG((short)9, "softConfig"),
TAGS((short)10, "tags");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NAME
return NAME;
case 2: // AUTO_TERMINATE
return AUTO_TERMINATE;
case 3: // TERMINATION_PROTECTED
return TERMINATION_PROTECTED;
case 4: // REGION
return REGION;
case 5: // PURPOSE
return PURPOSE;
case 6: // KEY_PAIR
return KEY_PAIR;
case 7: // ADD_INSTANCE_GROUP_REQUESTS
return ADD_INSTANCE_GROUP_REQUESTS;
case 8: // SUBMIT_JOB_REQUESTS
return SUBMIT_JOB_REQUESTS;
case 9: // SOFT_CONFIG
return SOFT_CONFIG;
case 10: // TAGS
return TAGS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __AUTOTERMINATE_ISSET_ID = 0;
private static final int __TERMINATIONPROTECTED_ISSET_ID = 1;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.AUTO_TERMINATE,_Fields.TERMINATION_PROTECTED,_Fields.REGION,_Fields.PURPOSE,_Fields.KEY_PAIR,_Fields.ADD_INSTANCE_GROUP_REQUESTS,_Fields.SUBMIT_JOB_REQUESTS,_Fields.SOFT_CONFIG,_Fields.TAGS};
public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NAME, new libthrift091.meta_data.FieldMetaData("name", libthrift091.TFieldRequirementType.REQUIRED,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.AUTO_TERMINATE, new libthrift091.meta_data.FieldMetaData("autoTerminate", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.BOOL)));
tmpMap.put(_Fields.TERMINATION_PROTECTED, new libthrift091.meta_data.FieldMetaData("terminationProtected", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.BOOL)));
tmpMap.put(_Fields.REGION, new libthrift091.meta_data.FieldMetaData("region", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.PURPOSE, new libthrift091.meta_data.FieldMetaData("purpose", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.KEY_PAIR, new libthrift091.meta_data.FieldMetaData("keyPair", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.ADD_INSTANCE_GROUP_REQUESTS, new libthrift091.meta_data.FieldMetaData("addInstanceGroupRequests", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.ListMetaData(libthrift091.protocol.TType.LIST,
new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, AddInstanceGroupRequest.class))));
tmpMap.put(_Fields.SUBMIT_JOB_REQUESTS, new libthrift091.meta_data.FieldMetaData("submitJobRequests", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.ListMetaData(libthrift091.protocol.TType.LIST,
new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, SubmitJobRequest.class))));
tmpMap.put(_Fields.SOFT_CONFIG, new libthrift091.meta_data.FieldMetaData("softConfig", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, ApplicationSuite.class)));
tmpMap.put(_Fields.TAGS, new libthrift091.meta_data.FieldMetaData("tags", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.MapMetaData(libthrift091.protocol.TType.MAP,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING),
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(CreateClusterRequest.class, metaDataMap);
}
public CreateClusterRequest() {
this.autoTerminate = false;
this.terminationProtected = true;
}
public CreateClusterRequest(
String name)
{
this();
this.name = name;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CreateClusterRequest(CreateClusterRequest other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetName()) {
this.name = other.name;
}
this.autoTerminate = other.autoTerminate;
this.terminationProtected = other.terminationProtected;
if (other.isSetRegion()) {
this.region = other.region;
}
if (other.isSetPurpose()) {
this.purpose = other.purpose;
}
if (other.isSetKeyPair()) {
this.keyPair = other.keyPair;
}
if (other.isSetAddInstanceGroupRequests()) {
List<AddInstanceGroupRequest> __this__addInstanceGroupRequests = new ArrayList<AddInstanceGroupRequest>(other.addInstanceGroupRequests.size());
for (AddInstanceGroupRequest other_element : other.addInstanceGroupRequests) {
__this__addInstanceGroupRequests.add(new AddInstanceGroupRequest(other_element));
}
this.addInstanceGroupRequests = __this__addInstanceGroupRequests;
}
if (other.isSetSubmitJobRequests()) {
List<SubmitJobRequest> __this__submitJobRequests = new ArrayList<SubmitJobRequest>(other.submitJobRequests.size());
for (SubmitJobRequest other_element : other.submitJobRequests) {
__this__submitJobRequests.add(new SubmitJobRequest(other_element));
}
this.submitJobRequests = __this__submitJobRequests;
}
if (other.isSetSoftConfig()) {
this.softConfig = new ApplicationSuite(other.softConfig);
}
if (other.isSetTags()) {
Map<String,String> __this__tags = new HashMap<String,String>(other.tags);
this.tags = __this__tags;
}
}
public CreateClusterRequest deepCopy() {
return new CreateClusterRequest(this);
}
@Override
public void clear() {
this.name = null;
this.autoTerminate = false;
this.terminationProtected = true;
this.region = null;
this.purpose = null;
this.keyPair = null;
this.addInstanceGroupRequests = null;
this.submitJobRequests = null;
this.softConfig = null;
this.tags = null;
}
public String getName() {
return this.name;
}
public CreateClusterRequest setName(String name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
public boolean isAutoTerminate() {
return this.autoTerminate;
}
public CreateClusterRequest setAutoTerminate(boolean autoTerminate) {
this.autoTerminate = autoTerminate;
setAutoTerminateIsSet(true);
return this;
}
public void unsetAutoTerminate() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AUTOTERMINATE_ISSET_ID);
}
/** Returns true if field autoTerminate is set (has been assigned a value) and false otherwise */
public boolean isSetAutoTerminate() {
return EncodingUtils.testBit(__isset_bitfield, __AUTOTERMINATE_ISSET_ID);
}
public void setAutoTerminateIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AUTOTERMINATE_ISSET_ID, value);
}
public boolean isTerminationProtected() {
return this.terminationProtected;
}
public CreateClusterRequest setTerminationProtected(boolean terminationProtected) {
this.terminationProtected = terminationProtected;
setTerminationProtectedIsSet(true);
return this;
}
public void unsetTerminationProtected() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TERMINATIONPROTECTED_ISSET_ID);
}
/** Returns true if field terminationProtected is set (has been assigned a value) and false otherwise */
public boolean isSetTerminationProtected() {
return EncodingUtils.testBit(__isset_bitfield, __TERMINATIONPROTECTED_ISSET_ID);
}
public void setTerminationProtectedIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TERMINATIONPROTECTED_ISSET_ID, value);
}
public String getRegion() {
return this.region;
}
public CreateClusterRequest setRegion(String region) {
this.region = region;
return this;
}
public void unsetRegion() {
this.region = null;
}
/** Returns true if field region is set (has been assigned a value) and false otherwise */
public boolean isSetRegion() {
return this.region != null;
}
public void setRegionIsSet(boolean value) {
if (!value) {
this.region = null;
}
}
public String getPurpose() {
return this.purpose;
}
public CreateClusterRequest setPurpose(String purpose) {
this.purpose = purpose;
return this;
}
public void unsetPurpose() {
this.purpose = null;
}
/** Returns true if field purpose is set (has been assigned a value) and false otherwise */
public boolean isSetPurpose() {
return this.purpose != null;
}
public void setPurposeIsSet(boolean value) {
if (!value) {
this.purpose = null;
}
}
public String getKeyPair() {
return this.keyPair;
}
public CreateClusterRequest setKeyPair(String keyPair) {
this.keyPair = keyPair;
return this;
}
public void unsetKeyPair() {
this.keyPair = null;
}
/** Returns true if field keyPair is set (has been assigned a value) and false otherwise */
public boolean isSetKeyPair() {
return this.keyPair != null;
}
public void setKeyPairIsSet(boolean value) {
if (!value) {
this.keyPair = null;
}
}
public int getAddInstanceGroupRequestsSize() {
return (this.addInstanceGroupRequests == null) ? 0 : this.addInstanceGroupRequests.size();
}
public java.util.Iterator<AddInstanceGroupRequest> getAddInstanceGroupRequestsIterator() {
return (this.addInstanceGroupRequests == null) ? null : this.addInstanceGroupRequests.iterator();
}
public void addToAddInstanceGroupRequests(AddInstanceGroupRequest elem) {
if (this.addInstanceGroupRequests == null) {
this.addInstanceGroupRequests = new ArrayList<AddInstanceGroupRequest>();
}
this.addInstanceGroupRequests.add(elem);
}
public List<AddInstanceGroupRequest> getAddInstanceGroupRequests() {
return this.addInstanceGroupRequests;
}
public CreateClusterRequest setAddInstanceGroupRequests(List<AddInstanceGroupRequest> addInstanceGroupRequests) {
this.addInstanceGroupRequests = addInstanceGroupRequests;
return this;
}
public void unsetAddInstanceGroupRequests() {
this.addInstanceGroupRequests = null;
}
/** Returns true if field addInstanceGroupRequests is set (has been assigned a value) and false otherwise */
public boolean isSetAddInstanceGroupRequests() {
return this.addInstanceGroupRequests != null;
}
public void setAddInstanceGroupRequestsIsSet(boolean value) {
if (!value) {
this.addInstanceGroupRequests = null;
}
}
public int getSubmitJobRequestsSize() {
return (this.submitJobRequests == null) ? 0 : this.submitJobRequests.size();
}
public java.util.Iterator<SubmitJobRequest> getSubmitJobRequestsIterator() {
return (this.submitJobRequests == null) ? null : this.submitJobRequests.iterator();
}
public void addToSubmitJobRequests(SubmitJobRequest elem) {
if (this.submitJobRequests == null) {
this.submitJobRequests = new ArrayList<SubmitJobRequest>();
}
this.submitJobRequests.add(elem);
}
public List<SubmitJobRequest> getSubmitJobRequests() {
return this.submitJobRequests;
}
public CreateClusterRequest setSubmitJobRequests(List<SubmitJobRequest> submitJobRequests) {
this.submitJobRequests = submitJobRequests;
return this;
}
public void unsetSubmitJobRequests() {
this.submitJobRequests = null;
}
/** Returns true if field submitJobRequests is set (has been assigned a value) and false otherwise */
public boolean isSetSubmitJobRequests() {
return this.submitJobRequests != null;
}
public void setSubmitJobRequestsIsSet(boolean value) {
if (!value) {
this.submitJobRequests = null;
}
}
public ApplicationSuite getSoftConfig() {
return this.softConfig;
}
public CreateClusterRequest setSoftConfig(ApplicationSuite softConfig) {
this.softConfig = softConfig;
return this;
}
public void unsetSoftConfig() {
this.softConfig = null;
}
/** Returns true if field softConfig is set (has been assigned a value) and false otherwise */
public boolean isSetSoftConfig() {
return this.softConfig != null;
}
public void setSoftConfigIsSet(boolean value) {
if (!value) {
this.softConfig = null;
}
}
public int getTagsSize() {
return (this.tags == null) ? 0 : this.tags.size();
}
public void putToTags(String key, String val) {
if (this.tags == null) {
this.tags = new HashMap<String,String>();
}
this.tags.put(key, val);
}
public Map<String,String> getTags() {
return this.tags;
}
public CreateClusterRequest setTags(Map<String,String> tags) {
this.tags = tags;
return this;
}
public void unsetTags() {
this.tags = null;
}
/** Returns true if field tags is set (has been assigned a value) and false otherwise */
public boolean isSetTags() {
return this.tags != null;
}
public void setTagsIsSet(boolean value) {
if (!value) {
this.tags = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
if (value == null) {
unsetName();
} else {
setName((String)value);
}
break;
case AUTO_TERMINATE:
if (value == null) {
unsetAutoTerminate();
} else {
setAutoTerminate((Boolean)value);
}
break;
case TERMINATION_PROTECTED:
if (value == null) {
unsetTerminationProtected();
} else {
setTerminationProtected((Boolean)value);
}
break;
case REGION:
if (value == null) {
unsetRegion();
} else {
setRegion((String)value);
}
break;
case PURPOSE:
if (value == null) {
unsetPurpose();
} else {
setPurpose((String)value);
}
break;
case KEY_PAIR:
if (value == null) {
unsetKeyPair();
} else {
setKeyPair((String)value);
}
break;
case ADD_INSTANCE_GROUP_REQUESTS:
if (value == null) {
unsetAddInstanceGroupRequests();
} else {
setAddInstanceGroupRequests((List<AddInstanceGroupRequest>)value);
}
break;
case SUBMIT_JOB_REQUESTS:
if (value == null) {
unsetSubmitJobRequests();
} else {
setSubmitJobRequests((List<SubmitJobRequest>)value);
}
break;
case SOFT_CONFIG:
if (value == null) {
unsetSoftConfig();
} else {
setSoftConfig((ApplicationSuite)value);
}
break;
case TAGS:
if (value == null) {
unsetTags();
} else {
setTags((Map<String,String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
return getName();
case AUTO_TERMINATE:
return Boolean.valueOf(isAutoTerminate());
case TERMINATION_PROTECTED:
return Boolean.valueOf(isTerminationProtected());
case REGION:
return getRegion();
case PURPOSE:
return getPurpose();
case KEY_PAIR:
return getKeyPair();
case ADD_INSTANCE_GROUP_REQUESTS:
return getAddInstanceGroupRequests();
case SUBMIT_JOB_REQUESTS:
return getSubmitJobRequests();
case SOFT_CONFIG:
return getSoftConfig();
case TAGS:
return getTags();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME:
return isSetName();
case AUTO_TERMINATE:
return isSetAutoTerminate();
case TERMINATION_PROTECTED:
return isSetTerminationProtected();
case REGION:
return isSetRegion();
case PURPOSE:
return isSetPurpose();
case KEY_PAIR:
return isSetKeyPair();
case ADD_INSTANCE_GROUP_REQUESTS:
return isSetAddInstanceGroupRequests();
case SUBMIT_JOB_REQUESTS:
return isSetSubmitJobRequests();
case SOFT_CONFIG:
return isSetSoftConfig();
case TAGS:
return isSetTags();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CreateClusterRequest)
return this.equals((CreateClusterRequest)that);
return false;
}
public boolean equals(CreateClusterRequest that) {
if (that == null)
return false;
boolean this_present_name = true && this.isSetName();
boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_autoTerminate = true && this.isSetAutoTerminate();
boolean that_present_autoTerminate = true && that.isSetAutoTerminate();
if (this_present_autoTerminate || that_present_autoTerminate) {
if (!(this_present_autoTerminate && that_present_autoTerminate))
return false;
if (this.autoTerminate != that.autoTerminate)
return false;
}
boolean this_present_terminationProtected = true && this.isSetTerminationProtected();
boolean that_present_terminationProtected = true && that.isSetTerminationProtected();
if (this_present_terminationProtected || that_present_terminationProtected) {
if (!(this_present_terminationProtected && that_present_terminationProtected))
return false;
if (this.terminationProtected != that.terminationProtected)
return false;
}
boolean this_present_region = true && this.isSetRegion();
boolean that_present_region = true && that.isSetRegion();
if (this_present_region || that_present_region) {
if (!(this_present_region && that_present_region))
return false;
if (!this.region.equals(that.region))
return false;
}
boolean this_present_purpose = true && this.isSetPurpose();
boolean that_present_purpose = true && that.isSetPurpose();
if (this_present_purpose || that_present_purpose) {
if (!(this_present_purpose && that_present_purpose))
return false;
if (!this.purpose.equals(that.purpose))
return false;
}
boolean this_present_keyPair = true && this.isSetKeyPair();
boolean that_present_keyPair = true && that.isSetKeyPair();
if (this_present_keyPair || that_present_keyPair) {
if (!(this_present_keyPair && that_present_keyPair))
return false;
if (!this.keyPair.equals(that.keyPair))
return false;
}
boolean this_present_addInstanceGroupRequests = true && this.isSetAddInstanceGroupRequests();
boolean that_present_addInstanceGroupRequests = true && that.isSetAddInstanceGroupRequests();
if (this_present_addInstanceGroupRequests || that_present_addInstanceGroupRequests) {
if (!(this_present_addInstanceGroupRequests && that_present_addInstanceGroupRequests))
return false;
if (!this.addInstanceGroupRequests.equals(that.addInstanceGroupRequests))
return false;
}
boolean this_present_submitJobRequests = true && this.isSetSubmitJobRequests();
boolean that_present_submitJobRequests = true && that.isSetSubmitJobRequests();
if (this_present_submitJobRequests || that_present_submitJobRequests) {
if (!(this_present_submitJobRequests && that_present_submitJobRequests))
return false;
if (!this.submitJobRequests.equals(that.submitJobRequests))
return false;
}
boolean this_present_softConfig = true && this.isSetSoftConfig();
boolean that_present_softConfig = true && that.isSetSoftConfig();
if (this_present_softConfig || that_present_softConfig) {
if (!(this_present_softConfig && that_present_softConfig))
return false;
if (!this.softConfig.equals(that.softConfig))
return false;
}
boolean this_present_tags = true && this.isSetTags();
boolean that_present_tags = true && that.isSetTags();
if (this_present_tags || that_present_tags) {
if (!(this_present_tags && that_present_tags))
return false;
if (!this.tags.equals(that.tags))
return false;
}
return true;
}
@Override
public int hashCode() {
List<Object> list = new ArrayList<Object>();
boolean present_name = true && (isSetName());
list.add(present_name);
if (present_name)
list.add(name);
boolean present_autoTerminate = true && (isSetAutoTerminate());
list.add(present_autoTerminate);
if (present_autoTerminate)
list.add(autoTerminate);
boolean present_terminationProtected = true && (isSetTerminationProtected());
list.add(present_terminationProtected);
if (present_terminationProtected)
list.add(terminationProtected);
boolean present_region = true && (isSetRegion());
list.add(present_region);
if (present_region)
list.add(region);
boolean present_purpose = true && (isSetPurpose());
list.add(present_purpose);
if (present_purpose)
list.add(purpose);
boolean present_keyPair = true && (isSetKeyPair());
list.add(present_keyPair);
if (present_keyPair)
list.add(keyPair);
boolean present_addInstanceGroupRequests = true && (isSetAddInstanceGroupRequests());
list.add(present_addInstanceGroupRequests);
if (present_addInstanceGroupRequests)
list.add(addInstanceGroupRequests);
boolean present_submitJobRequests = true && (isSetSubmitJobRequests());
list.add(present_submitJobRequests);
if (present_submitJobRequests)
list.add(submitJobRequests);
boolean present_softConfig = true && (isSetSoftConfig());
list.add(present_softConfig);
if (present_softConfig)
list.add(softConfig);
boolean present_tags = true && (isSetTags());
list.add(present_tags);
if (present_tags)
list.add(tags);
return list.hashCode();
}
@Override
public int compareTo(CreateClusterRequest other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.name, other.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAutoTerminate()).compareTo(other.isSetAutoTerminate());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAutoTerminate()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.autoTerminate, other.autoTerminate);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTerminationProtected()).compareTo(other.isSetTerminationProtected());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTerminationProtected()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.terminationProtected, other.terminationProtected);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRegion()).compareTo(other.isSetRegion());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRegion()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.region, other.region);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPurpose()).compareTo(other.isSetPurpose());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPurpose()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.purpose, other.purpose);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetKeyPair()).compareTo(other.isSetKeyPair());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetKeyPair()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.keyPair, other.keyPair);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAddInstanceGroupRequests()).compareTo(other.isSetAddInstanceGroupRequests());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAddInstanceGroupRequests()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.addInstanceGroupRequests, other.addInstanceGroupRequests);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSubmitJobRequests()).compareTo(other.isSetSubmitJobRequests());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSubmitJobRequests()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.submitJobRequests, other.submitJobRequests);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSoftConfig()).compareTo(other.isSetSoftConfig());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSoftConfig()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.softConfig, other.softConfig);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTags()).compareTo(other.isSetTags());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTags()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.tags, other.tags);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CreateClusterRequest(");
boolean first = true;
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
sb.append(this.name);
}
first = false;
if (isSetAutoTerminate()) {
if (!first) sb.append(", ");
sb.append("autoTerminate:");
sb.append(this.autoTerminate);
first = false;
}
if (isSetTerminationProtected()) {
if (!first) sb.append(", ");
sb.append("terminationProtected:");
sb.append(this.terminationProtected);
first = false;
}
if (isSetRegion()) {
if (!first) sb.append(", ");
sb.append("region:");
if (this.region == null) {
sb.append("null");
} else {
sb.append(this.region);
}
first = false;
}
if (isSetPurpose()) {
if (!first) sb.append(", ");
sb.append("purpose:");
if (this.purpose == null) {
sb.append("null");
} else {
sb.append(this.purpose);
}
first = false;
}
if (isSetKeyPair()) {
if (!first) sb.append(", ");
sb.append("keyPair:");
if (this.keyPair == null) {
sb.append("null");
} else {
sb.append(this.keyPair);
}
first = false;
}
if (isSetAddInstanceGroupRequests()) {
if (!first) sb.append(", ");
sb.append("addInstanceGroupRequests:");
if (this.addInstanceGroupRequests == null) {
sb.append("null");
} else {
sb.append(this.addInstanceGroupRequests);
}
first = false;
}
if (isSetSubmitJobRequests()) {
if (!first) sb.append(", ");
sb.append("submitJobRequests:");
if (this.submitJobRequests == null) {
sb.append("null");
} else {
sb.append(this.submitJobRequests);
}
first = false;
}
if (isSetSoftConfig()) {
if (!first) sb.append(", ");
sb.append("softConfig:");
if (this.softConfig == null) {
sb.append("null");
} else {
sb.append(this.softConfig);
}
first = false;
}
if (isSetTags()) {
if (!first) sb.append(", ");
sb.append("tags:");
if (this.tags == null) {
sb.append("null");
} else {
sb.append(this.tags);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws libthrift091.TException {
// check for required fields
if (name == null) {
throw new libthrift091.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
}
// check for sub-struct validity
if (softConfig != null) {
softConfig.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out)));
} catch (libthrift091.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in)));
} catch (libthrift091.TException te) {
throw new java.io.IOException(te);
}
}
private static class CreateClusterRequestStandardSchemeFactory implements SchemeFactory {
public CreateClusterRequestStandardScheme getScheme() {
return new CreateClusterRequestStandardScheme();
}
}
private static class CreateClusterRequestStandardScheme extends StandardScheme<CreateClusterRequest> {
public void read(libthrift091.protocol.TProtocol iprot, CreateClusterRequest struct) throws libthrift091.TException {
libthrift091.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == libthrift091.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NAME
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // AUTO_TERMINATE
if (schemeField.type == libthrift091.protocol.TType.BOOL) {
struct.autoTerminate = iprot.readBool();
struct.setAutoTerminateIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // TERMINATION_PROTECTED
if (schemeField.type == libthrift091.protocol.TType.BOOL) {
struct.terminationProtected = iprot.readBool();
struct.setTerminationProtectedIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // REGION
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.region = iprot.readString();
struct.setRegionIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // PURPOSE
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.purpose = iprot.readString();
struct.setPurposeIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // KEY_PAIR
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.keyPair = iprot.readString();
struct.setKeyPairIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // ADD_INSTANCE_GROUP_REQUESTS
if (schemeField.type == libthrift091.protocol.TType.LIST) {
{
libthrift091.protocol.TList _list42 = iprot.readListBegin();
struct.addInstanceGroupRequests = new ArrayList<AddInstanceGroupRequest>(_list42.size);
AddInstanceGroupRequest _elem43;
for (int _i44 = 0; _i44 < _list42.size; ++_i44)
{
_elem43 = new AddInstanceGroupRequest();
_elem43.read(iprot);
struct.addInstanceGroupRequests.add(_elem43);
}
iprot.readListEnd();
}
struct.setAddInstanceGroupRequestsIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 8: // SUBMIT_JOB_REQUESTS
if (schemeField.type == libthrift091.protocol.TType.LIST) {
{
libthrift091.protocol.TList _list45 = iprot.readListBegin();
struct.submitJobRequests = new ArrayList<SubmitJobRequest>(_list45.size);
SubmitJobRequest _elem46;
for (int _i47 = 0; _i47 < _list45.size; ++_i47)
{
_elem46 = new SubmitJobRequest();
_elem46.read(iprot);
struct.submitJobRequests.add(_elem46);
}
iprot.readListEnd();
}
struct.setSubmitJobRequestsIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 9: // SOFT_CONFIG
if (schemeField.type == libthrift091.protocol.TType.STRUCT) {
struct.softConfig = new ApplicationSuite();
struct.softConfig.read(iprot);
struct.setSoftConfigIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 10: // TAGS
if (schemeField.type == libthrift091.protocol.TType.MAP) {
{
libthrift091.protocol.TMap _map48 = iprot.readMapBegin();
struct.tags = new HashMap<String,String>(2*_map48.size);
String _key49;
String _val50;
for (int _i51 = 0; _i51 < _map48.size; ++_i51)
{
_key49 = iprot.readString();
_val50 = iprot.readString();
struct.tags.put(_key49, _val50);
}
iprot.readMapEnd();
}
struct.setTagsIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(libthrift091.protocol.TProtocol oprot, CreateClusterRequest struct) throws libthrift091.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeString(struct.name);
oprot.writeFieldEnd();
}
if (struct.isSetAutoTerminate()) {
oprot.writeFieldBegin(AUTO_TERMINATE_FIELD_DESC);
oprot.writeBool(struct.autoTerminate);
oprot.writeFieldEnd();
}
if (struct.isSetTerminationProtected()) {
oprot.writeFieldBegin(TERMINATION_PROTECTED_FIELD_DESC);
oprot.writeBool(struct.terminationProtected);
oprot.writeFieldEnd();
}
if (struct.region != null) {
if (struct.isSetRegion()) {
oprot.writeFieldBegin(REGION_FIELD_DESC);
oprot.writeString(struct.region);
oprot.writeFieldEnd();
}
}
if (struct.purpose != null) {
if (struct.isSetPurpose()) {
oprot.writeFieldBegin(PURPOSE_FIELD_DESC);
oprot.writeString(struct.purpose);
oprot.writeFieldEnd();
}
}
if (struct.keyPair != null) {
if (struct.isSetKeyPair()) {
oprot.writeFieldBegin(KEY_PAIR_FIELD_DESC);
oprot.writeString(struct.keyPair);
oprot.writeFieldEnd();
}
}
if (struct.addInstanceGroupRequests != null) {
if (struct.isSetAddInstanceGroupRequests()) {
oprot.writeFieldBegin(ADD_INSTANCE_GROUP_REQUESTS_FIELD_DESC);
{
oprot.writeListBegin(new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, struct.addInstanceGroupRequests.size()));
for (AddInstanceGroupRequest _iter52 : struct.addInstanceGroupRequests)
{
_iter52.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.submitJobRequests != null) {
if (struct.isSetSubmitJobRequests()) {
oprot.writeFieldBegin(SUBMIT_JOB_REQUESTS_FIELD_DESC);
{
oprot.writeListBegin(new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, struct.submitJobRequests.size()));
for (SubmitJobRequest _iter53 : struct.submitJobRequests)
{
_iter53.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.softConfig != null) {
if (struct.isSetSoftConfig()) {
oprot.writeFieldBegin(SOFT_CONFIG_FIELD_DESC);
struct.softConfig.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.tags != null) {
if (struct.isSetTags()) {
oprot.writeFieldBegin(TAGS_FIELD_DESC);
{
oprot.writeMapBegin(new libthrift091.protocol.TMap(libthrift091.protocol.TType.STRING, libthrift091.protocol.TType.STRING, struct.tags.size()));
for (Map.Entry<String, String> _iter54 : struct.tags.entrySet())
{
oprot.writeString(_iter54.getKey());
oprot.writeString(_iter54.getValue());
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CreateClusterRequestTupleSchemeFactory implements SchemeFactory {
public CreateClusterRequestTupleScheme getScheme() {
return new CreateClusterRequestTupleScheme();
}
}
private static class CreateClusterRequestTupleScheme extends TupleScheme<CreateClusterRequest> {
@Override
public void write(libthrift091.protocol.TProtocol prot, CreateClusterRequest struct) throws libthrift091.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.name);
BitSet optionals = new BitSet();
if (struct.isSetAutoTerminate()) {
optionals.set(0);
}
if (struct.isSetTerminationProtected()) {
optionals.set(1);
}
if (struct.isSetRegion()) {
optionals.set(2);
}
if (struct.isSetPurpose()) {
optionals.set(3);
}
if (struct.isSetKeyPair()) {
optionals.set(4);
}
if (struct.isSetAddInstanceGroupRequests()) {
optionals.set(5);
}
if (struct.isSetSubmitJobRequests()) {
optionals.set(6);
}
if (struct.isSetSoftConfig()) {
optionals.set(7);
}
if (struct.isSetTags()) {
optionals.set(8);
}
oprot.writeBitSet(optionals, 9);
if (struct.isSetAutoTerminate()) {
oprot.writeBool(struct.autoTerminate);
}
if (struct.isSetTerminationProtected()) {
oprot.writeBool(struct.terminationProtected);
}
if (struct.isSetRegion()) {
oprot.writeString(struct.region);
}
if (struct.isSetPurpose()) {
oprot.writeString(struct.purpose);
}
if (struct.isSetKeyPair()) {
oprot.writeString(struct.keyPair);
}
if (struct.isSetAddInstanceGroupRequests()) {
{
oprot.writeI32(struct.addInstanceGroupRequests.size());
for (AddInstanceGroupRequest _iter55 : struct.addInstanceGroupRequests)
{
_iter55.write(oprot);
}
}
}
if (struct.isSetSubmitJobRequests()) {
{
oprot.writeI32(struct.submitJobRequests.size());
for (SubmitJobRequest _iter56 : struct.submitJobRequests)
{
_iter56.write(oprot);
}
}
}
if (struct.isSetSoftConfig()) {
struct.softConfig.write(oprot);
}
if (struct.isSetTags()) {
{
oprot.writeI32(struct.tags.size());
for (Map.Entry<String, String> _iter57 : struct.tags.entrySet())
{
oprot.writeString(_iter57.getKey());
oprot.writeString(_iter57.getValue());
}
}
}
}
@Override
public void read(libthrift091.protocol.TProtocol prot, CreateClusterRequest struct) throws libthrift091.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.name = iprot.readString();
struct.setNameIsSet(true);
BitSet incoming = iprot.readBitSet(9);
if (incoming.get(0)) {
struct.autoTerminate = iprot.readBool();
struct.setAutoTerminateIsSet(true);
}
if (incoming.get(1)) {
struct.terminationProtected = iprot.readBool();
struct.setTerminationProtectedIsSet(true);
}
if (incoming.get(2)) {
struct.region = iprot.readString();
struct.setRegionIsSet(true);
}
if (incoming.get(3)) {
struct.purpose = iprot.readString();
struct.setPurposeIsSet(true);
}
if (incoming.get(4)) {
struct.keyPair = iprot.readString();
struct.setKeyPairIsSet(true);
}
if (incoming.get(5)) {
{
libthrift091.protocol.TList _list58 = new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, iprot.readI32());
struct.addInstanceGroupRequests = new ArrayList<AddInstanceGroupRequest>(_list58.size);
AddInstanceGroupRequest _elem59;
for (int _i60 = 0; _i60 < _list58.size; ++_i60)
{
_elem59 = new AddInstanceGroupRequest();
_elem59.read(iprot);
struct.addInstanceGroupRequests.add(_elem59);
}
}
struct.setAddInstanceGroupRequestsIsSet(true);
}
if (incoming.get(6)) {
{
libthrift091.protocol.TList _list61 = new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, iprot.readI32());
struct.submitJobRequests = new ArrayList<SubmitJobRequest>(_list61.size);
SubmitJobRequest _elem62;
for (int _i63 = 0; _i63 < _list61.size; ++_i63)
{
_elem62 = new SubmitJobRequest();
_elem62.read(iprot);
struct.submitJobRequests.add(_elem62);
}
}
struct.setSubmitJobRequestsIsSet(true);
}
if (incoming.get(7)) {
struct.softConfig = new ApplicationSuite();
struct.softConfig.read(iprot);
struct.setSoftConfigIsSet(true);
}
if (incoming.get(8)) {
{
libthrift091.protocol.TMap _map64 = new libthrift091.protocol.TMap(libthrift091.protocol.TType.STRING, libthrift091.protocol.TType.STRING, iprot.readI32());
struct.tags = new HashMap<String,String>(2*_map64.size);
String _key65;
String _val66;
for (int _i67 = 0; _i67 < _map64.size; ++_i67)
{
_key65 = iprot.readString();
_val66 = iprot.readString();
struct.tags.put(_key65, _val66);
}
}
struct.setTagsIsSet(true);
}
}
}
}