com.xiaomi.infra.galaxy.rpc.thrift.HttpAuthorizationHeader Maven / Gradle / Ivy
/**
* 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.rpc.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"})
/**
* Authorization头包含的内容
*/
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-16")
public class HttpAuthorizationHeader implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("HttpAuthorizationHeader");
private static final libthrift091.protocol.TField VERSION_FIELD_DESC = new libthrift091.protocol.TField("version", libthrift091.protocol.TType.STRING, (short)1);
private static final libthrift091.protocol.TField USER_TYPE_FIELD_DESC = new libthrift091.protocol.TField("userType", libthrift091.protocol.TType.I32, (short)2);
private static final libthrift091.protocol.TField SECRET_KEY_ID_FIELD_DESC = new libthrift091.protocol.TField("secretKeyId", libthrift091.protocol.TType.STRING, (short)3);
private static final libthrift091.protocol.TField SECRET_KEY_FIELD_DESC = new libthrift091.protocol.TField("secretKey", libthrift091.protocol.TType.STRING, (short)4);
private static final libthrift091.protocol.TField SIGNATURE_FIELD_DESC = new libthrift091.protocol.TField("signature", libthrift091.protocol.TType.STRING, (short)5);
private static final libthrift091.protocol.TField ALGORITHM_FIELD_DESC = new libthrift091.protocol.TField("algorithm", libthrift091.protocol.TType.I32, (short)6);
private static final libthrift091.protocol.TField SIGNED_HEADERS_FIELD_DESC = new libthrift091.protocol.TField("signedHeaders", libthrift091.protocol.TType.LIST, (short)7);
private static final libthrift091.protocol.TField SUPPORT_ACCOUNT_KEY_FIELD_DESC = new libthrift091.protocol.TField("supportAccountKey", libthrift091.protocol.TType.BOOL, (short)8);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new HttpAuthorizationHeaderStandardSchemeFactory());
schemes.put(TupleScheme.class, new HttpAuthorizationHeaderTupleSchemeFactory());
}
public String version; // optional
/**
*
* @see UserType
*/
public UserType userType; // optional
public String secretKeyId; // optional
/**
* 直接使用sercetKey,此项被设置时,signature将被忽略,
* 非安全传输应使用签名
*/
public String secretKey; // optional
/**
* 如secretKey未设置,则认为使用签名,此时必须设置,
* 被签名的正文格式:header1[\nheader2[\nheader3[...]]],
* 如使用默认SUGGESTED_SIGNATURE_HEADERS时为:$host\n$timestamp\n$md5
*/
public String signature; // optional
/**
* 签名HMAC算法,客户端可定制,
* 使用签名时必须设置
*
* @see MacAlgorithm
*/
public MacAlgorithm algorithm; // optional
/**
* 包含所有签名涉及到的部分,建议使用SUGGESTED_SIGNATURE_HEADERS,
* 服务端未强制必须使用所列headers,定制的client自己负责签名的安全强度,
* 使用签名时必须设置
*/
public List signedHeaders; // optional
public boolean supportAccountKey; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
VERSION((short)1, "version"),
/**
*
* @see UserType
*/
USER_TYPE((short)2, "userType"),
SECRET_KEY_ID((short)3, "secretKeyId"),
/**
* 直接使用sercetKey,此项被设置时,signature将被忽略,
* 非安全传输应使用签名
*/
SECRET_KEY((short)4, "secretKey"),
/**
* 如secretKey未设置,则认为使用签名,此时必须设置,
* 被签名的正文格式:header1[\nheader2[\nheader3[...]]],
* 如使用默认SUGGESTED_SIGNATURE_HEADERS时为:$host\n$timestamp\n$md5
*/
SIGNATURE((short)5, "signature"),
/**
* 签名HMAC算法,客户端可定制,
* 使用签名时必须设置
*
* @see MacAlgorithm
*/
ALGORITHM((short)6, "algorithm"),
/**
* 包含所有签名涉及到的部分,建议使用SUGGESTED_SIGNATURE_HEADERS,
* 服务端未强制必须使用所列headers,定制的client自己负责签名的安全强度,
* 使用签名时必须设置
*/
SIGNED_HEADERS((short)7, "signedHeaders"),
SUPPORT_ACCOUNT_KEY((short)8, "supportAccountKey");
private static final Map byName = new HashMap();
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: // VERSION
return VERSION;
case 2: // USER_TYPE
return USER_TYPE;
case 3: // SECRET_KEY_ID
return SECRET_KEY_ID;
case 4: // SECRET_KEY
return SECRET_KEY;
case 5: // SIGNATURE
return SIGNATURE;
case 6: // ALGORITHM
return ALGORITHM;
case 7: // SIGNED_HEADERS
return SIGNED_HEADERS;
case 8: // SUPPORT_ACCOUNT_KEY
return SUPPORT_ACCOUNT_KEY;
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 __SUPPORTACCOUNTKEY_ISSET_ID = 0;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.VERSION,_Fields.USER_TYPE,_Fields.SECRET_KEY_ID,_Fields.SECRET_KEY,_Fields.SIGNATURE,_Fields.ALGORITHM,_Fields.SIGNED_HEADERS,_Fields.SUPPORT_ACCOUNT_KEY};
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.VERSION, new libthrift091.meta_data.FieldMetaData("version", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.USER_TYPE, new libthrift091.meta_data.FieldMetaData("userType", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.EnumMetaData(libthrift091.protocol.TType.ENUM, UserType.class)));
tmpMap.put(_Fields.SECRET_KEY_ID, new libthrift091.meta_data.FieldMetaData("secretKeyId", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.SECRET_KEY, new libthrift091.meta_data.FieldMetaData("secretKey", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.SIGNATURE, new libthrift091.meta_data.FieldMetaData("signature", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.ALGORITHM, new libthrift091.meta_data.FieldMetaData("algorithm", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.EnumMetaData(libthrift091.protocol.TType.ENUM, MacAlgorithm.class)));
tmpMap.put(_Fields.SIGNED_HEADERS, new libthrift091.meta_data.FieldMetaData("signedHeaders", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.ListMetaData(libthrift091.protocol.TType.LIST,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING))));
tmpMap.put(_Fields.SUPPORT_ACCOUNT_KEY, new libthrift091.meta_data.FieldMetaData("supportAccountKey", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(HttpAuthorizationHeader.class, metaDataMap);
}
public HttpAuthorizationHeader() {
this.version = "SDS-V1";
this.userType = com.xiaomi.infra.galaxy.rpc.thrift.UserType.APP_ANONYMOUS;
this.signedHeaders = new ArrayList();
this.supportAccountKey = false;
}
/**
* Performs a deep copy on other.
*/
public HttpAuthorizationHeader(HttpAuthorizationHeader other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetVersion()) {
this.version = other.version;
}
if (other.isSetUserType()) {
this.userType = other.userType;
}
if (other.isSetSecretKeyId()) {
this.secretKeyId = other.secretKeyId;
}
if (other.isSetSecretKey()) {
this.secretKey = other.secretKey;
}
if (other.isSetSignature()) {
this.signature = other.signature;
}
if (other.isSetAlgorithm()) {
this.algorithm = other.algorithm;
}
if (other.isSetSignedHeaders()) {
List __this__signedHeaders = new ArrayList(other.signedHeaders);
this.signedHeaders = __this__signedHeaders;
}
this.supportAccountKey = other.supportAccountKey;
}
public HttpAuthorizationHeader deepCopy() {
return new HttpAuthorizationHeader(this);
}
@Override
public void clear() {
this.version = "SDS-V1";
this.userType = com.xiaomi.infra.galaxy.rpc.thrift.UserType.APP_ANONYMOUS;
this.secretKeyId = null;
this.secretKey = null;
this.signature = null;
this.algorithm = null;
this.signedHeaders = new ArrayList();
this.supportAccountKey = false;
}
public String getVersion() {
return this.version;
}
public HttpAuthorizationHeader setVersion(String version) {
this.version = version;
return this;
}
public void unsetVersion() {
this.version = null;
}
/** Returns true if field version is set (has been assigned a value) and false otherwise */
public boolean isSetVersion() {
return this.version != null;
}
public void setVersionIsSet(boolean value) {
if (!value) {
this.version = null;
}
}
/**
*
* @see UserType
*/
public UserType getUserType() {
return this.userType;
}
/**
*
* @see UserType
*/
public HttpAuthorizationHeader setUserType(UserType userType) {
this.userType = userType;
return this;
}
public void unsetUserType() {
this.userType = null;
}
/** Returns true if field userType is set (has been assigned a value) and false otherwise */
public boolean isSetUserType() {
return this.userType != null;
}
public void setUserTypeIsSet(boolean value) {
if (!value) {
this.userType = null;
}
}
public String getSecretKeyId() {
return this.secretKeyId;
}
public HttpAuthorizationHeader setSecretKeyId(String secretKeyId) {
this.secretKeyId = secretKeyId;
return this;
}
public void unsetSecretKeyId() {
this.secretKeyId = null;
}
/** Returns true if field secretKeyId is set (has been assigned a value) and false otherwise */
public boolean isSetSecretKeyId() {
return this.secretKeyId != null;
}
public void setSecretKeyIdIsSet(boolean value) {
if (!value) {
this.secretKeyId = null;
}
}
/**
* 直接使用sercetKey,此项被设置时,signature将被忽略,
* 非安全传输应使用签名
*/
public String getSecretKey() {
return this.secretKey;
}
/**
* 直接使用sercetKey,此项被设置时,signature将被忽略,
* 非安全传输应使用签名
*/
public HttpAuthorizationHeader setSecretKey(String secretKey) {
this.secretKey = secretKey;
return this;
}
public void unsetSecretKey() {
this.secretKey = null;
}
/** Returns true if field secretKey is set (has been assigned a value) and false otherwise */
public boolean isSetSecretKey() {
return this.secretKey != null;
}
public void setSecretKeyIsSet(boolean value) {
if (!value) {
this.secretKey = null;
}
}
/**
* 如secretKey未设置,则认为使用签名,此时必须设置,
* 被签名的正文格式:header1[\nheader2[\nheader3[...]]],
* 如使用默认SUGGESTED_SIGNATURE_HEADERS时为:$host\n$timestamp\n$md5
*/
public String getSignature() {
return this.signature;
}
/**
* 如secretKey未设置,则认为使用签名,此时必须设置,
* 被签名的正文格式:header1[\nheader2[\nheader3[...]]],
* 如使用默认SUGGESTED_SIGNATURE_HEADERS时为:$host\n$timestamp\n$md5
*/
public HttpAuthorizationHeader setSignature(String signature) {
this.signature = signature;
return this;
}
public void unsetSignature() {
this.signature = null;
}
/** Returns true if field signature is set (has been assigned a value) and false otherwise */
public boolean isSetSignature() {
return this.signature != null;
}
public void setSignatureIsSet(boolean value) {
if (!value) {
this.signature = null;
}
}
/**
* 签名HMAC算法,客户端可定制,
* 使用签名时必须设置
*
* @see MacAlgorithm
*/
public MacAlgorithm getAlgorithm() {
return this.algorithm;
}
/**
* 签名HMAC算法,客户端可定制,
* 使用签名时必须设置
*
* @see MacAlgorithm
*/
public HttpAuthorizationHeader setAlgorithm(MacAlgorithm algorithm) {
this.algorithm = algorithm;
return this;
}
public void unsetAlgorithm() {
this.algorithm = null;
}
/** Returns true if field algorithm is set (has been assigned a value) and false otherwise */
public boolean isSetAlgorithm() {
return this.algorithm != null;
}
public void setAlgorithmIsSet(boolean value) {
if (!value) {
this.algorithm = null;
}
}
public int getSignedHeadersSize() {
return (this.signedHeaders == null) ? 0 : this.signedHeaders.size();
}
public java.util.Iterator getSignedHeadersIterator() {
return (this.signedHeaders == null) ? null : this.signedHeaders.iterator();
}
public void addToSignedHeaders(String elem) {
if (this.signedHeaders == null) {
this.signedHeaders = new ArrayList();
}
this.signedHeaders.add(elem);
}
/**
* 包含所有签名涉及到的部分,建议使用SUGGESTED_SIGNATURE_HEADERS,
* 服务端未强制必须使用所列headers,定制的client自己负责签名的安全强度,
* 使用签名时必须设置
*/
public List getSignedHeaders() {
return this.signedHeaders;
}
/**
* 包含所有签名涉及到的部分,建议使用SUGGESTED_SIGNATURE_HEADERS,
* 服务端未强制必须使用所列headers,定制的client自己负责签名的安全强度,
* 使用签名时必须设置
*/
public HttpAuthorizationHeader setSignedHeaders(List signedHeaders) {
this.signedHeaders = signedHeaders;
return this;
}
public void unsetSignedHeaders() {
this.signedHeaders = null;
}
/** Returns true if field signedHeaders is set (has been assigned a value) and false otherwise */
public boolean isSetSignedHeaders() {
return this.signedHeaders != null;
}
public void setSignedHeadersIsSet(boolean value) {
if (!value) {
this.signedHeaders = null;
}
}
public boolean isSupportAccountKey() {
return this.supportAccountKey;
}
public HttpAuthorizationHeader setSupportAccountKey(boolean supportAccountKey) {
this.supportAccountKey = supportAccountKey;
setSupportAccountKeyIsSet(true);
return this;
}
public void unsetSupportAccountKey() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUPPORTACCOUNTKEY_ISSET_ID);
}
/** Returns true if field supportAccountKey is set (has been assigned a value) and false otherwise */
public boolean isSetSupportAccountKey() {
return EncodingUtils.testBit(__isset_bitfield, __SUPPORTACCOUNTKEY_ISSET_ID);
}
public void setSupportAccountKeyIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUPPORTACCOUNTKEY_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case VERSION:
if (value == null) {
unsetVersion();
} else {
setVersion((String)value);
}
break;
case USER_TYPE:
if (value == null) {
unsetUserType();
} else {
setUserType((UserType)value);
}
break;
case SECRET_KEY_ID:
if (value == null) {
unsetSecretKeyId();
} else {
setSecretKeyId((String)value);
}
break;
case SECRET_KEY:
if (value == null) {
unsetSecretKey();
} else {
setSecretKey((String)value);
}
break;
case SIGNATURE:
if (value == null) {
unsetSignature();
} else {
setSignature((String)value);
}
break;
case ALGORITHM:
if (value == null) {
unsetAlgorithm();
} else {
setAlgorithm((MacAlgorithm)value);
}
break;
case SIGNED_HEADERS:
if (value == null) {
unsetSignedHeaders();
} else {
setSignedHeaders((List)value);
}
break;
case SUPPORT_ACCOUNT_KEY:
if (value == null) {
unsetSupportAccountKey();
} else {
setSupportAccountKey((Boolean)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case VERSION:
return getVersion();
case USER_TYPE:
return getUserType();
case SECRET_KEY_ID:
return getSecretKeyId();
case SECRET_KEY:
return getSecretKey();
case SIGNATURE:
return getSignature();
case ALGORITHM:
return getAlgorithm();
case SIGNED_HEADERS:
return getSignedHeaders();
case SUPPORT_ACCOUNT_KEY:
return Boolean.valueOf(isSupportAccountKey());
}
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 VERSION:
return isSetVersion();
case USER_TYPE:
return isSetUserType();
case SECRET_KEY_ID:
return isSetSecretKeyId();
case SECRET_KEY:
return isSetSecretKey();
case SIGNATURE:
return isSetSignature();
case ALGORITHM:
return isSetAlgorithm();
case SIGNED_HEADERS:
return isSetSignedHeaders();
case SUPPORT_ACCOUNT_KEY:
return isSetSupportAccountKey();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof HttpAuthorizationHeader)
return this.equals((HttpAuthorizationHeader)that);
return false;
}
public boolean equals(HttpAuthorizationHeader that) {
if (that == null)
return false;
boolean this_present_version = true && this.isSetVersion();
boolean that_present_version = true && that.isSetVersion();
if (this_present_version || that_present_version) {
if (!(this_present_version && that_present_version))
return false;
if (!this.version.equals(that.version))
return false;
}
boolean this_present_userType = true && this.isSetUserType();
boolean that_present_userType = true && that.isSetUserType();
if (this_present_userType || that_present_userType) {
if (!(this_present_userType && that_present_userType))
return false;
if (!this.userType.equals(that.userType))
return false;
}
boolean this_present_secretKeyId = true && this.isSetSecretKeyId();
boolean that_present_secretKeyId = true && that.isSetSecretKeyId();
if (this_present_secretKeyId || that_present_secretKeyId) {
if (!(this_present_secretKeyId && that_present_secretKeyId))
return false;
if (!this.secretKeyId.equals(that.secretKeyId))
return false;
}
boolean this_present_secretKey = true && this.isSetSecretKey();
boolean that_present_secretKey = true && that.isSetSecretKey();
if (this_present_secretKey || that_present_secretKey) {
if (!(this_present_secretKey && that_present_secretKey))
return false;
if (!this.secretKey.equals(that.secretKey))
return false;
}
boolean this_present_signature = true && this.isSetSignature();
boolean that_present_signature = true && that.isSetSignature();
if (this_present_signature || that_present_signature) {
if (!(this_present_signature && that_present_signature))
return false;
if (!this.signature.equals(that.signature))
return false;
}
boolean this_present_algorithm = true && this.isSetAlgorithm();
boolean that_present_algorithm = true && that.isSetAlgorithm();
if (this_present_algorithm || that_present_algorithm) {
if (!(this_present_algorithm && that_present_algorithm))
return false;
if (!this.algorithm.equals(that.algorithm))
return false;
}
boolean this_present_signedHeaders = true && this.isSetSignedHeaders();
boolean that_present_signedHeaders = true && that.isSetSignedHeaders();
if (this_present_signedHeaders || that_present_signedHeaders) {
if (!(this_present_signedHeaders && that_present_signedHeaders))
return false;
if (!this.signedHeaders.equals(that.signedHeaders))
return false;
}
boolean this_present_supportAccountKey = true && this.isSetSupportAccountKey();
boolean that_present_supportAccountKey = true && that.isSetSupportAccountKey();
if (this_present_supportAccountKey || that_present_supportAccountKey) {
if (!(this_present_supportAccountKey && that_present_supportAccountKey))
return false;
if (this.supportAccountKey != that.supportAccountKey)
return false;
}
return true;
}
@Override
public int hashCode() {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy