Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Internal] replaced common.APIErrorBody with corresponding structs in Go SDK #3832

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
12 changes: 6 additions & 6 deletions access/resource_ip_access_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"net/http"
"testing"

"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/databricks-sdk-go/service/settings"
"github.com/databricks/terraform-provider-databricks/common"
"github.com/databricks/terraform-provider-databricks/qa"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestAPIACLCreate_Error(t *testing.T) {
{
Method: http.MethodPost,
Resource: "/api/2.0/ip-access-lists",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "RESOURCE_ALREADY_EXISTS",
Message: "IP access list with type (" + TestingListTypeString + ") and label (" + TestingLabel + ") already exists",
},
Expand Down Expand Up @@ -185,7 +185,7 @@ func TestIPACLUpdate_Error(t *testing.T) {
ExpectedRequest: settings.UpdateIpAccessList{
Enabled: TestingEnabled,
},
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "SERVER_ERROR",
Message: "Something unexpected happened",
},
Expand Down Expand Up @@ -240,7 +240,7 @@ func TestIPACLRead_NotFound(t *testing.T) {
{
Method: http.MethodGet,
Resource: "/api/2.0/ip-access-lists/" + TestingId + "?",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "RESOURCE_DOES_NOT_EXIST",
Message: "Can't find an IP access list with id: " + TestingId + ".",
},
Expand All @@ -260,7 +260,7 @@ func TestIPACLRead_Error(t *testing.T) {
{
Method: http.MethodGet,
Resource: "/api/2.0/ip-access-lists/" + TestingId + "?",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "SERVER_ERROR",
Message: "Something unexpected happened",
},
Expand Down Expand Up @@ -298,7 +298,7 @@ func TestIPACLDelete_Error(t *testing.T) {
{
Method: http.MethodDelete,
Resource: fmt.Sprintf("/api/2.0/ip-access-lists/%s?", TestingId),
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_STATE",
Message: "Something went wrong",
},
Expand Down
14 changes: 7 additions & 7 deletions aws/resource_group_instance_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package aws
import (
"testing"

"github.com/databricks/terraform-provider-databricks/common"
"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/terraform-provider-databricks/scim"

"github.com/databricks/terraform-provider-databricks/qa"
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestResourceGroupInstanceProfileCreate_Error(t *testing.T) {
{
Method: "PATCH",
Resource: "/api/2.0/preview/scim/v2/Groups/abc",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand All @@ -80,7 +80,7 @@ func TestResourceGroupInstanceProfileCreate_Error_InvalidARN(t *testing.T) {
{
Method: "PATCH",
Resource: "/api/2.0/preview/scim/v2/Groups/abc",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand All @@ -103,7 +103,7 @@ func TestResourceGroupInstanceProfileCreate_Error_OtherARN(t *testing.T) {
{
Method: "PATCH",
Resource: "/api/2.0/preview/scim/v2/Groups/abc",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestResourceGroupInstanceProfileRead_NotFound(t *testing.T) {
{
Method: "GET",
Resource: "/api/2.0/preview/scim/v2/Groups/abc?attributes=roles",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "NOT_FOUND",
Message: "Item not found",
},
Expand Down Expand Up @@ -192,7 +192,7 @@ func TestResourceGroupInstanceProfileRead_Error(t *testing.T) {
{
Method: "GET",
Resource: "/api/2.0/preview/scim/v2/Groups/abc?attributes=roles",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -232,7 +232,7 @@ func TestResourceGroupInstanceProfileDelete_Error(t *testing.T) {
{
Method: "PATCH",
Resource: "/api/2.0/preview/scim/v2/Groups/abc",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down
10 changes: 5 additions & 5 deletions aws/resource_instance_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package aws
import (
"testing"

"github.com/databricks/terraform-provider-databricks/common"
"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/terraform-provider-databricks/qa"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -114,7 +114,7 @@ func TestResourceInstanceProfileCreate_Error(t *testing.T) {
{
Method: "POST",
Resource: "/api/2.0/instance-profiles/add",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -249,7 +249,7 @@ func TestResourceInstanceProfileRead_Error(t *testing.T) {
{
Method: "GET",
Resource: "/api/2.0/instance-profiles/list",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -289,7 +289,7 @@ func TestResourceInstanceProfileDelete_Error(t *testing.T) {
{
Method: "POST",
Resource: "/api/2.0/instance-profiles/remove",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -356,7 +356,7 @@ func TestResourceInstanceProfileUpdate_Error(t *testing.T) {
{
Method: "POST",
Resource: "/api/2.0/instance-profiles/edit",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down
6 changes: 3 additions & 3 deletions aws/resource_service_principal_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package aws
import (
"testing"

"github.com/databricks/terraform-provider-databricks/common"
"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/terraform-provider-databricks/scim"

"github.com/databricks/terraform-provider-databricks/qa"
Expand Down Expand Up @@ -53,7 +53,7 @@ func TestResourceServicePrincipalRoleCreate_Error(t *testing.T) {
{
Method: "PATCH",
Resource: "/api/2.0/preview/scim/v2/ServicePrincipals/abc",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestResourceServicePrincipalRoleRead_NotFound(t *testing.T) {
{
Method: "GET",
Resource: "/api/2.0/preview/scim/v2/ServicePrincipals/abc?attributes=roles",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "NOT_FOUND",
Message: "Item not found",
},
Expand Down
10 changes: 5 additions & 5 deletions aws/resource_user_instance_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package aws
import (
"testing"

"github.com/databricks/terraform-provider-databricks/common"
"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/terraform-provider-databricks/scim"

"github.com/databricks/terraform-provider-databricks/qa"
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestResourceUserInstanceProfileCreate_Error(t *testing.T) {
{
Method: "PATCH",
Resource: "/api/2.0/preview/scim/v2/Users/abc",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestResourceUserInstanceProfileRead_NotFound(t *testing.T) {
{
Method: "GET",
Resource: "/api/2.0/preview/scim/v2/Users/abc?attributes=roles",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "NOT_FOUND",
Message: "Item not found",
},
Expand All @@ -158,7 +158,7 @@ func TestResourceUserInstanceProfileRead_Error(t *testing.T) {
{
Method: "GET",
Resource: "/api/2.0/preview/scim/v2/Users/abc?attributes=roles",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -198,7 +198,7 @@ func TestResourceUserInstanceProfileDelete_Error(t *testing.T) {
{
Method: "PATCH",
Resource: "/api/2.0/preview/scim/v2/Users/abc",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down
10 changes: 5 additions & 5 deletions catalog/resource_artifact_allowlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"net/http"
"testing"

"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/databricks/terraform-provider-databricks/common"
"github.com/databricks/terraform-provider-databricks/qa"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -105,7 +105,7 @@ func TestArtifactAllowlistCreate_Error(t *testing.T) {
Method: http.MethodPut,
Resource: "/api/2.1/unity-catalog/artifact-allowlists/INIT_SCRIPT",
ExpectedRequest: setArtifact,
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "SERVER_ERROR",
Message: "Something unexpected happened",
},
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestResourceArtifactAllowlistRead_Error(t *testing.T) {
{
Method: "GET",
Resource: "/api/2.1/unity-catalog/artifact-allowlists/INIT_SCRIPT?",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestArtifactAllowlistUpdate_Error(t *testing.T) {
Method: http.MethodPut,
Resource: "/api/2.1/unity-catalog/artifact-allowlists/INIT_SCRIPT",
ExpectedRequest: updateArtifact,
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "SERVER_ERROR",
Message: "Something unexpected happened",
},
Expand Down Expand Up @@ -280,7 +280,7 @@ func TestArtifactAllowlistDelete_Error(t *testing.T) {
ArtifactType: catalog.ArtifactTypeInitScript,
ArtifactMatchers: []catalog.ArtifactMatcher{},
},
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_STATE",
Message: "Something went wrong",
},
Expand Down
10 changes: 5 additions & 5 deletions catalog/resource_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"net/http"
"testing"

"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/databricks/terraform-provider-databricks/common"
"github.com/databricks/terraform-provider-databricks/qa"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestConnectionsCreate_Error(t *testing.T) {
"host": "test.com",
},
},
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "SERVER_ERROR",
Message: "Something unexpected happened",
},
Expand Down Expand Up @@ -210,7 +210,7 @@ func TestConnectionRead_Error(t *testing.T) {
{
Method: "GET",
Resource: "/api/2.1/unity-catalog/connections/testConnectionName?",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down Expand Up @@ -395,7 +395,7 @@ func TestConnectionUpdate_Error(t *testing.T) {
"host": "test.com",
},
},
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "SERVER_ERROR",
Message: "Something unexpected happened",
},
Expand Down Expand Up @@ -443,7 +443,7 @@ func TestConnectionDelete_Error(t *testing.T) {
{
Method: http.MethodDelete,
Resource: "/api/2.1/unity-catalog/connections/testConnectionName?",
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_STATE",
Message: "Something went wrong",
},
Expand Down
8 changes: 4 additions & 4 deletions catalog/resource_external_location_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"testing"

"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/databricks-sdk-go/experimental/mocks"
"github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/databricks/terraform-provider-databricks/common"
"github.com/databricks/terraform-provider-databricks/qa"
"github.com/stretchr/testify/mock"
)
Expand Down Expand Up @@ -450,7 +450,7 @@ func TestUpdateExternalLocationRollback(t *testing.T) {
Url: "s3://foo/bar",
CredentialName: "xyz",
},
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "SERVER_ERROR",
Message: "Something unexpected happened",
},
Expand Down Expand Up @@ -514,7 +514,7 @@ func TestUpdateExternalLocationRollbackError(t *testing.T) {
Url: "s3://foo/bar",
CredentialName: "xyz",
},
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "SERVER_ERROR",
Message: "Something unexpected happened",
},
Expand All @@ -526,7 +526,7 @@ func TestUpdateExternalLocationRollbackError(t *testing.T) {
ExpectedRequest: catalog.UpdateExternalLocation{
Owner: "administrators",
},
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "INVALID_REQUEST",
Message: "Internal error happened",
},
Expand Down
4 changes: 2 additions & 2 deletions catalog/resource_storage_credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package catalog
import (
"testing"

"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/databricks-sdk-go/experimental/mocks"
"github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/databricks/terraform-provider-databricks/common"
"github.com/databricks/terraform-provider-databricks/qa"
"github.com/stretchr/testify/mock"
)
Expand Down Expand Up @@ -506,7 +506,7 @@ func TestUpdateStorageCredentialsRollback(t *testing.T) {
RoleArn: "CHANGED",
},
},
Response: common.APIErrorBody{
Response: apierr.APIError{
ErrorCode: "SERVER_ERROR",
Message: "Something unexpected happened",
},
Expand Down
Loading
Loading