Skip to content

Commit

Permalink
verifying EnvironmentID (#4484)
Browse files Browse the repository at this point in the history
Signed-off-by: Dhanush0369 <[email protected]>
Co-authored-by: Sarthak Jain <[email protected]>
Co-authored-by: Saranya Jena <[email protected]>
  • Loading branch information
3 people committed Apr 5, 2024
1 parent cc74f22 commit c1467b7
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func (in *infraService) RegisterInfra(c context.Context, projectID string, input
return nil, errors.New("infra already exists in this project with the same name")
}

// Check if EnvironmentID is valid
if _, err := in.envOperator.GetEnvironmentDetails(c, input.EnvironmentID, projectID); err != nil {
return nil, errors.New("Invalid EnvironmentID")
}

if (*input.InfraNsExists && input.InfraNamespace == nil) || (*input.InfraNsExists && *input.InfraNamespace == "") {
return nil, errors.New("InfraNamespace parameter is required if InfraNsExists is true")
}
Expand Down

0 comments on commit c1467b7

Please sign in to comment.