Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions internal/provider/destination_filter_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 204 in internal/provider/destination_filter_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 204 in internal/provider/destination_filter_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Destination Filter (ID: %s)", previousState.ID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/destination_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 590 in internal/provider/destination_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 590 in internal/provider/destination_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Destination (ID: %s)", previousState.ID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/destination_subscription_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 231 in internal/provider/destination_subscription_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 231 in internal/provider/destination_subscription_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Destination subscription (ID: %s)", previousState.ID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/function_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 192 in internal/provider/function_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 192 in internal/provider/function_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Function (ID: %s)", previousState.ID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/insert_function_instance_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 162 in internal/provider/insert_function_instance_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 162 in internal/provider/insert_function_instance_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Insert Function instance (ID: %s)", previousState.ID.ValueString()),
getError(err, body),
Expand Down
5 changes: 1 addition & 4 deletions internal/provider/label_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ func (r *labelResource) Read(ctx context.Context, req resource.ReadRequest, resp
}

if label == nil {
resp.Diagnostics.AddError(
"Unable to find Label",
fmt.Sprintf("Unable to find Label with key: %q and value: %q", state.Key, state.Value),
)
resp.State.RemoveResource(ctx)

return
}
Expand Down
7 changes: 3 additions & 4 deletions internal/provider/profiles_warehouse_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ func (r *profilesWarehouseResource) Read(ctx context.Context, req resource.ReadR

warehouse, err := findProfileWarehouse(r.authContext, r.client, previousState.ID.ValueString(), previousState.SpaceID.ValueString())
if err != nil {
resp.State.RemoveResource(ctx)

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Profiles Warehouse (ID: %s)", previousState.ID.ValueString()),
err.Error(),
Expand All @@ -176,10 +178,7 @@ func (r *profilesWarehouseResource) Read(ctx context.Context, req resource.ReadR
}

if warehouse == nil {
resp.Diagnostics.AddError(
"Unable to find Profile Warehouse",
fmt.Sprintf("Profile Warehouse with id '%s' and space id '%s' not found", previousState.ID.ValueString(), previousState.SpaceID.ValueString()),
)
resp.State.RemoveResource(ctx)

return
}
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/reverse_etl_model_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 163 in internal/provider/reverse_etl_model_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 163 in internal/provider/reverse_etl_model_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Reverse ETL model (ID: %s)", previousState.ID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/source_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 390 in internal/provider/source_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 390 in internal/provider/source_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Source (ID: %s)", previousState.ID.ValueString()),
getError(err, body),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 258 in internal/provider/source_tracking_plan_connection_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 258 in internal/provider/source_tracking_plan_connection_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Source (ID: %s)", previousState.SourceID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/source_warehouse_connection_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 129 in internal/provider/source_warehouse_connection_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 129 in internal/provider/source_warehouse_connection_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
"Unable to read Source-Warehouse connection",
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/tracking_plan_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {

Check failure on line 230 in internal/provider/tracking_plan_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)

Check failure on line 230 in internal/provider/tracking_plan_resource.go

View workflow job for this annotation

GitHub Actions / Build

"404" can be replaced by http.StatusNotFound (usestdlibvars)
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Tracking Plan (ID: %s)", config.ID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/transformation_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ func (r *transformationResource) Read(ctx context.Context, req resource.ReadRequ
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 || body.StatusCode == 403 {
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Transformation (ID: %s)", previousState.ID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/user_group_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ func (r *userGroupResource) Read(ctx context.Context, req resource.ReadRequest,
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read User Group (ID: %s)", config.ID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/user_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ func (r *userResource) Read(ctx context.Context, req resource.ReadRequest, resp
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read user (ID: %s)", state.ID.ValueString()),
getError(err, body),
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/warehouse_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ func (r *warehouseResource) Read(ctx context.Context, req resource.ReadRequest,
defer body.Body.Close()
}
if err != nil {
if body.StatusCode == 404 {
resp.State.RemoveResource(ctx)

return
}

resp.Diagnostics.AddError(
fmt.Sprintf("Unable to read Warehouse (ID: %s)", previousState.ID.ValueString()),
getError(err, body),
Expand Down