2
0

infra.go 724 B

1234567891011121314151617181920212223
  1. package forms
  2. import (
  3. "github.com/porter-dev/porter/internal/models"
  4. )
  5. // CreateECRInfra represents the accepted values for creating an
  6. // ECR infra via the provisioning container
  7. type CreateECRInfra struct {
  8. ECRName string `json:"ecr_name" form:"required"`
  9. ProjectID uint `json:"project_id" form:"required"`
  10. AWSIntegrationID uint `json:"aws_integration_id" form:"required"`
  11. }
  12. // ToAWSInfra converts the form to a gorm aws infra model
  13. func (ce *CreateECRInfra) ToAWSInfra() (*models.AWSInfra, error) {
  14. return &models.AWSInfra{
  15. Kind: models.AWSInfraECR,
  16. ProjectID: ce.ProjectID,
  17. Status: models.StatusCreating,
  18. AWSIntegrationID: ce.AWSIntegrationID,
  19. }, nil
  20. }