示例#1
0
文件: backup.py 项目: erinix/cli
    def add_properties(self):
        super(BackupS3PropertiesMixin, self).add_properties()

        self.add_property(
            descr='Peer',
            name='s3_peer',
            usage=_("Peer name. Must match a peer of type s3"),
            get=lambda o: get_related(self.context, 'peer', o, 'properties.peer'),
            set=lambda o, v: set_related(self.context, 'peer', o, 'properties.peer', v),
            list=False,
            condition=lambda o: o['provider'] == 's3'
        )

        self.add_property(
            descr='Bucket',
            name='s3_bucket',
            usage=_("""\
            Enclose the valid hostname label between double quotes.
            This assumes you have already created a bucket."""),
            get='properties.bucket',
            list=False,
            condition=lambda o: o['provider'] == 's3'
        )

        self.add_property(
            descr='Folder',
            name='s3_folder',
            usage=_("""\
            The name of the folder within the bucket to backup to."""),
            get='properties.folder',
            list=False,
            condition=lambda o: o['provider'] == 's3'
        )
示例#2
0
文件: backup.py 项目: zoot/cli
    def add_properties(self):
        super(BackupS3PropertiesMixin, self).add_properties()

        self.add_property(descr='Peer',
                          name='s3_peer',
                          usage=_("Peer name. Must match a peer of type s3"),
                          get=lambda o: get_related(self.context, 'peer', o,
                                                    'properties.peer'),
                          set=lambda o, v: set_related(self.context, 'peer', o,
                                                       'properties.peer', v),
                          list=False,
                          condition=lambda o: o['provider'] == 's3')

        self.add_property(descr='Bucket',
                          name='s3_bucket',
                          usage=_("""\
            Enclose the valid hostname label between double quotes.
            This assumes you have already created a bucket."""),
                          get='properties.bucket',
                          list=False,
                          condition=lambda o: o['provider'] == 's3')

        self.add_property(descr='Folder',
                          name='s3_folder',
                          usage=_("""\
            The name of the folder within the bucket to backup to."""),
                          get='properties.folder',
                          list=False,
                          condition=lambda o: o['provider'] == 's3')
示例#3
0
    def add_properties(self):
        super(BackupSSHPropertiesMixin, self).add_properties()

        self.add_property(
            descr='Peer',
            name='ssh_peer',
            usage=_("Peer name. Must match a peer of type ssh"),
            get=lambda o: get_related(self.context, 'peer', o,
                                      'properties.peer'),
            set=lambda o, v: set_related(self.context, 'peer', o,
                                         'properties.peer', v),
            list=False,
            condition=lambda o: o['provider'] == 'ssh',
            enum=lambda: self.query([], {
                'subscriber': 'peer',
                'select': 'name'
            }),
        )

        self.add_property(descr='Directory',
                          name='ssh_directory',
                          usage=_("""\
            Name of existing directory to save the backups to."""),
                          get='properties.directory',
                          list=False,
                          condition=lambda o: o['provider'] == 'ssh')
示例#4
0
文件: system.py 项目: mactanxin/cli
    def __init__(self, name, context):
        super(SystemUINamespace, self).__init__(name, context)
        self.context = context
        self.config_call = 'system.ui.get_config'
        self.update_task = 'system.ui.update'

        self.add_property(
            descr='Redirect http to https',
            name='redirect_https',
            get='webui_http_redirect_https',
            type=ValueType.BOOLEAN
        )

        self.add_property(
            descr='Web GUI Protocols in use',
            name='protocols',
            get='webui_protocol',
            type=ValueType.SET,
            enum=['HTTP', 'HTTPS']
        )

        self.add_property(
            descr='Web GUI IP Address (IPv4 and/or IPv6)',
            name='ip_addresses',
            get='webui_listen',
            type=ValueType.SET
        )

        self.add_property(
            descr='HTTP port',
            name='http_port',
            get='webui_http_port',
            type=ValueType.NUMBER
        )

        self.add_property(
            descr='HTTPS port',
            name='https_port',
            get='webui_https_port',
            type=ValueType.NUMBER
        )

        self.add_property(
            descr='HTTPS certificate',
            name='https_certificate',
            get=lambda o: get_related(self.context, 'crypto.certificate', o, 'webui_https_certificate'),
            set=lambda o, v: set_related(self.context, 'crypto.certificate', o, 'webui_https_certificate', v),
            usage=_("""\
            Name of the certificate
            """),
            complete=EntitySubscriberComplete(
                'https_certificate=',
                'crypto.certificate',
                lambda o: o['name'] if o['type'] != 'CERT_CSR' else None
            ),
            type=ValueType.STRING
        )
