Skip to content

Commit

Permalink
verifying EnvironmentID
Browse files Browse the repository at this point in the history
Signed-off-by: Dhanush0369 <[email protected]>
  • Loading branch information
Dhanush0369 committed Mar 4, 2024
1 parent f5f7ac8 commit ba3d31a
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 ba3d31a

Please sign in to comment.