func (c *DatabricksClient) Get(ctx context.Context, path string, request interface{}, response interface{}) error {
	body, err := c.authenticatedQuery(ctx, http.MethodGet, path, request, c.completeUrl)
	if err != nil {
		return err
	}
	return c.unmarshall(path, body, &response)
}
Get on path
package common
import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"
	"reflect"
	"regexp"
	"strings"
	"github.com/google/go-querystring/query"
	"github.com/hashicorp/go-retryablehttp"
)
var (
	e2example                   = "https://registry.terraform.io/providers/databrickslabs/databricks/latest/docs/guides/aws-workspace"
	accountsHost                = "accounts.cloud.databricks.com"
	transientErrorStringMatches = []string{
		"com.databricks.backend.manager.util.UnknownWorkerEnvironmentException",
		"does not have any associated worker environments",
		"There is no worker environment with id",
		"Unknown worker environment",
		"ClusterNotReadyException",
		"connection reset by peer",
		"connection refused",
		"Unexpected error",
		"i/o timeout",
	}
)
type APIErrorBody struct {
	ErrorCode string `json:"error_code,omitempty"`
	Message   string `json:"message,omitempty"`
	ScimDetail string `json:"detail,omitempty"`
	ScimStatus string `json:"status,omitempty"`
	API12Error string `json:"error,omitempty"`
}
type APIError struct {
	ErrorCode  string
	Message    string
	Resource   string
	StatusCode int
}
func (apiError APIError) Error() string {
	if apiError.StatusCode != 404 {
		docs := apiError.DocumentationURL()
		log.Printf("[WARN] %s:%d - %s %s", apiError.Resource, apiError.StatusCode, apiError.Message, docs)
	}
	return apiError.Message
}
func IsMissing(err error) bool {
	if err == nil {
		return false
	}
	e, ok := err.(APIError)
	return ok && e.IsMissing()
}
func (apiError APIError) IsMissing() bool {
	return apiError.StatusCode == http.StatusNotFound
}
func (apiError APIError) IsTooManyRequests() bool {
	return apiError.StatusCode == http.StatusTooManyRequests
}
func (apiError APIError) DocumentationURL() string {
	endpointRE := regexp.MustCompile(`/api/2.0/([^/]+)/([^/]+)$`)
	endpointMatches := endpointRE.FindStringSubmatch(apiError.Resource)
	if len(endpointMatches) < 3 {
		return ""
	}
	return fmt.Sprintf("https://docs.databricks.com/dev-tools/api/latest/%s.html#%s",
		endpointMatches[1], endpointMatches[2])
}
func (apiError APIError) IsRetriable() bool {
	for _, substring := range transientErrorStringMatches {
		if strings.Contains(apiError.Message, substring) {
			log.Printf("[INFO] Attempting retry because of %#v", substring)
			return true
		}
	}
	return false
}
func NotFound(message string) APIError {
	return APIError{
		ErrorCode:  "NOT_FOUND",
		StatusCode: 404,
		Message:    message,
	}
}
func (c *DatabricksClient) parseUnknownError(
	status string, body []byte, err error) (errorBody APIErrorBody) {
	statusParts := strings.SplitN(status, " ", 2)
	if len(statusParts) < 2 {
		errorBody.ErrorCode = "UNKNOWN"
	} else {
		errorBody.ErrorCode = strings.ReplaceAll(
			strings.ToUpper(strings.Trim(statusParts[1], " .")),
			" ", "_")
	}
	stringBody := string(body)
	messageRE := regexp.MustCompile(`<pre>(.*)</pre>`)
	messageMatches := messageRE.FindStringSubmatch(stringBody)
	if len(messageMatches) < 2 {
		errorBody.Message = fmt.Sprintf("Response from server (%s) %s: %v",
			status, stringBody, err)
		return
	}
	errorBody.Message = strings.Trim(messageMatches[1], " .")
	return
}
func (c *DatabricksClient) isAccountsClient() bool {
	return strings.HasPrefix(c.Host, "https://accounts.")
}
func (c *DatabricksClient) commonErrorClarity(resp *http.Response) *APIError {
	isAccountsAPI := strings.HasPrefix(resp.Request.URL.Path, "/api/2.0/accounts")
	isAccountsClient := c.isAccountsClient()
	isTesting := strings.HasPrefix(resp.Request.URL.Host, "127.0.0.1")
	if !isTesting && isAccountsClient && !isAccountsAPI {
		return &APIError{
			ErrorCode: "INCORRECT_CONFIGURATION",
			Message: fmt.Sprintf("Databricks API (%s) requires you to set `host` property "+
				"(or DATABRICKS_HOST env variable) to result of `databricks_mws_workspaces.this.workspace_url`. "+
				"This error may happen if you're using provider in both normal and multiworkspace mode. Please "+
				"refactor your code into different modules. Runnable example that we use for integration testing "+
				"can be found in this repository at %s", resp.Request.URL.Path, e2example),
			StatusCode: resp.StatusCode,
			Resource:   resp.Request.URL.Path,
		}
	}
	if !isTesting && isAccountsAPI && !isAccountsClient {
		return &APIError{
			ErrorCode: "INCORRECT_CONFIGURATION",
			Message: fmt.Sprintf("Accounts API (%s) requires you to set %s as DATABRICKS_HOST, but you have "+
				"specified %s instead. This error may happen if you're using provider in both "+
				"normal and multiworkspace mode. Please refactor your code into different modules. "+
				"Runnable example that we use for integration testing can be found in this "+
				"repository at %s", resp.Request.URL.Path, accountsHost, c.Host, e2example),
			StatusCode: resp.StatusCode,
			Resource:   resp.Request.URL.Path,
		}
	}
	return nil
}
func (c *DatabricksClient) parseError(resp *http.Response) APIError {
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return APIError{
			Message:    err.Error(),
			ErrorCode:  "IO_READ",
			StatusCode: resp.StatusCode,
			Resource:   resp.Request.URL.Path,
		}
	}
	log.Printf("[DEBUG] %s %v", resp.Status, c.redactedDump(body))
	mwsError := c.commonErrorClarity(resp)
	if mwsError != nil {
		return *mwsError
	}
	var errorBody APIErrorBody
	err = json.Unmarshal(body, &errorBody)
	if err != nil {
		errorBody = c.parseUnknownError(resp.Status, body, err)
	}
	if errorBody.API12Error != "" {
		errorBody.Message = errorBody.API12Error
	}
	if errorBody.Message == "" && errorBody.ScimDetail != "" {
		if errorBody.ScimDetail == "null" {
			errorBody.Message = "SCIM API Internal Error"
		} else {
			errorBody.Message = errorBody.ScimDetail
		}
		errorBody.ErrorCode = fmt.Sprintf("SCIM_%s", errorBody.ScimStatus)
	}
	return APIError{
		Message:    errorBody.Message,
		ErrorCode:  errorBody.ErrorCode,
		StatusCode: resp.StatusCode,
		Resource:   resp.Request.URL.Path,
	}
}
func (c *DatabricksClient) checkHTTPRetry(ctx context.Context, resp *http.Response, err error) (bool, error) {
	if ue, ok := err.(*url.Error); ok {
		apiError := APIError{
			ErrorCode:  "IO_ERROR",
			StatusCode: 523,
			Message:    ue.Error(),
		}
		return apiError.IsRetriable(), apiError
	}
	if resp == nil {
		return false, err
	}
	if resp.StatusCode == 429 {
		return true, APIError{
			ErrorCode:  "TOO_MANY_REQUESTS",
			Message:    "Current request has to be retried",
			StatusCode: 429,
		}
	}
	if resp.StatusCode >= 400 {
		apiError := c.parseError(resp)
		return apiError.IsRetriable(), apiError
	}
	return false, nil
}