[Update] 修改Swift录像存储创建参数及API返回值

pull/3618/head
Bai 5 years ago
parent 84e5177ce2
commit ff1828bdd6

@ -35,6 +35,7 @@ REPLAY_STORAGE_TYPE_SWIFT_FIELDS = [
{'name': 'SECRET_KEY', 'write_only': True},
{'name': 'REGION'},
{'name': 'ENDPOINT'},
{'name': 'PROTOCOL'},
]
REPLAY_STORAGE_TYPE_OSS_FIELDS = [
{'name': 'BUCKET'},

@ -145,6 +145,12 @@ class ReplayStorageSwiftForm(BaseReplayStorageForm):
swift_endpoint = forms.CharField(
max_length=128, label=_('Endpoint'), required=False,
)
swift_protocol = forms.ChoiceField(
choices=(
('HTTP', 'http'),
('HTTPS', 'https')
), initial='http', label=_('Protocol'), required=True,
)
class CommandStorageTypeESForm(BaseCommandStorageForm):

@ -362,18 +362,23 @@ class ReplayStorage(CommonModelMixin):
return self.name
def convert_type(self):
s3_type_list = [
const.REPLAY_STORAGE_TYPE_CEPH, const.REPLAY_STORAGE_TYPE_SWIFT
]
s3_type_list = [const.REPLAY_STORAGE_TYPE_CEPH]
tp = self.type
if tp in s3_type_list:
tp = const.REPLAY_STORAGE_TYPE_S3
return tp
def get_extra_config(self):
extra_config = {'TYPE': self.convert_type()}
if self.type == const.REPLAY_STORAGE_TYPE_SWIFT:
extra_config.update({'signer': 'S3SignerType'})
return extra_config
@property
def config(self):
config = self.meta
config.update({'TYPE': self.convert_type()})
extra_config = self.get_extra_config()
config.update(extra_config)
return config
def in_defaults(self):

Loading…
Cancel
Save