func (a WorkspacesAPI) Create(ws *Workspace, timeout time.Duration) error {
	if a.client.IsGcp() {
		ws.Cloud = "gcp"
	}
	workspacesAPIPath := fmt.Sprintf("/accounts/%s/workspaces", ws.AccountID)
	err := a.client.Post(a.context, workspacesAPIPath, ws, &ws)
	if err != nil {
		return err
	}
	if err = a.WaitForRunning(*ws, timeout); err != nil {
		log.Printf("[ERROR] Deleting failed workspace: %s", err)
		if derr := a.Delete(ws.AccountID, fmt.Sprintf("%d", ws.WorkspaceID)); derr != nil {
			return fmt.Errorf("%s - %s", err, derr)
		}
		return err
	}
	return nil
}
Create creates the workspace creation process
package mws
import (
	"bytes"
	"context"
	"fmt"
	"log"
	"net"
	"net/url"
	"strings"
	"time"
	"github.com/databrickslabs/terraform-provider-databricks/common"
	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
const DefaultProvisionTimeout = 20 * time.Minute
func NewWorkspacesAPI(ctx context.Context, m interface{}) WorkspacesAPI {
	return WorkspacesAPI{m.(*common.DatabricksClient), ctx}
}
type WorkspacesAPI struct {
	client  *common.DatabricksClient
	context context.Context
}