Skip to content

Commit

Permalink
refactor update datastore endpoint (#4496)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feroze Mohideen authored Apr 3, 2024
1 parent 689ce63 commit 3e03919
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
14 changes: 5 additions & 9 deletions api/server/handlers/datastore/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,13 @@ func (h *UpdateDatastoreHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques
return
}

req := connect.NewRequest(&porterv1.PatchCloudContractRequest{
ProjectId: int64(project.ID),
Operation: porterv1.EnumPatchCloudContractOperation_ENUM_PATCH_CLOUD_CONTRACT_OPERATION_UPDATE,
ResourceType: porterv1.EnumPatchCloudContractType_ENUM_PATCH_CLOUD_CONTRACT_TYPE_DATASTORE,
ResourceValues: &porterv1.PatchCloudContractRequest_Datastore{
Datastore: datastoreProto,
},
req := connect.NewRequest(&porterv1.UpdateDatastoreRequest{
ProjectId: int64(project.ID),
Datastore: datastoreProto,
})
_, err = h.Config().ClusterControlPlaneClient.PatchCloudContract(ctx, req)
_, err = h.Config().ClusterControlPlaneClient.UpdateDatastore(ctx, req)
if err != nil {
err = telemetry.Error(ctx, span, err, "error patching cloud contract")
err = telemetry.Error(ctx, span, err, "error updating datastore")
h.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusInternalServerError))
return
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ require (
github.com/matryer/is v1.4.0
github.com/nats-io/nats.go v1.24.0
github.com/open-policy-agent/opa v0.44.0
github.com/porter-dev/api-contracts v0.2.139
github.com/porter-dev/api-contracts v0.2.140
github.com/riandyrn/otelchi v0.5.1
github.com/santhosh-tekuri/jsonschema/v5 v5.0.1
github.com/stefanmcshane/helm v0.0.0-20221213002717-88a4a2c6e77d
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1552,8 +1552,8 @@ github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw=
github.com/porter-dev/api-contracts v0.2.139 h1:nTL/tRqXus1O5C524Oo+/cZ62jEVIUI75odYkIvswHY=
github.com/porter-dev/api-contracts v0.2.139/go.mod h1:VV5BzXd02ZdbWIPLVP+PX3GKawJSGQnxorVT2sUZALU=
github.com/porter-dev/api-contracts v0.2.140 h1:AkAEAhcg7VsrkMxCInRtlYQbik/p+KvOUEri3IZLtek=
github.com/porter-dev/api-contracts v0.2.140/go.mod h1:VV5BzXd02ZdbWIPLVP+PX3GKawJSGQnxorVT2sUZALU=
github.com/porter-dev/switchboard v0.0.3 h1:dBuYkiVLa5Ce7059d6qTe9a1C2XEORFEanhbtV92R+M=
github.com/porter-dev/switchboard v0.0.3/go.mod h1:xSPzqSFMQ6OSbp42fhCi4AbGbQbsm6nRvOkrblFeXU4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
Expand Down

0 comments on commit 3e03919

Please sign in to comment.