Skip to content

Latest commit

 

History

History
executable file
·
848 lines (578 loc) · 36.2 KB

File metadata and controls

executable file
·
848 lines (578 loc) · 36.2 KB

Workspaces

(Workspaces)

Overview

Operations related to workspaces

Available Operations

Create

Creates a new workspace for the current user in the specified workspace group. You must specify the name of the workspace and the workspace group ID in the request body. Once a workspace is created, you can neither change its name nor its workspace group. See Workspaces for more information. This API call does not take any request parameters.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )

    ctx := context.Background()
    res, err := s.Workspaces.Create(ctx, shared.WorkspaceCreate{
        Name: "demo-workspace",
        Size: singlestoresamplesdk.String("S-2"),
        WorkspaceGroupID: "c74bb6a6-0000-1000-9000-1d874fa277b0",
    })
    if err != nil {
        log.Fatal(err)
    }

    if res.CreateWorkspace != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request shared.WorkspaceCreate ✔️ The request object to use for the request.

Response

*operations.CreateWorkspaceResponse, error

CreateResume

Resumes a workspace with the specified workspace ID. You must specify the workspace ID in the API call.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "fa7d92df-5772-4b0d-b31b-774d5a65a840"

    ctx := context.Background()
    res, err := s.Workspaces.CreateResume(ctx, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.CreateWorkspace != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace

Response

*operations.CreateResumeWorkspaceResponse, error

CreateStorage

You must specify the workspace ID of a workspace in the group you are setting up for disaster recovery and the region ID of your secondary region.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    storageDRSetup := shared.StorageDRSetup{
        DatabaseNames: []string{
            "x",
            "_",
            "d",
            "b",
        },
        RegionID: "6eaad1a5-ac7d-4864-9f5c-1bc4cadf5345",
    }

    var workspaceID string = "a7ac8961-1881-4fc6-aa1d-b91f19b96abd"

    ctx := context.Background()
    res, err := s.Workspaces.CreateStorage(ctx, storageDRSetup, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.StatusCode == http.StatusOK {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
storageDRSetup shared.StorageDRSetup ✔️ Here's a sample of JSON data sent in the request body to the API.
workspaceID string ✔️ ID of the workspace

Response

*operations.CreateStorageWorkspaceResponse, error

CreateSuspend

Suspends a workspace with the specified workspace ID. You must specify the workspace ID in the API call.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "c87573e7-0304-4e45-9e6f-720fedb49011"

    ctx := context.Background()
    res, err := s.Workspaces.CreateSuspend(ctx, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.CreateWorkspace != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace

Response

*operations.CreateSuspendWorkspaceResponse, error

Delete

Terminates a workspace with the specified workspace ID. You must specify the workspace ID in the API call.

All the databases attached to the workspace are detached when the workspace is terminated.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "8db863f6-ef9b-413a-8a70-cb816b33de6b"

    ctx := context.Background()
    res, err := s.Workspaces.Delete(ctx, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.CreateWorkspace != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace

Response

*operations.DeleteWorkspaceResponse, error

Get

Returns workspace information for the specified workspace ID, in JSON format. You must specify the workspace ID in the API call.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "b18d8d81-fd7b-4764-a31e-475cb1f36591"

    var fields *string = "Optional"

    ctx := context.Background()
    res, err := s.Workspaces.Get(ctx, workspaceID, fields)
    if err != nil {
        log.Fatal(err)
    }

    if res.Workspace != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace
fields *string Comma-separated values list that correspond to the filtered fields for returned entities

Response

*operations.GetteWorkspaceResponse, error

GetOutbound

Returns the account ID which must be allowed for outbound connections.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "29f5c6af-4fba-4437-9707-abf378a1660b"

    ctx := context.Background()
    res, err := s.Workspaces.GetOutbound(ctx, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.PrivateConnectionOutboundAllowLists != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace

Response

*operations.GetOutboundWorkspaceResponse, error

GetPrivateConnection

Returns private connection information for the specified workspace ID, in JSON format. You must specify the workspace ID in the API call.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "4e6c6827-27ee-4013-85e7-e36151e0fa57"

    var fields *string = "mobile"

    ctx := context.Background()
    res, err := s.Workspaces.GetPrivateConnection(ctx, workspaceID, fields)
    if err != nil {
        log.Fatal(err)
    }

    if res.PrivateConnections != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace
fields *string Comma-separated values list that correspond to the filtered fields for returned entities

Response

*operations.GetPrivateConnectionWorkspaceResponse, error

GetRecoveryBackup

Returns a list of regions with regions IDs in JSON format. You must specify the workspace ID of a workspace in the group you are setting up for disaster recovery.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "0ebde48c-76bc-474b-a15a-a09cafb361f4"

    var fields *string = "Dinar"

    ctx := context.Background()
    res, err := s.Workspaces.GetRecoveryBackup(ctx, workspaceID, fields)
    if err != nil {
        log.Fatal(err)
    }

    if res.Regions != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace
fields *string Comma-separated values list that correspond to the filtered fields for returned entities

Response

*operations.GetRecoveryBackupWorkspaceResponse, error

GetStorageStatus

Returns the replication status of each database and the status of the latest Storage DR operation (Failover, Failback, etc.). You must specify the workspace ID of a workspace in the group for which you are requesting the status information.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "0a28532b-9597-4f57-8ab0-f1d1e4f998a8"

    ctx := context.Background()
    res, err := s.Workspaces.GetStorageStatus(ctx, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.StorageDRStatus != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace

Response

*operations.GetStorageStatusWorkspaceResponse, error

List

Returns a list of all of the workspaces accessible to the user in the specified workspace group. You must specify the workspace group ID in the API call to list the workspaces in the group. Use the includeTerminated parameter to list the terminated workspaces.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceGroupID string = "c184a429-302e-4aca-80db-f1718b882a50"

    var fields *string = "backing"

    var includeTerminated *bool = false

    ctx := context.Background()
    res, err := s.Workspaces.List(ctx, workspaceGroupID, fields, includeTerminated)
    if err != nil {
        log.Fatal(err)
    }

    if res.Workspaces != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceGroupID string ✔️ ID of the workspace group
fields *string Comma-separated values list that correspond to the filtered fields for returned entities
includeTerminated *bool To include any terminated workspaces, set to true

Response

*operations.ListWorkspaceResponse, error

Update

Updates workspace information for the specified workspace, including the size. Specify the workspace's new parameters in the request body. You must specify the workspace ID in the API call.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    workspaceUpdate := shared.WorkspaceUpdate{
        Size: singlestoresamplesdk.String("S-2"),
    }

    var workspaceID string = "d0905bf4-aa77-4f20-8e77-54c352acfe54"

    ctx := context.Background()
    res, err := s.Workspaces.Update(ctx, workspaceUpdate, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.CreateWorkspace != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceUpdate shared.WorkspaceUpdate ✔️ Here's a sample of JSON data sent to the API in the request body.
workspaceID string ✔️ ID of the workspace

Response

*operations.UpdateWorkspaceResponse, error

UpdateFailback

You must specify the workspace ID of a workspace in the standby (secondary) region from which you are triggering the failback.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "ee046eb6-b3d2-4b2b-8152-054b3b64d961"

    ctx := context.Background()
    res, err := s.Workspaces.UpdateFailback(ctx, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.StatusCode == http.StatusOK {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace

Response

*operations.UpdateFailbackWorkspaceResponse, error

UpdateFailover

You must specify the workspace ID of a workspace in the group in the inactive (primary) region from which you are triggering the failover.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "15aad03f-9196-4964-a967-bbe47f374a9c"

    ctx := context.Background()
    res, err := s.Workspaces.UpdateFailover(ctx, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.StatusCode == http.StatusOK {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace

Response

*operations.UpdateFailoverWorkspaceResponse, error

UpdateStartFailoverTestMode

You must specify the workspace ID of a workspace in the group in the active (primary) region that you will failover from. This will give you an opportunity to setup any configuration on your workspace group in the secondary region.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "062601a8-d539-45de-82f7-4bf69a96713d"

    ctx := context.Background()
    res, err := s.Workspaces.UpdateStartFailoverTestMode(ctx, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.StatusCode == http.StatusOK {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace

Response

*operations.UpdateStartFailoverTestModeWorkspaceResponse, error

UpdateStopFailoverTestMode

You must specify the workspace ID of a workspace in the group in the active (primary) region that you will failover from. This will end the Failover test making the workspace group in the secondary region along with its configuration no longer accessible.

Example Usage

package main

import(
	"context"
	"log"
	singlestoresamplesdk "github.com/speakeasy-sdks/singlestore-sample-sdk"
	"github.com/speakeasy-sdks/singlestore-sample-sdk/pkg/models/shared"
)

func main() {
    s := singlestoresamplesdk.New(
        singlestoresamplesdk.WithSecurity(""),
    )


    var workspaceID string = "e2ad172a-bce4-4aca-90ec-87dc592f3d9f"

    ctx := context.Background()
    res, err := s.Workspaces.UpdateStopFailoverTestMode(ctx, workspaceID)
    if err != nil {
        log.Fatal(err)
    }

    if res.StatusCode == http.StatusOK {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workspaceID string ✔️ ID of the workspace

Response

*operations.UpdateStopFailoverTestModeWorkspaceResponse, error