示例#5
0
文件: system.py 项目: erinix/cli
    def __init__(self, name, context):
        super(SystemUINamespace, self).__init__(name, context)
        self.context = context
        self.config_call = 'system.ui.get_config'
        self.update_task = 'system.ui.update'

        self.add_property(
            descr='Redirect http to https',
            name='redirect_https',
            get='webui_http_redirect_https',
            type=ValueType.BOOLEAN
        )

        self.add_property(
            descr='Web GUI Protocols in use',
            name='protocols',
            get='webui_protocol',
            type=ValueType.SET,
            enum=['HTTP', 'HTTPS']
        )

        self.add_property(
            descr='Web GUI IP Address (IPv4 and/or IPv6)',
            name='ip_addresses',
            get='webui_listen',
            type=ValueType.SET
        )

        self.add_property(
            descr='HTTP port',
            name='http_port',
            get='webui_http_port',
            type=ValueType.NUMBER
        )

        self.add_property(
            descr='HTTPS port',
            name='https_port',
            get='webui_https_port',
            type=ValueType.NUMBER
        )

        self.add_property(
            descr='HTTPS certificate',
            name='https_certificate',
            get=lambda o: get_related(self.context, 'crypto.certificate', o, 'webui_https_certificate'),
            set=lambda o, v: set_related(self.context, 'crypto.certificate', o, 'webui_https_certificate', v),
            usage=_("""\
            Name of the certificate
            """),
            complete=EntitySubscriberComplete(
                'https_certificate=',
                'crypto.certificate',
                lambda o: o['name'] if o['type'] != 'CERT_CSR' else None
            ),
            type=ValueType.STRING
        )
示例#6
0
文件: backup.py 项目: surajrav/cli
    def add_properties(self):
        super(BackupSSHPropertiesMixin, self).add_properties()

        self.add_property(descr='Peer',
                          name='ssh_peer',
                          usage=_("Peer name. Must match a peer of type ssh"),
                          get=lambda o: get_related(self.context, 'peer', o,
                                                    'properties.peer'),
                          set=lambda o, v: set_related(self.context, 'peer', o,
                                                       'properties.peer', v),
                          list=False,
                          condition=lambda o: o['provider'] == 'ssh',
                          complete=EntitySubscriberComplete(
                              'ssh_peer=', 'peer', lambda i: i['name']))

        self.add_property(descr='Directory',
                          name='ssh_directory',
                          usage=_("""\
            Name of existing directory to save the backups to."""),
                          get='properties.directory',
                          list=False,
                          condition=lambda o: o['provider'] == 'ssh')
示例#7
0
文件: backup.py 项目: erinix/cli
    def add_properties(self):
        super(BackupSSHPropertiesMixin, self).add_properties()

        self.add_property(
            descr='Peer',
            name='ssh_peer',
            usage=_("Peer name. Must match a peer of type ssh"),
            get=lambda o: get_related(self.context, 'peer', o, 'properties.peer'),
            set=lambda o, v: set_related(self.context, 'peer', o, 'properties.peer', v),
            list=False,
            condition=lambda o: o['provider'] == 'ssh',
            complete=EntitySubscriberComplete('ssh_peer=', 'peer', lambda i: i['name'])
        )

        self.add_property(
            descr='Directory',
            name='ssh_directory',
            usage=_("""\
            Name of existing directory to save the backups to."""),
            get='properties.directory',
            list=False,
            condition=lambda o: o['provider'] == 'ssh'
        )