Skip to content

Commit 4f6be2d

Browse files
authored
Merge branch 'master' into v1.6264.0
2 parents 7c1edd7 + 6137a76 commit 4f6be2d

File tree

1 file changed

+149
-0
lines changed

1 file changed

+149
-0
lines changed

internal/namespaces/vpc/v2/vpc_cli.go

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ func GetGeneratedCommands() *core.Commands {
4141
vpcRouteGet(),
4242
vpcRouteUpdate(),
4343
vpcRouteDelete(),
44+
vpcRuleGet(),
45+
vpcRuleSet(),
4446
vpcRouteList(),
4547
)
4648
}
@@ -848,6 +850,153 @@ func vpcRouteDelete() *core.Command {
848850
}
849851
}
850852

853+
func vpcRuleGet() *core.Command {
854+
return &core.Command{
855+
Short: `Get Acl Rules for VPC`,
856+
Long: `Retrieve a list of ACL rules for a VPC, specified by its VPC ID.`,
857+
Namespace: "vpc",
858+
Resource: "rule",
859+
Verb: "get",
860+
// Deprecated: false,
861+
ArgsType: reflect.TypeOf(vpc.GetACLRequest{}),
862+
ArgSpecs: core.ArgSpecs{
863+
{
864+
Name: "vpc-id",
865+
Short: `ID of the Network ACL's VPC`,
866+
Required: true,
867+
Deprecated: false,
868+
Positional: false,
869+
},
870+
{
871+
Name: "is-ipv6",
872+
Short: `Defines whether this set of ACL rules is for IPv6 (false = IPv4). Each Network ACL can have rules for only one IP type.`,
873+
Required: true,
874+
Deprecated: false,
875+
Positional: false,
876+
},
877+
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
878+
},
879+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
880+
request := args.(*vpc.GetACLRequest)
881+
882+
client := core.ExtractClient(ctx)
883+
api := vpc.NewAPI(client)
884+
return api.GetACL(request)
885+
886+
},
887+
}
888+
}
889+
890+
func vpcRuleSet() *core.Command {
891+
return &core.Command{
892+
Short: `Set VPC ACL rules`,
893+
Long: `Set the list of ACL rules and the default routing policy for a VPC.`,
894+
Namespace: "vpc",
895+
Resource: "rule",
896+
Verb: "set",
897+
// Deprecated: false,
898+
ArgsType: reflect.TypeOf(vpc.SetACLRequest{}),
899+
ArgSpecs: core.ArgSpecs{
900+
{
901+
Name: "vpc-id",
902+
Short: `ID of the Network ACL's VPC`,
903+
Required: true,
904+
Deprecated: false,
905+
Positional: false,
906+
},
907+
{
908+
Name: "rules.{index}.protocol",
909+
Short: `Protocol to which this rule applies`,
910+
Required: true,
911+
Deprecated: false,
912+
Positional: false,
913+
EnumValues: []string{"ANY", "TCP", "UDP", "ICMP"},
914+
},
915+
{
916+
Name: "rules.{index}.source",
917+
Short: `Source IP range to which this rule applies (CIDR notation with subnet mask)`,
918+
Required: true,
919+
Deprecated: false,
920+
Positional: false,
921+
},
922+
{
923+
Name: "rules.{index}.src-port-low",
924+
Short: `Starting port of the source port range to which this rule applies (inclusive)`,
925+
Required: true,
926+
Deprecated: false,
927+
Positional: false,
928+
},
929+
{
930+
Name: "rules.{index}.src-port-high",
931+
Short: `Ending port of the source port range to which this rule applies (inclusive)`,
932+
Required: true,
933+
Deprecated: false,
934+
Positional: false,
935+
},
936+
{
937+
Name: "rules.{index}.destination",
938+
Short: `Destination IP range to which this rule applies (CIDR notation with subnet mask)`,
939+
Required: true,
940+
Deprecated: false,
941+
Positional: false,
942+
},
943+
{
944+
Name: "rules.{index}.dst-port-low",
945+
Short: `Starting port of the destination port range to which this rule applies (inclusive)`,
946+
Required: true,
947+
Deprecated: false,
948+
Positional: false,
949+
},
950+
{
951+
Name: "rules.{index}.dst-port-high",
952+
Short: `Ending port of the destination port range to which this rule applies (inclusive)`,
953+
Required: true,
954+
Deprecated: false,
955+
Positional: false,
956+
},
957+
{
958+
Name: "rules.{index}.action",
959+
Short: `Policy to apply to the packet`,
960+
Required: true,
961+
Deprecated: false,
962+
Positional: false,
963+
EnumValues: []string{"unknown_action", "accept", "drop"},
964+
},
965+
{
966+
Name: "rules.{index}.description",
967+
Short: `Rule description`,
968+
Required: true,
969+
Deprecated: false,
970+
Positional: false,
971+
},
972+
{
973+
Name: "is-ipv6",
974+
Short: `Defines whether this set of ACL rules is for IPv6 (false = IPv4). Each Network ACL can have rules for only one IP type.`,
975+
Required: true,
976+
Deprecated: false,
977+
Positional: false,
978+
},
979+
{
980+
Name: "default-policy",
981+
Short: `Action to take for packets which do not match any rules`,
982+
Required: true,
983+
Deprecated: false,
984+
Positional: false,
985+
EnumValues: []string{"unknown_action", "accept", "drop"},
986+
},
987+
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
988+
},
989+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
990+
request := args.(*vpc.SetACLRequest)
991+
992+
client := core.ExtractClient(ctx)
993+
api := vpc.NewAPI(client)
994+
return api.SetACL(request)
995+
996+
},
997+
}
998+
}
999+
8511000
func vpcRouteList() *core.Command {
8521001
return &core.Command{
8531002
Short: `Return routes with associated next hop data`,

0 commit comments

Comments
 (0)