def type(self, t=None): if t not in self.VALID_VOLUME_TYPES: raise SyntaxError( 'K8sPersistentVolume: type: [ {} ] is invalid.'.format(t)) self._type = t setattr(self.model.spec, t, Volume.vol_type_to_source(t))