|
|
@@ -2,7 +2,6 @@ package project_integration
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
- "log"
|
|
|
"net/http"
|
|
|
|
|
|
"github.com/bufbuild/connect-go"
|
|
|
@@ -33,17 +32,11 @@ func (p *CreatePreflightCheckAWSUsageHandler) ServeHTTP(w http.ResponseWriter, r
|
|
|
project, _ := r.Context().Value(types.ProjectScope).(*models.Project)
|
|
|
ctx := r.Context()
|
|
|
|
|
|
- log.Println("got here")
|
|
|
-
|
|
|
request := &types.QuotaPreflightCheckRequest{}
|
|
|
if ok := p.DecodeAndValidate(w, r, request); !ok {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- log.Println("project id: ", project.ID)
|
|
|
- log.Println("target arn: ", request.TargetARN)
|
|
|
- log.Println("region: ", request.Region)
|
|
|
-
|
|
|
checkReq := porterv1.QuotaPreflightCheckRequest{
|
|
|
ProjectId: int64(project.ID),
|
|
|
TargetArn: request.TargetARN,
|
|
|
@@ -51,7 +44,6 @@ func (p *CreatePreflightCheckAWSUsageHandler) ServeHTTP(w http.ResponseWriter, r
|
|
|
}
|
|
|
|
|
|
checkResp, err := p.Config().ClusterControlPlaneClient.QuotaPreflightCheck(ctx, connect.NewRequest(&checkReq))
|
|
|
-
|
|
|
if err != nil {
|
|
|
e := fmt.Errorf("Pre-provision check failed: %w", err)
|
|
|
p.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(e, http.StatusPreconditionFailed, err.Error()))
|