yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/qcloud/shell/elasticcache.go (about) 1 // Copyright 2019 Yunion 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package shell 16 17 import ( 18 "yunion.io/x/cloudmux/pkg/multicloud/qcloud" 19 "yunion.io/x/onecloud/pkg/util/shellutils" 20 ) 21 22 func init() { 23 type RedisListOptions struct { 24 } 25 shellutils.R(&RedisListOptions{}, "redis-list", "List redis", func(cli *qcloud.SRegion, args *RedisListOptions) error { 26 redis, err := cli.GetCloudElasticcaches("") 27 if err != nil { 28 return err 29 } 30 printList(redis, 0, 0, 0, []string{}) 31 return nil 32 }) 33 34 type RedisParameterListOptions struct { 35 INSTANCEID string `json:"instanceid"` 36 } 37 38 shellutils.R(&RedisParameterListOptions{}, "redis-parameter-list", "List redis parameters", func(cli *qcloud.SRegion, args *RedisParameterListOptions) error { 39 parameters, err := cli.GetCloudElasticcacheParameters(args.INSTANCEID) 40 if err != nil { 41 return err 42 } 43 printList(parameters, 0, 0, 0, []string{}) 44 return nil 45 }) 46 47 type RedisBackupListOptions struct { 48 INSTANCEID string `json:"instanceid"` 49 } 50 51 shellutils.R(&RedisBackupListOptions{}, "redis-backup-list", "List redis backups", func(cli *qcloud.SRegion, args *RedisBackupListOptions) error { 52 backups, err := cli.GetCloudElasticcacheBackups(args.INSTANCEID) 53 if err != nil { 54 return err 55 } 56 printList(backups, 0, 0, 0, []string{}) 57 return nil 58 }) 59 60 type RedisSecGroupListOptions struct { 61 INSTANCEID string `json:"instanceid"` 62 } 63 64 shellutils.R(&RedisSecGroupListOptions{}, "redis-secgroup-list", "List redis secgroups", func(cli *qcloud.SRegion, args *RedisSecGroupListOptions) error { 65 secgroups, err := cli.GetCloudElasticcacheSecurityGroups(args.INSTANCEID) 66 if err != nil { 67 return err 68 } 69 printList(secgroups, 0, 0, 0, []string{}) 70 return nil 71 }) 72 73 type RedisAccountListOptions struct { 74 INSTANCEID string `json:"instanceid"` 75 } 76 77 shellutils.R(&RedisAccountListOptions{}, "redis-account-list", "List redis accounts", func(cli *qcloud.SRegion, args *RedisAccountListOptions) error { 78 accounts, err := cli.GetCloudElasticcacheAccounts(args.INSTANCEID) 79 if err != nil { 80 return err 81 } 82 printList(accounts, 0, 0, 0, []string{}) 83 return nil 84 }) 85 }