Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions internal/namespaces/instance/v1/custom_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ func securityGroupClearCommand() *core.Command {
Resource: "security-group",
Verb: "clear",
ArgsType: reflect.TypeOf(instanceResetSecurityGroupArgs{}),
Examples: []*core.Example{
{
Short: "Remove all rules of the given security group",
Request: `{"security_group_id": "11111111-1111-1111-1111-111111111111"}`,
},
},
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
args := argsI.(*instanceResetSecurityGroupArgs)

Expand Down Expand Up @@ -324,6 +330,32 @@ func securityGroupUpdateCommand() *core.Command {
Name: "organization-default",
},
},
Examples: []*core.Example{
{
Short: "Set the default outbound policy as drop",
Request: `{"security_group_id": "11111111-1111-1111-1111-111111111111", "outbound_default_policy": "drop"}`,
},
{
Short: "Set the given security group as the default for the organization",
Request: `{"security_group_id": "11111111-1111-1111-1111-111111111111", "organization_default": true}`,
},
{
Short: "Change the name of the given security group",
Request: `{"security_group_id": "11111111-1111-1111-1111-111111111111", "name": "foobar"}`,
},
{
Short: "Change the description of the given security group",
Request: `{"security_group_id": "11111111-1111-1111-1111-111111111111", "description": "foobar"}`,
},
{
Short: "Enable stateful security group",
Request: `{"security_group_id": "11111111-1111-1111-1111-111111111111", "stateful": true}`,
},
{
Short: "Set the default inbound policy as drop",
Request: `{"security_group_id": "11111111-1111-1111-1111-111111111111", "inbound_default_policy": "drop"}`,
},
},
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
req := argsI.(*instance.UpdateSecurityGroupRequest)

Expand Down
50 changes: 50 additions & 0 deletions internal/namespaces/instance/v1/custom_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ func serverStartCommand() *core.Command {
Run: getRunServerAction(instance.ServerActionPoweron),
WaitFunc: waitForServerFunc(),
ArgSpecs: serverActionArgSpecs,
Examples: []*core.Example{
{
Short: "Start a server in the default zone with a given id",
Request: `{"server_id": "11111111-1111-1111-1111-111111111111"}`,
},
{
Short: "Start a server in fr-par-1 zone with a given id",
Request: `{"zone":"fr-par-1", "server_id": "11111111-1111-1111-1111-111111111111"}`,
},
},
}
}

Expand All @@ -210,6 +220,16 @@ func serverStopCommand() *core.Command {
Run: getRunServerAction(instance.ServerActionPoweroff),
WaitFunc: waitForServerFunc(),
ArgSpecs: serverActionArgSpecs,
Examples: []*core.Example{
{
Short: "Stop a server in the default zone with a given id",
Request: `{"server_id": "11111111-1111-1111-1111-111111111111"}`,
},
{
Short: "Stop a server in fr-par-1 zone with a given id",
Request: `{"zone":"fr-par-1", "server_id": "11111111-1111-1111-1111-111111111111"}`,
},
},
}
}

Expand All @@ -223,6 +243,16 @@ func serverStandbyCommand() *core.Command {
Run: getRunServerAction(instance.ServerActionStopInPlace),
WaitFunc: waitForServerFunc(),
ArgSpecs: serverActionArgSpecs,
Examples: []*core.Example{
{
Short: "Put in standby a server in the default zone with a given id",
Request: `{"server_id": "11111111-1111-1111-1111-111111111111"}`,
},
{
Short: "Put in standby a server in fr-par-1 zone with a given id",
Request: `{"zone":"fr-par-1", "server_id": "11111111-1111-1111-1111-111111111111"}`,
},
},
}
}

Expand All @@ -236,6 +266,16 @@ func serverRebootCommand() *core.Command {
Run: getRunServerAction(instance.ServerActionReboot),
WaitFunc: waitForServerFunc(),
ArgSpecs: serverActionArgSpecs,
Examples: []*core.Example{
{
Short: "Reboot a server in the default zone with a given id",
Request: `{"server_id": "11111111-1111-1111-1111-111111111111"}`,
},
{
Short: "Reboot a server in fr-par-1 zone with a given id",
Request: `{"zone":"fr-par-1", "server_id": "11111111-1111-1111-1111-111111111111"}`,
},
},
}
}

Expand Down Expand Up @@ -300,6 +340,16 @@ func serverDeleteCommand() *core.Command {
Short: "Force shutdown of the instance server before deleting it",
},
},
Examples: []*core.Example{
{
Short: "Delete a server in the default zone with a given id",
Request: `{"server_id": "11111111-1111-1111-1111-111111111111"}`,
},
{
Short: "Delete a server in fr-par-1 zone with a given id",
Request: `{"zone":"fr-par-1", "server_id": "11111111-1111-1111-1111-111111111111"}`,
},
},
SeeAlsos: []*core.SeeAlso{
{
Command: "scw instance server stop",
Expand Down