| # |
| # Autogenerated by Thrift Compiler (0.10.0) |
| # |
| # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
| # |
| # options string: py |
| # |
| |
| from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException |
| from thrift.protocol.TProtocol import TProtocolException |
| import sys |
| |
| from thrift.transport import TTransport |
| |
| |
| class SSHAccountProvisionerConfigParamType(object): |
| STRING = 0 |
| CRED_STORE_PASSWORD_TOKEN = 1 |
| |
| _VALUES_TO_NAMES = { |
| 0: "STRING", |
| 1: "CRED_STORE_PASSWORD_TOKEN", |
| } |
| |
| _NAMES_TO_VALUES = { |
| "STRING": 0, |
| "CRED_STORE_PASSWORD_TOKEN": 1, |
| } |
| |
| |
| class SSHAccountProvisionerConfigParam(object): |
| """ |
| Attributes: |
| - name |
| - type |
| - isOptional |
| - description |
| """ |
| |
| thrift_spec = ( |
| None, # 0 |
| (1, TType.STRING, 'name', 'UTF8', None, ), # 1 |
| (2, TType.I32, 'type', None, 0, ), # 2 |
| (3, TType.BOOL, 'isOptional', None, False, ), # 3 |
| (4, TType.STRING, 'description', 'UTF8', None, ), # 4 |
| ) |
| |
| def __init__(self, name=None, type=thrift_spec[2][4], isOptional=thrift_spec[3][4], description=None,): |
| self.name = name |
| self.type = type |
| self.isOptional = isOptional |
| self.description = description |
| |
| def read(self, iprot): |
| if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: |
| iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) |
| return |
| iprot.readStructBegin() |
| while True: |
| (fname, ftype, fid) = iprot.readFieldBegin() |
| if ftype == TType.STOP: |
| break |
| if fid == 1: |
| if ftype == TType.STRING: |
| self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() |
| else: |
| iprot.skip(ftype) |
| elif fid == 2: |
| if ftype == TType.I32: |
| self.type = iprot.readI32() |
| else: |
| iprot.skip(ftype) |
| elif fid == 3: |
| if ftype == TType.BOOL: |
| self.isOptional = iprot.readBool() |
| else: |
| iprot.skip(ftype) |
| elif fid == 4: |
| if ftype == TType.STRING: |
| self.description = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() |
| else: |
| iprot.skip(ftype) |
| else: |
| iprot.skip(ftype) |
| iprot.readFieldEnd() |
| iprot.readStructEnd() |
| |
| def write(self, oprot): |
| if oprot._fast_encode is not None and self.thrift_spec is not None: |
| oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) |
| return |
| oprot.writeStructBegin('SSHAccountProvisionerConfigParam') |
| if self.name is not None: |
| oprot.writeFieldBegin('name', TType.STRING, 1) |
| oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name) |
| oprot.writeFieldEnd() |
| if self.type is not None: |
| oprot.writeFieldBegin('type', TType.I32, 2) |
| oprot.writeI32(self.type) |
| oprot.writeFieldEnd() |
| if self.isOptional is not None: |
| oprot.writeFieldBegin('isOptional', TType.BOOL, 3) |
| oprot.writeBool(self.isOptional) |
| oprot.writeFieldEnd() |
| if self.description is not None: |
| oprot.writeFieldBegin('description', TType.STRING, 4) |
| oprot.writeString(self.description.encode('utf-8') if sys.version_info[0] == 2 else self.description) |
| oprot.writeFieldEnd() |
| oprot.writeFieldStop() |
| oprot.writeStructEnd() |
| |
| def validate(self): |
| if self.name is None: |
| raise TProtocolException(message='Required field name is unset!') |
| if self.type is None: |
| raise TProtocolException(message='Required field type is unset!') |
| if self.isOptional is None: |
| raise TProtocolException(message='Required field isOptional is unset!') |
| return |
| |
| def __repr__(self): |
| L = ['%s=%r' % (key, value) |
| for key, value in self.__dict__.items()] |
| return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) |
| |
| def __eq__(self, other): |
| return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ |
| |
| def __ne__(self, other): |
| return not (self == other) |
| |
| |
| class SSHAccountProvisioner(object): |
| """ |
| Attributes: |
| - name |
| - canCreateAccount |
| - canInstallSSHKey |
| - configParams |
| """ |
| |
| thrift_spec = ( |
| None, # 0 |
| (1, TType.STRING, 'name', 'UTF8', None, ), # 1 |
| (2, TType.BOOL, 'canCreateAccount', None, None, ), # 2 |
| (3, TType.BOOL, 'canInstallSSHKey', None, None, ), # 3 |
| (4, TType.LIST, 'configParams', (TType.STRUCT, (SSHAccountProvisionerConfigParam, SSHAccountProvisionerConfigParam.thrift_spec), False), None, ), # 4 |
| ) |
| |
| def __init__(self, name=None, canCreateAccount=None, canInstallSSHKey=None, configParams=None,): |
| self.name = name |
| self.canCreateAccount = canCreateAccount |
| self.canInstallSSHKey = canInstallSSHKey |
| self.configParams = configParams |
| |
| def read(self, iprot): |
| if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: |
| iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) |
| return |
| iprot.readStructBegin() |
| while True: |
| (fname, ftype, fid) = iprot.readFieldBegin() |
| if ftype == TType.STOP: |
| break |
| if fid == 1: |
| if ftype == TType.STRING: |
| self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() |
| else: |
| iprot.skip(ftype) |
| elif fid == 2: |
| if ftype == TType.BOOL: |
| self.canCreateAccount = iprot.readBool() |
| else: |
| iprot.skip(ftype) |
| elif fid == 3: |
| if ftype == TType.BOOL: |
| self.canInstallSSHKey = iprot.readBool() |
| else: |
| iprot.skip(ftype) |
| elif fid == 4: |
| if ftype == TType.LIST: |
| self.configParams = [] |
| (_etype3, _size0) = iprot.readListBegin() |
| for _i4 in range(_size0): |
| _elem5 = SSHAccountProvisionerConfigParam() |
| _elem5.read(iprot) |
| self.configParams.append(_elem5) |
| iprot.readListEnd() |
| else: |
| iprot.skip(ftype) |
| else: |
| iprot.skip(ftype) |
| iprot.readFieldEnd() |
| iprot.readStructEnd() |
| |
| def write(self, oprot): |
| if oprot._fast_encode is not None and self.thrift_spec is not None: |
| oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) |
| return |
| oprot.writeStructBegin('SSHAccountProvisioner') |
| if self.name is not None: |
| oprot.writeFieldBegin('name', TType.STRING, 1) |
| oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name) |
| oprot.writeFieldEnd() |
| if self.canCreateAccount is not None: |
| oprot.writeFieldBegin('canCreateAccount', TType.BOOL, 2) |
| oprot.writeBool(self.canCreateAccount) |
| oprot.writeFieldEnd() |
| if self.canInstallSSHKey is not None: |
| oprot.writeFieldBegin('canInstallSSHKey', TType.BOOL, 3) |
| oprot.writeBool(self.canInstallSSHKey) |
| oprot.writeFieldEnd() |
| if self.configParams is not None: |
| oprot.writeFieldBegin('configParams', TType.LIST, 4) |
| oprot.writeListBegin(TType.STRUCT, len(self.configParams)) |
| for iter6 in self.configParams: |
| iter6.write(oprot) |
| oprot.writeListEnd() |
| oprot.writeFieldEnd() |
| oprot.writeFieldStop() |
| oprot.writeStructEnd() |
| |
| def validate(self): |
| if self.name is None: |
| raise TProtocolException(message='Required field name is unset!') |
| if self.canCreateAccount is None: |
| raise TProtocolException(message='Required field canCreateAccount is unset!') |
| if self.canInstallSSHKey is None: |
| raise TProtocolException(message='Required field canInstallSSHKey is unset!') |
| if self.configParams is None: |
| raise TProtocolException(message='Required field configParams is unset!') |
| return |
| |
| def __repr__(self): |
| L = ['%s=%r' % (key, value) |
| for key, value in self.__dict__.items()] |
| return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) |
| |
| def __eq__(self, other): |
| return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ |
| |
| def __ne__(self, other): |
| return not (self == other) |