diff --git a/internal/namespaces/instance/v1/custom_security_group.go b/internal/namespaces/instance/v1/custom_security_group.go index 83a198e470..66c87ac692 100644 --- a/internal/namespaces/instance/v1/custom_security_group.go +++ b/internal/namespaces/instance/v1/custom_security_group.go @@ -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) @@ -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) diff --git a/internal/namespaces/instance/v1/custom_server.go b/internal/namespaces/instance/v1/custom_server.go index 37525b7eaa..609c34a150 100644 --- a/internal/namespaces/instance/v1/custom_server.go +++ b/internal/namespaces/instance/v1/custom_server.go @@ -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"}`, + }, + }, } } @@ -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"}`, + }, + }, } } @@ -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"}`, + }, + }, } } @@ -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"}`, + }, + }, } } @@ -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",