Ejemplo n.º 1
0
    def c_flavour(self, parser, ctx, args):
        self.cdn.flavour = args[0]

    def c_name(self, parser, ctx, args):
        self.cdn.name = args[0]

    def c_commit(self, parser, ctx, args):
        try:
            self.cdn.save()
        except api.Error, e:
            raise cli.CLIError(str(e))

global_commands = [
    [ 'show cdn', c_show, 'Show CDN configuration and status' ],
    [ 'show cdn <name>', c_show_cdn, ],
    [ 'show cdn flavours', c_show_cdn_flavours, 'Show available CDN flavours' ],
    [ 'cdn', None, 'Manage Content Delivery Networks' ],
    [ 'cdn purge', None, 'Remove an item from a CDN cache' ],
    [ 'cdn purge <name>', None, 'CDN name' ],
    [ 'cdn purge <name> <path>', c_purge, 'Object path' ],
    [ 'cdn purge <name> <path> hard', c_purge_hard, 'Delete object instead of invalidating' ],
]

config_commands = [
    [ 'cdn', None, "Configure Content Delivery Network" ],
    [ 'cdn <name>', cli.set_mode(CDNMode), "CDN name" ],
    [ 'no cdn', None, 'Remove CDN' ],
#    [ 'no cdn <name>', c_no_cdn ],
]