Skip to content

Commit

Permalink
feat: tencent cloud security group policy add/del
Browse files Browse the repository at this point in the history
  • Loading branch information
teamssix committed Jul 19, 2022
1 parent 7868cc6 commit 4077b7a
Show file tree
Hide file tree
Showing 29 changed files with 240 additions and 535 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

# Dependency directories (remove the comment below to include it)
# vendor/
tmp
test

# Go workspace file
go.work
.DS_Store
.idea
cf
cf.bak
tmp
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package alibaba

import (
"github.com/spf13/cobra"
"github.com/teamssix/cf/command/scan/cmd"
"github.com/teamssix/cf/cmd"
)

func init() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package tencent

import (
"github.com/spf13/cobra"
"github.com/teamssix/cf/command/scan/cmd"
"github.com/teamssix/cf/cmd"
)

func init() {
Expand Down
20 changes: 10 additions & 10 deletions command/scan/cmd/tencent/vpc.go → cmd/tencent/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import (
)

var (
vpcRegion string
vpclsFlushCache bool
securityGroupId string
op string
vpcRegion string
vpclsFlushCache bool
op string
vpclsSecurityGroupId string
vpccontrolSecurityGroupId string
)

func init() {
tencentCmd.AddCommand(vpcCmd)
vpcCmd.AddCommand(vpclsCmd)
vpcCmd.AddCommand(vpccontrolCmd)
vpcCmd.PersistentFlags().BoolVar(&vpclsFlushCache, "flushCache", false, "刷新缓存,不使用缓存数据 (Refresh the cache without using cached data)")

vpclsCmd.Flags().StringVarP(&vpcRegion, "region", "r", "all", "指定区域 ID (Set Region ID)")
vpclsCmd.Flags().StringVarP(&securityGroupId, "securityGroupId", "g", "all", "指定安全组实例 ID (Set Security Group Id)")
vpclsCmd.PersistentFlags().BoolVar(&vpclsFlushCache, "flushCache", false, "刷新缓存,不使用缓存数据 (Refresh the cache without using cached data)")
vpccontrolCmd.Flags().StringVarP(&op, "op", "o", "add", "添加或删除安全组 (Add/Del security group)")
vpccontrolCmd.Flags().StringVarP(&securityGroupId, "securityGroupId", "g", "", "指定安全组实例 ID (Set Security Group Id)")
vpclsCmd.Flags().StringVarP(&vpclsSecurityGroupId, "securityGroupId", "i", "all", "指定安全组 ID (Set Security Group Id)")
}

var vpcCmd = &cobra.Command{
Expand All @@ -34,7 +34,7 @@ var vpclsCmd = &cobra.Command{
Short: "列出当前凭证下的VPC安全组策略 (List all vpc security group policy)",
Long: `列出当前凭证下的VPC安全组策略 (List all vpc security group policy)`,
Run: func(cmd *cobra.Command, args []string) {
tencentvpc.PrintVPCSecurityGroupPoliciesList(vpcRegion, &securityGroupId, vpclsFlushCache)
tencentvpc.PrintVPCSecurityGroupPoliciesList(vpcRegion, &vpclsSecurityGroupId, vpclsFlushCache)
},
}

Expand All @@ -43,6 +43,6 @@ var vpccontrolCmd = &cobra.Command{
Short: "添加或删除当前凭证下的VPC安全组策略 (Add/Del current vpc security group policy rule)",
Long: "添加或删除当前凭证下的VPC安全组策略 (Add/Del current vpc security group policy rule)",
Run: func(cmd *cobra.Command, args []string) {
tencentvpc.VPCControl(op, &securityGroupId)
tencentvpc.VPCControl()
},
}
File renamed without changes.
File renamed without changes.
11 changes: 0 additions & 11 deletions command/scan/main.go

This file was deleted.

11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ require (
github.com/aliyun/aliyun-oss-go-sdk v2.2.4+incompatible
github.com/gookit/color v1.5.1
github.com/ivanpirog/coloredcobra v1.0.1
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213
github.com/olekukonko/tablewriter v0.0.5
github.com/schollz/progressbar/v3 v3.8.6
github.com/ser163/WordBot v1.0.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.441
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.436
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.437
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.441
github.com/x-cray/logrus-prefixed-formatter v0.5.2
)

Expand All @@ -35,11 +39,8 @@ require (
github.com/onsi/gomega v1.19.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.441 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.436 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.437 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.441 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/net v0.0.0-20220615171555-694bf12d69de // indirect
Expand Down
Loading

0 comments on commit 4077b7a

Please sign in to comment.