Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: first commit for go poc
=8e03f884986f
diff --git a/Makefile b/Makefileindex a5a87dfbc7..f2b41b0287 100644--- a/Makefile+++ b/Makefile@@ -33,3 +33,9 @@ reviewable: reviewable-ui reviewable-apiup-dev-sso:docker compose -f docker-compose.dev.yml --profile sso up --build+++# Golang commands+go-generate:+ cd backend-go && \+ go tool goa gen github.com/infisical/api/internal/server/design -o internal/server/gen\ No newline at end of filediff --git a/backend-go/.gitignore b/backend-go/.gitignorenew file mode 100644index 0000000000..2fd271629c--- /dev/null+++ b/backend-go/.gitignore@@ -0,0 +1,14 @@+# Binary output+infisical+*.exe++# Environment+.env+.env.*++# IDE+.idea/+.vscode/++# OS+.DS_Storediff --git a/backend-go/cmd/infisical/main.go b/backend-go/cmd/infisical/main.gonew file mode 100644index 0000000000..35abe03229--- /dev/null+++ b/backend-go/cmd/infisical/main.go@@ -0,0 +1,61 @@+package main++import (+ "context"+ "fmt"+ "log/slog"+ "os"+ "os/signal"+ "sync"+ "syscall"++ "github.com/infisical/api/internal/config"+ "github.com/infisical/api/internal/server"+ "github.com/infisical/api/internal/services"+)++func main() {+ // Load configuration.+ cfg, err := config.LoadConfig()+ if err != nil {+ slog.Error("failed to load config", "error", err)+ os.Exit(1)+ }++ // Setup structured JSON logger.+ logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{+ Level: cfg.SlogLevel(),+ }))+ slog.SetDefault(logger)++ // Initialize all services.+ svc := services.NewService(logger)++ // Create server.+ srv := server.NewServer(svc, logger)++ // Create error channel for signal handling and server errors.+ errc := make(chan error)++ // Setup interrupt handler.+ go func() {+ c := make(chan os.Signal, 1)+ signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)+ errc <- fmt.Errorf("%s", <-c)+ }()++ var wg sync.WaitGroup+ ctx, cancel := context.WithCancel(context.Background())++ // Start HTTP server.+ srv.Listen(ctx, cfg.Addr(), &wg, errc)++ // Wait for signal.+ logger.Info("exiting", "reason", <-errc)++ // Send cancellation signal to server goroutines.+ cancel()+ wg.Wait()++ logger.Info("server stopped")+}diff --git a/backend-go/go.mod b/backend-go/go.modnew file mode 100644index 0000000000..a1b65e409b--- /dev/null+++ b/backend-go/go.mod@@ -0,0 +1,37 @@+module github.com/infisical/api++go 1.26.1++require (+ github.com/knadh/koanf/parsers/dotenv v1.1.1+ github.com/knadh/koanf/providers/env/v2 v2.0.0+ github.com/knadh/koanf/providers/file v1.2.1+ github.com/knadh/koanf/v2 v2.3.3+ goa.design/goa/v3 v3.25.3+)++require (+ github.com/davecgh/go-spew v1.1.1 // indirect+ github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect+ github.com/fsnotify/fsnotify v1.9.0 // indirect+ github.com/go-chi/chi/v5 v5.2.4 // indirect+ github.com/go-viper/mapstructure/v2 v2.4.0 // indirect+ github.com/gohugoio/hashstructure v0.6.0 // indirect+ github.com/google/uuid v1.6.0 // indirect+ github.com/gorilla/websocket v1.5.3 // indirect+ github.com/joho/godotenv v1.5.1 // indirect+ github.com/knadh/koanf/maps v0.1.2 // indirect+ github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect+ github.com/mitchellh/copystructure v1.2.0 // indirect+ github.com/mitchellh/reflectwalk v1.0.2 // indirect+ github.com/pmezard/go-difflib v1.0.0 // indirect+ github.com/stretchr/testify v1.11.1 // indirect+ golang.org/x/mod v0.34.0 // indirect+ golang.org/x/sync v0.20.0 // indirect+ golang.org/x/sys v0.42.0 // indirect+ golang.org/x/text v0.35.0 // indirect+ golang.org/x/tools v0.43.0 // indirect+ gopkg.in/yaml.v3 v3.0.1 // indirect+)++tool goa.design/goa/v3/cmd/goadiff --git a/backend-go/go.sum b/backend-go/go.sumnew file mode 100644index 0000000000..321f1a4530--- /dev/null+++ b/backend-go/go.sum@@ -0,0 +1,65 @@+github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=+github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=+github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI=+github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI=+github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=+github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=+github.com/go-chi/chi/v5 v5.2.4 h1:WtFKPHwlywe8Srng8j2BhOD9312j9cGUxG1SP4V2cR4=+github.com/go-chi/chi/v5 v5.2.4/go.mod h1:X7Gx4mteadT3eDOMTsXzmI4/rwUpOwBHLpAfupzFJP0=+github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=+github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=+github.com/gohugoio/hashstructure v0.6.0 h1:7wMB/2CfXoThFYhdWRGv3u3rUM761Cq29CxUW+NltUg=+github.com/gohugoio/hashstructure v0.6.0/go.mod h1:lapVLk9XidheHG1IQ4ZSbyYrXcaILU1ZEP/+vno5rBQ=+github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=+github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=+github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=+github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=+github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=+github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=+github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=+github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo=+github.com/knadh/koanf/maps v0.1.2/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI=+github.com/knadh/koanf/parsers/dotenv v1.1.1 h1:vfiRFsxq0ouiVs4t+R/VVA3TMrX5+VH14iEX6J5B1s4=+github.com/knadh/koanf/parsers/dotenv v1.1.1/go.mod h1:P3BQjxaIc2+SZ3n9BUceqYl95pz3qaGqYTZX0j0d/DI=+github.com/knadh/koanf/providers/env/v2 v2.0.0 h1:Ad5H3eun722u+FvchiIcEIJZsZ2M6oxCkgZfWN5B5KY=+github.com/knadh/koanf/providers/env/v2 v2.0.0/go.mod h1:1g01PE+Ve1gBfWNNw2wmULRP0tc8RJrjn5p2N/jNCIc=+github.com/knadh/koanf/providers/file v1.2.1 h1:bEWbtQwYrA+W2DtdBrQWyXqJaJSG3KrP3AESOJYp9wM=+github.com/knadh/koanf/providers/file v1.2.1/go.mod h1:bp1PM5f83Q+TOUu10J/0ApLBd9uIzg+n9UgthfY+nRA=+github.com/knadh/koanf/v2 v2.3.3 h1:jLJC8XCRfLC7n4F+ZKKdBsbq1bfXTpuFhf4L7t94D94=+github.com/knadh/koanf/v2 v2.3.3/go.mod h1:gRb40VRAbd4iJMYYD5IxZ6hfuopFcXBpc9bbQpZwo28=+github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=+github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=+github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ=+github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s=+github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4=+github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag=+github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=+github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=+github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=+github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=+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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=+github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=+goa.design/goa/v3 v3.25.3 h1:gnOm2Vu0HMvveKpcqL6aWYQTP2puiwrEJWLQc79/294=+goa.design/goa/v3 v3.25.3/go.mod h1:VZ8CcXJRZh09ijtNJJS2gNyKufpmrM+Ul/Qy3viwcOU=+golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=+golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=+golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=+golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=+golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=+golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=+golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=+golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=+golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s=+golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0=+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=diff --git a/backend-go/internal/config/config.go b/backend-go/internal/config/config.gonew file mode 100644index 0000000000..85ef46c3b3--- /dev/null+++ b/backend-go/internal/config/config.go@@ -0,0 +1,79 @@+package config++import (+ "fmt"+ "log/slog"+ "os"+ "strings"++ "github.com/knadh/koanf/parsers/dotenv"+ envprovider "github.com/knadh/koanf/providers/env/v2"+ "github.com/knadh/koanf/providers/file"+ "github.com/knadh/koanf/v2"+)++type AppEnv string++const (+ Development AppEnv = "development"+ Production AppEnv = "production"+)++type Config struct {+ AppEnv AppEnv `koanf:"app_env"`+ HTTPHost string `koanf:"http_host"`+ HTTPPort int `koanf:"http_port"`+ LogLevel string `koanf:"log_level"`+}++func (c *Config) Addr() string {+ return fmt.Sprintf("%s:%d", c.HTTPHost, c.HTTPPort)+}++func (c *Config) SlogLevel() slog.Level {+ switch strings.ToLower(c.LogLevel) {+ case "debug":+ return slog.LevelDebug+ case "warn":+ return slog.LevelWarn+ case "error":+ return slog.LevelError+ default:+ return slog.LevelInfo+ }+}++func LoadConfig() (*Config, error) {+ // No delimiter — all keys are flat (e.g. "http_port", not nested).+ k := koanf.New("")++ // Set defaults.+ k.Set("app_env", string(Development))+ k.Set("http_host", "0.0.0.0")+ k.Set("http_port", 8080)+ k.Set("log_level", "info")++ // In non-production, load .env file if it exists.+ appEnv := os.Getenv("INFISICAL_APP_ENV")+ if appEnv != string(Production) {+ if err := k.Load(file.Provider(".env"), dotenv.Parser()); err != nil {+ if !os.IsNotExist(err) {+ slog.Debug("could not load .env file", "error", err)+ }+ }+ }++ // Load environment variables with INFISICAL_ prefix.+ // INFISICAL_HTTP_PORT -> http_port+ err := k.Load(envprovider.Provider("", envprovider.Opt{}), nil)+ if err != nil {+ return nil, fmt.Errorf("loading env vars: %w", err)+ }++ var cfg Config+ if err := k.Unmarshal("", &cfg); err != nil {+ return nil, fmt.Errorf("unmarshalling config: %w", err)+ }++ return &cfg, nil+}diff --git a/backend-go/internal/server/design/design.go b/backend-go/internal/server/design/design.gonew file mode 100644index 0000000000..abc3a37be1--- /dev/null+++ b/backend-go/internal/server/design/design.go@@ -0,0 +1,20 @@+package design++import (+ . "goa.design/goa/v3/dsl"++ // Blank-import product line designs to register their DSL.+ _ "github.com/infisical/api/internal/server/design/platform"+ _ "github.com/infisical/api/internal/server/design/secretmanager"+)++var _ = API("infisical", func() {+ Title("Infisical API")+ Description("Infisical secret management platform API")+ Version("0.0.1")+ Server("infisical", func() {+ Host("localhost", func() {+ URI("http://localhost:8080")+ })+ })+})diff --git a/backend-go/internal/server/design/platform/projects.go b/backend-go/internal/server/design/platform/projects.gonew file mode 100644index 0000000000..2d072554db--- /dev/null+++ b/backend-go/internal/server/design/platform/projects.go@@ -0,0 +1,48 @@+package platform++import (+ . "goa.design/goa/v3/dsl"+)++// CreateProjectPayload describes the input for creating a project.+var CreateProjectPayload = Type("CreateProjectPayload", func() {+ Attribute("name", String, "Project name", func() {+ MinLength(1)+ })+ Attribute("orgId", String, "Organization ID")+ Required("name", "orgId")+})++// ProjectResult describes the output of a project operation.+var ProjectResult = ResultType("application/vnd.project", func() {+ TypeName("ProjectResult")+ Attributes(func() {+ Attribute("id", String, "Project ID")+ Attribute("name", String, "Project name")+ Attribute("orgId", String, "Organization ID")+ })+ Required("id", "name", "orgId")+})++var _ = Service("projects", func() {+ Description("Service for managing projects.")++ Method("getHealth", func() {+ Description("Health check for the projects service.")+ Result(String)+ HTTP(func() {+ GET("/api/v1/platform/projects/health")+ Response(StatusOK)+ })+ })++ Method("createProject", func() {+ Description("Create a new project.")+ Payload(CreateProjectPayload)+ Result(ProjectResult)+ HTTP(func() {+ POST("/api/v1/platform/projects")+ Response(StatusCreated)+ })+ })+})diff --git a/backend-go/internal/server/design/secretmanager/secrets.go b/backend-go/internal/server/design/secretmanager/secrets.gonew file mode 100644index 0000000000..2341cc0677--- /dev/null+++ b/backend-go/internal/server/design/secretmanager/secrets.go@@ -0,0 +1,110 @@+package secretmanager++import (+ . "goa.design/goa/v3/dsl"+)++// Secret describes the input for creating a secret.+var Secret = Type("Secret", func() {+ Attribute("key", String, "Secret key", func() {+ Example("DATABASE_URL")+ })+ Attribute("value", String, "Secret value")+ Attribute("environment", String, "Environment slug")+ Attribute("projectId", String, "Project ID")+ Required("key", "value", "environment", "projectId")+})++// SecretResult describes the output of a secret operation.+var SecretResult = ResultType("application/vnd.secret", func() {+ TypeName("SecretResult")+ Attributes(func() {+ Attribute("id", String, "Secret ID")+ Attribute("key", String, "Secret key")+ Attribute("value", String, "Secret value")+ Attribute("environment", String, "Environment slug")+ Attribute("projectId", String, "Project ID")+ })+ Required("id", "key", "value", "environment", "projectId")+})++var _ = Service("secrets", func() {+ Description("Service for managing secrets.")++ Method("getHealth", func() {+ Description("Health check for the secrets service.")+ Result(String)+ HTTP(func() {+ GET("/api/v1/secret-manager/secrets/health")+ Response(StatusOK)+ })+ })++ Method("createSecret", func() {+ Description("Create a new secret.")+ Payload(Secret)+ Result(SecretResult)+ HTTP(func() {+ POST("/api/v1/secret-manager/secrets")+ Response(StatusCreated)+ })+ })++ Method("getSecret", func() {+ Description("Get a secret by ID.")+ Payload(func() {+ Attribute("id", String, "Secret ID")+ Required("id")+ })+ Result(SecretResult)+ HTTP(func() {+ GET("/api/v1/secret-manager/secrets/{id}")+ Response(StatusOK)+ })+ })++ Method("updateSecret", func() {+ Description("Update an existing secret.")+ Payload(func() {+ Attribute("id", String, "Secret ID")+ Attribute("key", String, "Secret key")+ Attribute("value", String, "Secret value")+ Required("id")+ })+ Result(SecretResult)+ HTTP(func() {+ PATCH("/api/v1/secret-manager/secrets/{id}")+ Response(StatusOK)+ })+ })++ Method("deleteSecret", func() {+ Description("Delete a secret by ID.")+ Payload(func() {+ Attribute("id", String, "Secret ID")+ Required("id")+ })+ HTTP(func() {+ DELETE("/api/v1/secret-manager/secrets/{id}")+ Response(StatusNoContent)+ })+ })++ Method("listSecrets", func() {+ Description("List secrets for an environment.")+ Payload(func() {+ Attribute("projectId", String, "Project ID")+ Attribute("environment", String, "Environment slug")+ Required("projectId", "environment")+ })+ Result(CollectionOf(SecretResult))+ HTTP(func() {+ GET("/api/v1/secret-manager/secrets")+ Params(func() {+ Param("projectId")+ Param("environment")+ })+ Response(StatusOK)+ })+ })+})diff --git a/backend-go/internal/server/gen/http/cli/infisical/cli.go b/backend-go/internal/server/gen/http/cli/infisical/cli.gonew file mode 100644index 0000000000..cdce7d1d61--- /dev/null+++ b/backend-go/internal/server/gen/http/cli/infisical/cli.go@@ -0,0 +1,383 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// infisical HTTP client CLI support package+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package cli++import (+ "flag"+ "fmt"+ "net/http"+ "os"++ projectsc "github.com/infisical/api/internal/server/gen/http/projects/client"+ secretsc "github.com/infisical/api/internal/server/gen/http/secrets/client"+ goahttp "goa.design/goa/v3/http"+ goa "goa.design/goa/v3/pkg"+)++// UsageCommands returns the set of commands and sub-commands using the format+//+// command (subcommand1|subcommand2|...)+func UsageCommands() []string {+ return []string{+ "projects (get-health|create-project)",+ "secrets (get-health|create-secret|get-secret|update-secret|delete-secret|list-secrets)",+ }+}++// UsageExamples produces an example of a valid invocation of the CLI tool.+func UsageExamples() string {+ return os.Args[0] + " " + "projects get-health" + "\n" ++ os.Args[0] + " " + "secrets get-health" + "\n" ++ ""+}++// ParseEndpoint returns the endpoint and payload as specified on the command+// line.+func ParseEndpoint(+ scheme, host string,+ doer goahttp.Doer,+ enc func(*http.Request) goahttp.Encoder,+ dec func(*http.Response) goahttp.Decoder,+ restore bool,+) (goa.Endpoint, any, error) {+ var (+ projectsFlags = flag.NewFlagSet("projects", flag.ContinueOnError)++ projectsGetHealthFlags = flag.NewFlagSet("get-health", flag.ExitOnError)++ projectsCreateProjectFlags = flag.NewFlagSet("create-project", flag.ExitOnError)+ projectsCreateProjectBodyFlag = projectsCreateProjectFlags.String("body", "REQUIRED", "")++ secretsFlags = flag.NewFlagSet("secrets", flag.ContinueOnError)++ secretsGetHealthFlags = flag.NewFlagSet("get-health", flag.ExitOnError)++ secretsCreateSecretFlags = flag.NewFlagSet("create-secret", flag.ExitOnError)+ secretsCreateSecretBodyFlag = secretsCreateSecretFlags.String("body", "REQUIRED", "")++ secretsGetSecretFlags = flag.NewFlagSet("get-secret", flag.ExitOnError)+ secretsGetSecretIDFlag = secretsGetSecretFlags.String("id", "REQUIRED", "Secret ID")++ secretsUpdateSecretFlags = flag.NewFlagSet("update-secret", flag.ExitOnError)+ secretsUpdateSecretBodyFlag = secretsUpdateSecretFlags.String("body", "REQUIRED", "")+ secretsUpdateSecretIDFlag = secretsUpdateSecretFlags.String("id", "REQUIRED", "Secret ID")++ secretsDeleteSecretFlags = flag.NewFlagSet("delete-secret", flag.ExitOnError)+ secretsDeleteSecretIDFlag = secretsDeleteSecretFlags.String("id", "REQUIRED", "Secret ID")++ secretsListSecretsFlags = flag.NewFlagSet("list-secrets", flag.ExitOnError)+ secretsListSecretsProjectIDFlag = secretsListSecretsFlags.String("project-id", "REQUIRED", "")+ secretsListSecretsEnvironmentFlag = secretsListSecretsFlags.String("environment", "REQUIRED", "")+ )+ projectsFlags.Usage = projectsUsage+ projectsGetHealthFlags.Usage = projectsGetHealthUsage+ projectsCreateProjectFlags.Usage = projectsCreateProjectUsage++ secretsFlags.Usage = secretsUsage+ secretsGetHealthFlags.Usage = secretsGetHealthUsage+ secretsCreateSecretFlags.Usage = secretsCreateSecretUsage+ secretsGetSecretFlags.Usage = secretsGetSecretUsage+ secretsUpdateSecretFlags.Usage = secretsUpdateSecretUsage+ secretsDeleteSecretFlags.Usage = secretsDeleteSecretUsage+ secretsListSecretsFlags.Usage = secretsListSecretsUsage++ if err := flag.CommandLine.Parse(os.Args[1:]); err != nil {+ return nil, nil, err+ }++ if flag.NArg() < 2 { // two non flag args are required: SERVICE and ENDPOINT (aka COMMAND)+ return nil, nil, fmt.Errorf("not enough arguments")+ }++ var (+ svcn string+ svcf *flag.FlagSet+ )+ {+ svcn = flag.Arg(0)+ switch svcn {+ case "projects":+ svcf = projectsFlags+ case "secrets":+ svcf = secretsFlags+ default:+ return nil, nil, fmt.Errorf("unknown service %q", svcn)+ }+ }+ if err := svcf.Parse(flag.Args()[1:]); err != nil {+ return nil, nil, err+ }++ var (+ epn string+ epf *flag.FlagSet+ )+ {+ epn = svcf.Arg(0)+ switch svcn {+ case "projects":+ switch epn {+ case "get-health":+ epf = projectsGetHealthFlags++ case "create-project":+ epf = projectsCreateProjectFlags++ }++ case "secrets":+ switch epn {+ case "get-health":+ epf = secretsGetHealthFlags++ case "create-secret":+ epf = secretsCreateSecretFlags++ case "get-secret":+ epf = secretsGetSecretFlags++ case "update-secret":+ epf = secretsUpdateSecretFlags++ case "delete-secret":+ epf = secretsDeleteSecretFlags++ case "list-secrets":+ epf = secretsListSecretsFlags++ }++ }+ }+ if epf == nil {+ return nil, nil, fmt.Errorf("unknown %q endpoint %q", svcn, epn)+ }++ // Parse endpoint flags if any+ if svcf.NArg() > 1 {+ if err := epf.Parse(svcf.Args()[1:]); err != nil {+ return nil, nil, err+ }+ }++ var (+ data any+ endpoint goa.Endpoint+ err error+ )+ {+ switch svcn {+ case "projects":+ c := projectsc.NewClient(scheme, host, doer, enc, dec, restore)+ switch epn {+ case "get-health":+ endpoint = c.GetHealth()+ case "create-project":+ endpoint = c.CreateProject()+ data, err = projectsc.BuildCreateProjectPayload(*projectsCreateProjectBodyFlag)+ }+ case "secrets":+ c := secretsc.NewClient(scheme, host, doer, enc, dec, restore)+ switch epn {+ case "get-health":+ endpoint = c.GetHealth()+ case "create-secret":+ endpoint = c.CreateSecret()+ data, err = secretsc.BuildCreateSecretPayload(*secretsCreateSecretBodyFlag)+ case "get-secret":+ endpoint = c.GetSecret()+ data, err = secretsc.BuildGetSecretPayload(*secretsGetSecretIDFlag)+ case "update-secret":+ endpoint = c.UpdateSecret()+ data, err = secretsc.BuildUpdateSecretPayload(*secretsUpdateSecretBodyFlag, *secretsUpdateSecretIDFlag)+ case "delete-secret":+ endpoint = c.DeleteSecret()+ data, err = secretsc.BuildDeleteSecretPayload(*secretsDeleteSecretIDFlag)+ case "list-secrets":+ endpoint = c.ListSecrets()+ data, err = secretsc.BuildListSecretsPayload(*secretsListSecretsProjectIDFlag, *secretsListSecretsEnvironmentFlag)+ }+ }+ }+ if err != nil {+ return nil, nil, err+ }++ return endpoint, data, nil+}++// projectsUsage displays the usage of the projects command and its subcommands.+func projectsUsage() {+ fmt.Fprintln(os.Stderr, `Service for managing projects.`)+ fmt.Fprintf(os.Stderr, "Usage:\n %s [globalflags] projects COMMAND [flags]\n\n", os.Args[0])+ fmt.Fprintln(os.Stderr, "COMMAND:")+ fmt.Fprintln(os.Stderr, ` get-health: Health check for the projects service.`)+ fmt.Fprintln(os.Stderr, ` create-project: Create a new project.`)+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Additional help:")+ fmt.Fprintf(os.Stderr, " %s projects COMMAND --help\n", os.Args[0])+}+func projectsGetHealthUsage() {+ // Header with flags+ fmt.Fprintf(os.Stderr, "%s [flags] projects get-health", os.Args[0])+ fmt.Fprintln(os.Stderr)++ // Description+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, `Health check for the projects service.`)++ // Flags list++ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Example:")+ fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "projects get-health")+}++func projectsCreateProjectUsage() {+ // Header with flags+ fmt.Fprintf(os.Stderr, "%s [flags] projects create-project", os.Args[0])+ fmt.Fprint(os.Stderr, " -body JSON")+ fmt.Fprintln(os.Stderr)++ // Description+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, `Create a new project.`)++ // Flags list+ fmt.Fprintln(os.Stderr, ` -body JSON: `)++ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Example:")+ fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "projects create-project --body '{\n \"name\": \"hay\",\n \"orgId\": \"Id eveniet atque sed.\"\n }'")+}++// secretsUsage displays the usage of the secrets command and its subcommands.+func secretsUsage() {+ fmt.Fprintln(os.Stderr, `Service for managing secrets.`)+ fmt.Fprintf(os.Stderr, "Usage:\n %s [globalflags] secrets COMMAND [flags]\n\n", os.Args[0])+ fmt.Fprintln(os.Stderr, "COMMAND:")+ fmt.Fprintln(os.Stderr, ` get-health: Health check for the secrets service.`)+ fmt.Fprintln(os.Stderr, ` create-secret: Create a new secret.`)+ fmt.Fprintln(os.Stderr, ` get-secret: Get a secret by ID.`)+ fmt.Fprintln(os.Stderr, ` update-secret: Update an existing secret.`)+ fmt.Fprintln(os.Stderr, ` delete-secret: Delete a secret by ID.`)+ fmt.Fprintln(os.Stderr, ` list-secrets: List secrets for an environment.`)+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Additional help:")+ fmt.Fprintf(os.Stderr, " %s secrets COMMAND --help\n", os.Args[0])+}+func secretsGetHealthUsage() {+ // Header with flags+ fmt.Fprintf(os.Stderr, "%s [flags] secrets get-health", os.Args[0])+ fmt.Fprintln(os.Stderr)++ // Description+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, `Health check for the secrets service.`)++ // Flags list++ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Example:")+ fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "secrets get-health")+}++func secretsCreateSecretUsage() {+ // Header with flags+ fmt.Fprintf(os.Stderr, "%s [flags] secrets create-secret", os.Args[0])+ fmt.Fprint(os.Stderr, " -body JSON")+ fmt.Fprintln(os.Stderr)++ // Description+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, `Create a new secret.`)++ // Flags list+ fmt.Fprintln(os.Stderr, ` -body JSON: `)++ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Example:")+ fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "secrets create-secret --body '{\n \"environment\": \"Qui eum quos eum pariatur.\",\n \"key\": \"DATABASE_URL\",\n \"projectId\": \"Deleniti itaque voluptatum.\",\n \"value\": \"Reiciendis minima.\"\n }'")+}++func secretsGetSecretUsage() {+ // Header with flags+ fmt.Fprintf(os.Stderr, "%s [flags] secrets get-secret", os.Args[0])+ fmt.Fprint(os.Stderr, " -id STRING")+ fmt.Fprintln(os.Stderr)++ // Description+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, `Get a secret by ID.`)++ // Flags list+ fmt.Fprintln(os.Stderr, ` -id STRING: Secret ID`)++ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Example:")+ fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "secrets get-secret --id \"Expedita molestias consequatur magnam dolores eius.\"")+}++func secretsUpdateSecretUsage() {+ // Header with flags+ fmt.Fprintf(os.Stderr, "%s [flags] secrets update-secret", os.Args[0])+ fmt.Fprint(os.Stderr, " -body JSON")+ fmt.Fprint(os.Stderr, " -id STRING")+ fmt.Fprintln(os.Stderr)++ // Description+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, `Update an existing secret.`)++ // Flags list+ fmt.Fprintln(os.Stderr, ` -body JSON: `)+ fmt.Fprintln(os.Stderr, ` -id STRING: Secret ID`)++ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Example:")+ fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "secrets update-secret --body '{\n \"key\": \"Omnis autem quo ducimus facilis veritatis.\",\n \"value\": \"Eligendi quasi iusto.\"\n }' --id \"Consectetur ducimus est iste ut provident.\"")+}++func secretsDeleteSecretUsage() {+ // Header with flags+ fmt.Fprintf(os.Stderr, "%s [flags] secrets delete-secret", os.Args[0])+ fmt.Fprint(os.Stderr, " -id STRING")+ fmt.Fprintln(os.Stderr)++ // Description+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, `Delete a secret by ID.`)++ // Flags list+ fmt.Fprintln(os.Stderr, ` -id STRING: Secret ID`)++ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Example:")+ fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "secrets delete-secret --id \"Eos sed reprehenderit atque.\"")+}++func secretsListSecretsUsage() {+ // Header with flags+ fmt.Fprintf(os.Stderr, "%s [flags] secrets list-secrets", os.Args[0])+ fmt.Fprint(os.Stderr, " -project-id STRING")+ fmt.Fprint(os.Stderr, " -environment STRING")+ fmt.Fprintln(os.Stderr)++ // Description+ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, `List secrets for an environment.`)++ // Flags list+ fmt.Fprintln(os.Stderr, ` -project-id STRING: `)+ fmt.Fprintln(os.Stderr, ` -environment STRING: `)++ fmt.Fprintln(os.Stderr)+ fmt.Fprintln(os.Stderr, "Example:")+ fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "secrets list-secrets --project-id \"Dolorum ut ipsum.\" --environment \"Explicabo voluptas necessitatibus enim hic nam.\"")+}diff --git a/backend-go/internal/server/gen/http/openapi.json b/backend-go/internal/server/gen/http/openapi.jsonnew file mode 100644index 0000000000..b16557ed25--- /dev/null+++ b/backend-go/internal/server/gen/http/openapi.json@@ -0,0 +1 @@+{"swagger":"2.0","info":{"title":"Infisical API","description":"Infisical secret management platform API","version":"0.0.1"},"host":"localhost:8080","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/api/v1/platform/projects":{"post":{"tags":["projects"],"summary":"createProject projects","description":"Create a new project.","operationId":"projects#createProject","parameters":[{"name":"CreateProjectRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/CreateProjectPayload","required":["name","orgId"]}}],"responses":{"201":{"description":"Created response.","schema":{"$ref":"#/definitions/Project"}}},"schemes":["http"]}},"/api/v1/platform/projects/health":{"get":{"tags":["projects"],"summary":"getHealth projects","description":"Health check for the projects service.","operationId":"projects#getHealth","responses":{"200":{"description":"OK response.","schema":{"type":"string"}}},"schemes":["http"]}},"/api/v1/secret-manager/secrets":{"get":{"tags":["secrets"],"summary":"listSecrets secrets","description":"List secrets for an environment.","operationId":"secrets#listSecrets","parameters":[{"name":"projectId","in":"query","description":"Project ID","required":true,"type":"string"},{"name":"environment","in":"query","description":"Environment slug","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/SecretsSecretResultResponseCollection"}}},"schemes":["http"]},"post":{"tags":["secrets"],"summary":"createSecret secrets","description":"Create a new secret.","operationId":"secrets#createSecret","parameters":[{"name":"CreateSecretRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/Secret","required":["key","value","environment","projectId"]}}],"responses":{"201":{"description":"Created response.","schema":{"$ref":"#/definitions/Secret"}}},"schemes":["http"]}},"/api/v1/secret-manager/secrets/health":{"get":{"tags":["secrets"],"summary":"getHealth secrets","description":"Health check for the secrets service.","operationId":"secrets#getHealth","responses":{"200":{"description":"OK response.","schema":{"type":"string"}}},"schemes":["http"]}},"/api/v1/secret-manager/secrets/{id}":{"get":{"tags":["secrets"],"summary":"getSecret secrets","description":"Get a secret by ID.","operationId":"secrets#getSecret","parameters":[{"name":"id","in":"path","description":"Secret ID","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/Secret"}}},"schemes":["http"]},"delete":{"tags":["secrets"],"summary":"deleteSecret secrets","description":"Delete a secret by ID.","operationId":"secrets#deleteSecret","parameters":[{"name":"id","in":"path","description":"Secret ID","required":true,"type":"string"}],"responses":{"204":{"description":"No Content response."}},"schemes":["http"]},"patch":{"tags":["secrets"],"summary":"updateSecret secrets","description":"Update an existing secret.","operationId":"secrets#updateSecret","parameters":[{"name":"id","in":"path","description":"Secret ID","required":true,"type":"string"},{"name":"UpdateSecretRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/SecretsUpdateSecretRequestBody"}}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/Secret"}}},"schemes":["http"]}}},"definitions":{"CreateProjectPayload":{"title":"CreateProjectPayload","type":"object","properties":{"name":{"type":"string","description":"Project name","example":"djc","minLength":1},"orgId":{"type":"string","description":"Organization ID","example":"Sequi nobis aut."}},"example":{"name":"2y8","orgId":"Soluta assumenda eos et voluptatem porro quod."},"required":["name","orgId"]},"Project":{"title":"Mediatype identifier: application/vnd.project; view=default","type":"object","properties":{"id":{"type":"string","description":"Project ID","example":"Quis repellendus eos sed cum."},"name":{"type":"string","description":"Project name","example":"Quibusdam iure officia amet."},"orgId":{"type":"string","description":"Organization ID","example":"Voluptatem consequatur dolorem itaque suscipit sint ratione."}},"description":"CreateProjectResponseBody result type (default view)","example":{"id":"Non enim suscipit consequatur.","name":"Illum architecto aliquid.","orgId":"Debitis vitae."},"required":["id","name","orgId"]},"Secret":{"title":"Mediatype identifier: application/vnd.secret; view=default","type":"object","properties":{"environment":{"type":"string","description":"Environment slug","example":"Eum adipisci sunt quis praesentium alias."},"id":{"type":"string","description":"Secret ID","example":"Praesentium et sapiente totam unde officiis necessitatibus."},"key":{"type":"string","description":"Secret key","example":"Sit aut."},"projectId":{"type":"string","description":"Project ID","example":"Odit et vel voluptas aut."},"value":{"type":"string","description":"Secret value","example":"Et rerum eaque rem facilis sit."}},"description":"CreateSecretResponseBody result type (default view)","example":{"environment":"Facilis beatae soluta omnis.","id":"Perspiciatis excepturi error rerum adipisci quos.","key":"Dolorem optio blanditiis autem cum totam sint.","projectId":"Sed blanditiis.","value":"Accusantium sit dolorum dolor."},"required":["id","key","value","environment","projectId"]},"SecretResultResponse":{"title":"Mediatype identifier: application/vnd.secret; view=default","type":"object","properties":{"environment":{"type":"string","description":"Environment slug","example":"Aut optio consectetur temporibus."},"id":{"type":"string","description":"Secret ID","example":"Maxime est quo iure."},"key":{"type":"string","description":"Secret key","example":"Nisi iusto voluptas non aliquam ipsam consequatur."},"projectId":{"type":"string","description":"Project ID","example":"Dolor fugiat maxime nisi quas expedita."},"value":{"type":"string","description":"Secret value","example":"Suscipit enim."}},"description":"SecretResultResponse result type (default view)","example":{"environment":"Nulla et.","id":"Ducimus qui.","key":"Ut aut.","projectId":"Sint neque placeat suscipit delectus ea eligendi.","value":"Qui quasi ducimus vel."},"required":["id","key","value","environment","projectId"]},"SecretsSecretResultResponseCollection":{"title":"Mediatype identifier: application/vnd.secret; type=collection; view=default","type":"array","items":{"$ref":"#/definitions/SecretResultResponse"},"description":"ListSecretsResponseBody is the result type for an array of SecretResultResponse (default view)","example":[{"environment":"Non quaerat laudantium.","id":"Dolorem libero deleniti molestiae nisi in sunt.","key":"Voluptas quo et ratione.","projectId":"Ea voluptatem ut eius dolorum eius qui.","value":"Qui consequuntur ut sed harum dolore ratione."},{"environment":"Non quaerat laudantium.","id":"Dolorem libero deleniti molestiae nisi in sunt.","key":"Voluptas quo et ratione.","projectId":"Ea voluptatem ut eius dolorum eius qui.","value":"Qui consequuntur ut sed harum dolore ratione."},{"environment":"Non quaerat laudantium.","id":"Dolorem libero deleniti molestiae nisi in sunt.","key":"Voluptas quo et ratione.","projectId":"Ea voluptatem ut eius dolorum eius qui.","value":"Qui consequuntur ut sed harum dolore ratione."}]},"SecretsUpdateSecretRequestBody":{"title":"SecretsUpdateSecretRequestBody","type":"object","properties":{"key":{"type":"string","description":"Secret key","example":"Dolor modi omnis et non ipsam."},"value":{"type":"string","description":"Secret value","example":"Consequatur est sequi id quidem necessitatibus velit."}},"example":{"key":"Ut repellat et nihil alias veritatis maiores.","value":"Aliquam impedit sint animi at quia voluptas."}}}}\ No newline at end of filediff --git a/backend-go/internal/server/gen/http/openapi.yaml b/backend-go/internal/server/gen/http/openapi.yamlnew file mode 100644index 0000000000..364c1671ba--- /dev/null+++ b/backend-go/internal/server/gen/http/openapi.yaml@@ -0,0 +1,332 @@+swagger: "2.0"+info:+ title: Infisical API+ description: Infisical secret management platform API+ version: 0.0.1+host: localhost:8080+consumes:+ - application/json+ - application/xml+ - application/gob+produces:+ - application/json+ - application/xml+ - application/gob+paths:+ /api/v1/platform/projects:+ post:+ tags:+ - projects+ summary: createProject projects+ description: Create a new project.+ operationId: projects#createProject+ parameters:+ - name: CreateProjectRequestBody+ in: body+ required: true+ schema:+ $ref: '#/definitions/CreateProjectPayload'+ required:+ - name+ - orgId+ responses:+ "201":+ description: Created response.+ schema:+ $ref: '#/definitions/Project'+ schemes:+ - http+ /api/v1/platform/projects/health:+ get:+ tags:+ - projects+ summary: getHealth projects+ description: Health check for the projects service.+ operationId: projects#getHealth+ responses:+ "200":+ description: OK response.+ schema:+ type: string+ schemes:+ - http+ /api/v1/secret-manager/secrets:+ get:+ tags:+ - secrets+ summary: listSecrets secrets+ description: List secrets for an environment.+ operationId: secrets#listSecrets+ parameters:+ - name: projectId+ in: query+ description: Project ID+ required: true+ type: string+ - name: environment+ in: query+ description: Environment slug+ required: true+ type: string+ responses:+ "200":+ description: OK response.+ schema:+ $ref: '#/definitions/SecretsSecretResultResponseCollection'+ schemes:+ - http+ post:+ tags:+ - secrets+ summary: createSecret secrets+ description: Create a new secret.+ operationId: secrets#createSecret+ parameters:+ - name: CreateSecretRequestBody+ in: body+ required: true+ schema:+ $ref: '#/definitions/Secret'+ required:+ - key+ - value+ - environment+ - projectId+ responses:+ "201":+ description: Created response.+ schema:+ $ref: '#/definitions/Secret'+ schemes:+ - http+ /api/v1/secret-manager/secrets/{id}:+ get:+ tags:+ - secrets+ summary: getSecret secrets+ description: Get a secret by ID.+ operationId: secrets#getSecret+ parameters:+ - name: id+ in: path+ description: Secret ID+ required: true+ type: string+ responses:+ "200":+ description: OK response.+ schema:+ $ref: '#/definitions/Secret'+ schemes:+ - http+ delete:+ tags:+ - secrets+ summary: deleteSecret secrets+ description: Delete a secret by ID.+ operationId: secrets#deleteSecret+ parameters:+ - name: id+ in: path+ description: Secret ID+ required: true+ type: string+ responses:+ "204":+ description: No Content response.+ schemes:+ - http+ patch:+ tags:+ - secrets+ summary: updateSecret secrets+ description: Update an existing secret.+ operationId: secrets#updateSecret+ parameters:+ - name: id+ in: path+ description: Secret ID+ required: true+ type: string+ - name: UpdateSecretRequestBody+ in: body+ required: true+ schema:+ $ref: '#/definitions/SecretsUpdateSecretRequestBody'+ responses:+ "200":+ description: OK response.+ schema:+ $ref: '#/definitions/Secret'+ schemes:+ - http+ /api/v1/secret-manager/secrets/health:+ get:+ tags:+ - secrets+ summary: getHealth secrets+ description: Health check for the secrets service.+ operationId: secrets#getHealth+ responses:+ "200":+ description: OK response.+ schema:+ type: string+ schemes:+ - http+definitions:+ CreateProjectPayload:+ title: CreateProjectPayload+ type: object+ properties:+ name:+ type: string+ description: Project name+ example: djc+ minLength: 1+ orgId:+ type: string+ description: Organization ID+ example: Sequi nobis aut.+ example:+ name: 2y8+ orgId: Soluta assumenda eos et voluptatem porro quod.+ required:+ - name+ - orgId+ Project:+ title: 'Mediatype identifier: application/vnd.project; view=default'+ type: object+ properties:+ id:+ type: string+ description: Project ID+ example: Quis repellendus eos sed cum.+ name:+ type: string+ description: Project name+ example: Quibusdam iure officia amet.+ orgId:+ type: string+ description: Organization ID+ example: Voluptatem consequatur dolorem itaque suscipit sint ratione.+ description: CreateProjectResponseBody result type (default view)+ example:+ id: Non enim suscipit consequatur.+ name: Illum architecto aliquid.+ orgId: Debitis vitae.+ required:+ - id+ - name+ - orgId+ Secret:+ title: 'Mediatype identifier: application/vnd.secret; view=default'+ type: object+ properties:+ environment:+ type: string+ description: Environment slug+ example: Eum adipisci sunt quis praesentium alias.+ id:+ type: string+ description: Secret ID+ example: Praesentium et sapiente totam unde officiis necessitatibus.+ key:+ type: string+ description: Secret key+ example: Sit aut.+ projectId:+ type: string+ description: Project ID+ example: Odit et vel voluptas aut.+ value:+ type: string+ description: Secret value+ example: Et rerum eaque rem facilis sit.+ description: CreateSecretResponseBody result type (default view)+ example:+ environment: Facilis beatae soluta omnis.+ id: Perspiciatis excepturi error rerum adipisci quos.+ key: Dolorem optio blanditiis autem cum totam sint.+ projectId: Sed blanditiis.+ value: Accusantium sit dolorum dolor.+ required:+ - id+ - key+ - value+ - environment+ - projectId+ SecretResultResponse:+ title: 'Mediatype identifier: application/vnd.secret; view=default'+ type: object+ properties:+ environment:+ type: string+ description: Environment slug+ example: Aut optio consectetur temporibus.+ id:+ type: string+ description: Secret ID+ example: Maxime est quo iure.+ key:+ type: string+ description: Secret key+ example: Nisi iusto voluptas non aliquam ipsam consequatur.+ projectId:+ type: string+ description: Project ID+ example: Dolor fugiat maxime nisi quas expedita.+ value:+ type: string+ description: Secret value+ example: Suscipit enim.+ description: SecretResultResponse result type (default view)+ example:+ environment: Nulla et.+ id: Ducimus qui.+ key: Ut aut.+ projectId: Sint neque placeat suscipit delectus ea eligendi.+ value: Qui quasi ducimus vel.+ required:+ - id+ - key+ - value+ - environment+ - projectId+ SecretsSecretResultResponseCollection:+ title: 'Mediatype identifier: application/vnd.secret; type=collection; view=default'+ type: array+ items:+ $ref: '#/definitions/SecretResultResponse'+ description: ListSecretsResponseBody is the result type for an array of SecretResultResponse (default view)+ example:+ - environment: Non quaerat laudantium.+ id: Dolorem libero deleniti molestiae nisi in sunt.+ key: Voluptas quo et ratione.+ projectId: Ea voluptatem ut eius dolorum eius qui.+ value: Qui consequuntur ut sed harum dolore ratione.+ - environment: Non quaerat laudantium.+ id: Dolorem libero deleniti molestiae nisi in sunt.+ key: Voluptas quo et ratione.+ projectId: Ea voluptatem ut eius dolorum eius qui.+ value: Qui consequuntur ut sed harum dolore ratione.+ - environment: Non quaerat laudantium.+ id: Dolorem libero deleniti molestiae nisi in sunt.+ key: Voluptas quo et ratione.+ projectId: Ea voluptatem ut eius dolorum eius qui.+ value: Qui consequuntur ut sed harum dolore ratione.+ SecretsUpdateSecretRequestBody:+ title: SecretsUpdateSecretRequestBody+ type: object+ properties:+ key:+ type: string+ description: Secret key+ example: Dolor modi omnis et non ipsam.+ value:+ type: string+ description: Secret value+ example: Consequatur est sequi id quidem necessitatibus velit.+ example:+ key: Ut repellat et nihil alias veritatis maiores.+ value: Aliquam impedit sint animi at quia voluptas.diff --git a/backend-go/internal/server/gen/http/openapi3.json b/backend-go/internal/server/gen/http/openapi3.jsonnew file mode 100644index 0000000000..5ddecb45da--- /dev/null+++ b/backend-go/internal/server/gen/http/openapi3.json@@ -0,0 +1 @@+{"openapi":"3.0.3","info":{"title":"Infisical API","description":"Infisical secret management platform API","version":"0.0.1"},"servers":[{"url":"http://localhost:8080"}],"paths":{"/api/v1/platform/projects":{"post":{"tags":["projects"],"summary":"createProject projects","description":"Create a new project.","operationId":"projects#createProject","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectPayload"},"example":{"name":"hay","orgId":"Id eveniet atque sed."}}}},"responses":{"201":{"description":"Created response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"},"example":{"id":"Eius maxime nemo doloremque magni velit.","name":"Hic mollitia ut ea.","orgId":"Tempora ut sunt nihil aut sunt et."}}}}}}},"/api/v1/platform/projects/health":{"get":{"tags":["projects"],"summary":"getHealth projects","description":"Health check for the projects service.","operationId":"projects#getHealth","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","example":"Voluptates rerum maxime aut placeat rerum quos."},"example":"Laudantium porro."}}}}}},"/api/v1/secret-manager/secrets":{"get":{"tags":["secrets"],"summary":"listSecrets secrets","description":"List secrets for an environment.","operationId":"secrets#listSecrets","parameters":[{"name":"projectId","in":"query","description":"Project ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Project ID","example":"Aperiam optio ea molestias quibusdam nisi quia."},"example":"Eos rerum laborum maiores architecto."},{"name":"environment","in":"query","description":"Environment slug","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Environment slug","example":"Illo dicta exercitationem est."},"example":"Accusamus ut dolorem nemo."}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecretResultCollection"},"example":[{"environment":"Magnam quidem necessitatibus minima quia.","id":"Est et omnis nobis.","key":"Inventore similique quae est nesciunt aperiam dolorem.","projectId":"Dolore laudantium occaecati accusamus mollitia voluptas vero.","value":"Animi unde nihil enim."},{"environment":"Magnam quidem necessitatibus minima quia.","id":"Est et omnis nobis.","key":"Inventore similique quae est nesciunt aperiam dolorem.","projectId":"Dolore laudantium occaecati accusamus mollitia voluptas vero.","value":"Animi unde nihil enim."}]}}}}},"post":{"tags":["secrets"],"summary":"createSecret secrets","description":"Create a new secret.","operationId":"secrets#createSecret","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Secret"},"example":{"environment":"Qui eum quos eum pariatur.","key":"DATABASE_URL","projectId":"Deleniti itaque voluptatum.","value":"Reiciendis minima."}}}},"responses":{"201":{"description":"Created response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Secret3"},"example":{"environment":"Ipsa placeat.","id":"Aperiam vel velit repellendus aliquam.","key":"Quia adipisci.","projectId":"Corrupti est et.","value":"Tempore corrupti."}}}}}}},"/api/v1/secret-manager/secrets/health":{"get":{"tags":["secrets"],"summary":"getHealth secrets","description":"Health check for the secrets service.","operationId":"secrets#getHealth","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","example":"Doloremque qui minus consequatur non aut officia."},"example":"Deleniti sunt recusandae."}}}}}},"/api/v1/secret-manager/secrets/{id}":{"delete":{"tags":["secrets"],"summary":"deleteSecret secrets","description":"Delete a secret by ID.","operationId":"secrets#deleteSecret","parameters":[{"name":"id","in":"path","description":"Secret ID","required":true,"schema":{"type":"string","description":"Secret ID","example":"Dolor labore."},"example":"Est aut aliquam placeat ducimus sit."}],"responses":{"204":{"description":"No Content response."}}},"get":{"tags":["secrets"],"summary":"getSecret secrets","description":"Get a secret by ID.","operationId":"secrets#getSecret","parameters":[{"name":"id","in":"path","description":"Secret ID","required":true,"schema":{"type":"string","description":"Secret ID","example":"Corrupti necessitatibus quasi enim."},"example":"Omnis exercitationem optio laborum voluptates sit."}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Secret4"},"example":{"environment":"Quia consequuntur id quasi nostrum.","id":"Consequatur et temporibus incidunt earum.","key":"Iste distinctio.","projectId":"Mollitia velit eum rem sed corrupti ducimus.","value":"Consequatur ea consequatur provident aliquam mollitia."}}}}}},"patch":{"tags":["secrets"],"summary":"updateSecret secrets","description":"Update an existing secret.","operationId":"secrets#updateSecret","parameters":[{"name":"id","in":"path","description":"Secret ID","required":true,"schema":{"type":"string","description":"Secret ID","example":"Eum autem."},"example":"Aspernatur necessitatibus blanditiis."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSecretRequestBody"},"example":{"key":"Omnis autem quo ducimus facilis veritatis.","value":"Eligendi quasi iusto."}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Secret5"},"example":{"environment":"Sed sint voluptatem et et ut.","id":"Quis cupiditate nobis fugiat consectetur.","key":"Necessitatibus aliquid alias nihil.","projectId":"Expedita molestiae repudiandae veritatis.","value":"Ipsa quibusdam vel cupiditate enim optio."}}}}}}}},"components":{"schemas":{"CreateProjectPayload":{"type":"object","properties":{"name":{"type":"string","description":"Project name","example":"3","minLength":1},"orgId":{"type":"string","description":"Organization ID","example":"Tempora voluptas."}},"example":{"name":"q","orgId":"Necessitatibus qui harum ut quo."},"required":["name","orgId"]},"Project":{"type":"object","properties":{"id":{"type":"string","description":"Project ID","example":"Tempora numquam ut ea molestiae est."},"name":{"type":"string","description":"Project name","example":"Et veniam."},"orgId":{"type":"string","description":"Organization ID","example":"Voluptas occaecati quam placeat ut non."}},"example":{"id":"Accusantium aspernatur non repudiandae.","name":"Qui magni voluptatem sint sed.","orgId":"Quaerat neque dolor est."},"required":["id","name","orgId"]},"Secret":{"type":"object","properties":{"environment":{"type":"string","description":"Environment slug","example":"Veritatis nostrum ab quo accusantium."},"key":{"type":"string","description":"Secret key","example":"DATABASE_URL"},"projectId":{"type":"string","description":"Project ID","example":"Quasi sit itaque libero labore ut vitae."},"value":{"type":"string","description":"Secret value","example":"Voluptates temporibus ut consequuntur."}},"example":{"environment":"Nam minus corrupti.","key":"DATABASE_URL","projectId":"Nobis in.","value":"Aut nisi autem."},"required":["key","value","environment","projectId"]},"Secret2":{"type":"object","properties":{"environment":{"type":"string","description":"Environment slug","example":"Repellendus blanditiis corrupti iusto non."},"id":{"type":"string","description":"Secret ID","example":"Voluptatem et veritatis ipsa cum est."},"key":{"type":"string","description":"Secret key","example":"Debitis voluptatem dolore quia corrupti unde."},"projectId":{"type":"string","description":"Project ID","example":"Est perferendis."},"value":{"type":"string","description":"Secret value","example":"Aperiam et mollitia mollitia officia molestiae odio."}},"example":{"environment":"Aut voluptas animi.","id":"Hic et velit temporibus ea necessitatibus.","key":"Iure aut.","projectId":"Cupiditate asperiores tenetur.","value":"Veniam sint quo quas velit."},"required":["id","key","value","environment","projectId"]},"Secret3":{"type":"object","properties":{"environment":{"type":"string","description":"Environment slug","example":"Sed pariatur sunt repudiandae voluptatibus quasi provident."},"id":{"type":"string","description":"Secret ID","example":"Voluptatem sunt et sed."},"key":{"type":"string","description":"Secret key","example":"Et officia ea rerum quidem velit at."},"projectId":{"type":"string","description":"Project ID","example":"Est neque officia aspernatur laudantium molestiae."},"value":{"type":"string","description":"Secret value","example":"Enim qui eum et."}},"example":{"environment":"Delectus ut.","id":"Ut libero tenetur.","key":"Officiis velit amet.","projectId":"Voluptatem est.","value":"Eaque omnis est."},"required":["id","key","value","environment","projectId"]},"Secret4":{"type":"object","properties":{"environment":{"type":"string","description":"Environment slug","example":"Inventore praesentium blanditiis soluta beatae occaecati."},"id":{"type":"string","description":"Secret ID","example":"Omnis veniam."},"key":{"type":"string","description":"Secret key","example":"Explicabo et sed."},"projectId":{"type":"string","description":"Project ID","example":"Impedit enim dignissimos sed magni accusantium facilis."},"value":{"type":"string","description":"Secret value","example":"Eum est consequatur velit eaque quibusdam id."}},"example":{"environment":"Enim molestias at.","id":"Ratione voluptas exercitationem maiores natus.","key":"Et eum dolores tempore ullam possimus quisquam.","projectId":"Consequatur autem pariatur.","value":"Sunt in."},"required":["id","key","value","environment","projectId"]},"Secret5":{"type":"object","properties":{"environment":{"type":"string","description":"Environment slug","example":"Porro et quia tempore quis."},"id":{"type":"string","description":"Secret ID","example":"Voluptas inventore est ut."},"key":{"type":"string","description":"Secret key","example":"Quam rem."},"projectId":{"type":"string","description":"Project ID","example":"Et quia eos incidunt."},"value":{"type":"string","description":"Secret value","example":"Quidem dolor recusandae voluptates et inventore."}},"example":{"environment":"Qui excepturi numquam est accusamus natus qui.","id":"Quod aut exercitationem enim consectetur dolor ut.","key":"Ex delectus.","projectId":"Voluptas nesciunt illum sed magni facere et.","value":"Laboriosam odio repellendus officiis."},"required":["id","key","value","environment","projectId"]},"Secret6":{"type":"object","properties":{"environment":{"type":"string","description":"Environment slug","example":"Quam eius doloribus dolorem odio similique."},"id":{"type":"string","description":"Secret ID","example":"Alias sed aut ut."},"key":{"type":"string","description":"Secret key","example":"Ratione aliquam quas expedita ipsam delectus."},"projectId":{"type":"string","description":"Project ID","example":"Dolor nulla dolore mollitia facilis sed."},"value":{"type":"string","description":"Secret value","example":"Corrupti et velit quod nihil dolor."}},"example":{"environment":"Exercitationem eligendi saepe et earum corporis.","id":"Omnis et ut aliquid atque ipsum vero.","key":"Suscipit velit molestias ratione itaque exercitationem voluptate.","projectId":"Voluptas culpa.","value":"Iste quia."},"required":["id","key","value","environment","projectId"]},"SecretResultCollection":{"type":"array","items":{"$ref":"#/components/schemas/Secret6"},"example":[{"environment":"Magnam quidem necessitatibus minima quia.","id":"Est et omnis nobis.","key":"Inventore similique quae est nesciunt aperiam dolorem.","projectId":"Dolore laudantium occaecati accusamus mollitia voluptas vero.","value":"Animi unde nihil enim."},{"environment":"Magnam quidem necessitatibus minima quia.","id":"Est et omnis nobis.","key":"Inventore similique quae est nesciunt aperiam dolorem.","projectId":"Dolore laudantium occaecati accusamus mollitia voluptas vero.","value":"Animi unde nihil enim."}]},"UpdateSecretRequestBody":{"type":"object","properties":{"key":{"type":"string","description":"Secret key","example":"Et in et quos eius soluta."},"value":{"type":"string","description":"Secret value","example":"Impedit adipisci voluptatem molestiae voluptas nemo."}},"example":{"key":"Unde modi.","value":"Voluptatibus officia magni et ducimus pariatur."}}}},"tags":[{"name":"projects","description":"Service for managing projects."},{"name":"secrets","description":"Service for managing secrets."}]}\ No newline at end of filediff --git a/backend-go/internal/server/gen/http/openapi3.yaml b/backend-go/internal/server/gen/http/openapi3.yamlnew file mode 100644index 0000000000..20938cbbe9--- /dev/null+++ b/backend-go/internal/server/gen/http/openapi3.yaml@@ -0,0 +1,511 @@+openapi: 3.0.3+info:+ title: Infisical API+ description: Infisical secret management platform API+ version: 0.0.1+servers:+ - url: http://localhost:8080+paths:+ /api/v1/platform/projects:+ post:+ tags:+ - projects+ summary: createProject projects+ description: Create a new project.+ operationId: projects#createProject+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/CreateProjectPayload'+ example:+ name: hay+ orgId: Id eveniet atque sed.+ responses:+ "201":+ description: Created response.+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Project'+ example:+ id: Eius maxime nemo doloremque magni velit.+ name: Hic mollitia ut ea.+ orgId: Tempora ut sunt nihil aut sunt et.+ /api/v1/platform/projects/health:+ get:+ tags:+ - projects+ summary: getHealth projects+ description: Health check for the projects service.+ operationId: projects#getHealth+ responses:+ "200":+ description: OK response.+ content:+ application/json:+ schema:+ type: string+ example: Voluptates rerum maxime aut placeat rerum quos.+ example: Laudantium porro.+ /api/v1/secret-manager/secrets:+ get:+ tags:+ - secrets+ summary: listSecrets secrets+ description: List secrets for an environment.+ operationId: secrets#listSecrets+ parameters:+ - name: projectId+ in: query+ description: Project ID+ allowEmptyValue: true+ required: true+ schema:+ type: string+ description: Project ID+ example: Aperiam optio ea molestias quibusdam nisi quia.+ example: Eos rerum laborum maiores architecto.+ - name: environment+ in: query+ description: Environment slug+ allowEmptyValue: true+ required: true+ schema:+ type: string+ description: Environment slug+ example: Illo dicta exercitationem est.+ example: Accusamus ut dolorem nemo.+ responses:+ "200":+ description: OK response.+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/SecretResultCollection'+ example:+ - environment: Magnam quidem necessitatibus minima quia.+ id: Est et omnis nobis.+ key: Inventore similique quae est nesciunt aperiam dolorem.+ projectId: Dolore laudantium occaecati accusamus mollitia voluptas vero.+ value: Animi unde nihil enim.+ - environment: Magnam quidem necessitatibus minima quia.+ id: Est et omnis nobis.+ key: Inventore similique quae est nesciunt aperiam dolorem.+ projectId: Dolore laudantium occaecati accusamus mollitia voluptas vero.+ value: Animi unde nihil enim.+ post:+ tags:+ - secrets+ summary: createSecret secrets+ description: Create a new secret.+ operationId: secrets#createSecret+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Secret'+ example:+ environment: Qui eum quos eum pariatur.+ key: DATABASE_URL+ projectId: Deleniti itaque voluptatum.+ value: Reiciendis minima.+ responses:+ "201":+ description: Created response.+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Secret3'+ example:+ environment: Ipsa placeat.+ id: Aperiam vel velit repellendus aliquam.+ key: Quia adipisci.+ projectId: Corrupti est et.+ value: Tempore corrupti.+ /api/v1/secret-manager/secrets/{id}:+ delete:+ tags:+ - secrets+ summary: deleteSecret secrets+ description: Delete a secret by ID.+ operationId: secrets#deleteSecret+ parameters:+ - name: id+ in: path+ description: Secret ID+ required: true+ schema:+ type: string+ description: Secret ID+ example: Dolor labore.+ example: Est aut aliquam placeat ducimus sit.+ responses:+ "204":+ description: No Content response.+ get:+ tags:+ - secrets+ summary: getSecret secrets+ description: Get a secret by ID.+ operationId: secrets#getSecret+ parameters:+ - name: id+ in: path+ description: Secret ID+ required: true+ schema:+ type: string+ description: Secret ID+ example: Corrupti necessitatibus quasi enim.+ example: Omnis exercitationem optio laborum voluptates sit.+ responses:+ "200":+ description: OK response.+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Secret4'+ example:+ environment: Quia consequuntur id quasi nostrum.+ id: Consequatur et temporibus incidunt earum.+ key: Iste distinctio.+ projectId: Mollitia velit eum rem sed corrupti ducimus.+ value: Consequatur ea consequatur provident aliquam mollitia.+ patch:+ tags:+ - secrets+ summary: updateSecret secrets+ description: Update an existing secret.+ operationId: secrets#updateSecret+ parameters:+ - name: id+ in: path+ description: Secret ID+ required: true+ schema:+ type: string+ description: Secret ID+ example: Eum autem.+ example: Aspernatur necessitatibus blanditiis.+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/UpdateSecretRequestBody'+ example:+ key: Omnis autem quo ducimus facilis veritatis.+ value: Eligendi quasi iusto.+ responses:+ "200":+ description: OK response.+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Secret5'+ example:+ environment: Sed sint voluptatem et et ut.+ id: Quis cupiditate nobis fugiat consectetur.+ key: Necessitatibus aliquid alias nihil.+ projectId: Expedita molestiae repudiandae veritatis.+ value: Ipsa quibusdam vel cupiditate enim optio.+ /api/v1/secret-manager/secrets/health:+ get:+ tags:+ - secrets+ summary: getHealth secrets+ description: Health check for the secrets service.+ operationId: secrets#getHealth+ responses:+ "200":+ description: OK response.+ content:+ application/json:+ schema:+ type: string+ example: Doloremque qui minus consequatur non aut officia.+ example: Deleniti sunt recusandae.+components:+ schemas:+ CreateProjectPayload:+ type: object+ properties:+ name:+ type: string+ description: Project name+ example: "3"+ minLength: 1+ orgId:+ type: string+ description: Organization ID+ example: Tempora voluptas.+ example:+ name: q+ orgId: Necessitatibus qui harum ut quo.+ required:+ - name+ - orgId+ Project:+ type: object+ properties:+ id:+ type: string+ description: Project ID+ example: Tempora numquam ut ea molestiae est.+ name:+ type: string+ description: Project name+ example: Et veniam.+ orgId:+ type: string+ description: Organization ID+ example: Voluptas occaecati quam placeat ut non.+ example:+ id: Accusantium aspernatur non repudiandae.+ name: Qui magni voluptatem sint sed.+ orgId: Quaerat neque dolor est.+ required:+ - id+ - name+ - orgId+ Secret:+ type: object+ properties:+ environment:+ type: string+ description: Environment slug+ example: Veritatis nostrum ab quo accusantium.+ key:+ type: string+ description: Secret key+ example: DATABASE_URL+ projectId:+ type: string+ description: Project ID+ example: Quasi sit itaque libero labore ut vitae.+ value:+ type: string+ description: Secret value+ example: Voluptates temporibus ut consequuntur.+ example:+ environment: Nam minus corrupti.+ key: DATABASE_URL+ projectId: Nobis in.+ value: Aut nisi autem.+ required:+ - key+ - value+ - environment+ - projectId+ Secret2:+ type: object+ properties:+ environment:+ type: string+ description: Environment slug+ example: Repellendus blanditiis corrupti iusto non.+ id:+ type: string+ description: Secret ID+ example: Voluptatem et veritatis ipsa cum est.+ key:+ type: string+ description: Secret key+ example: Debitis voluptatem dolore quia corrupti unde.+ projectId:+ type: string+ description: Project ID+ example: Est perferendis.+ value:+ type: string+ description: Secret value+ example: Aperiam et mollitia mollitia officia molestiae odio.+ example:+ environment: Aut voluptas animi.+ id: Hic et velit temporibus ea necessitatibus.+ key: Iure aut.+ projectId: Cupiditate asperiores tenetur.+ value: Veniam sint quo quas velit.+ required:+ - id+ - key+ - value+ - environment+ - projectId+ Secret3:+ type: object+ properties:+ environment:+ type: string+ description: Environment slug+ example: Sed pariatur sunt repudiandae voluptatibus quasi provident.+ id:+ type: string+ description: Secret ID+ example: Voluptatem sunt et sed.+ key:+ type: string+ description: Secret key+ example: Et officia ea rerum quidem velit at.+ projectId:+ type: string+ description: Project ID+ example: Est neque officia aspernatur laudantium molestiae.+ value:+ type: string+ description: Secret value+ example: Enim qui eum et.+ example:+ environment: Delectus ut.+ id: Ut libero tenetur.+ key: Officiis velit amet.+ projectId: Voluptatem est.+ value: Eaque omnis est.+ required:+ - id+ - key+ - value+ - environment+ - projectId+ Secret4:+ type: object+ properties:+ environment:+ type: string+ description: Environment slug+ example: Inventore praesentium blanditiis soluta beatae occaecati.+ id:+ type: string+ description: Secret ID+ example: Omnis veniam.+ key:+ type: string+ description: Secret key+ example: Explicabo et sed.+ projectId:+ type: string+ description: Project ID+ example: Impedit enim dignissimos sed magni accusantium facilis.+ value:+ type: string+ description: Secret value+ example: Eum est consequatur velit eaque quibusdam id.+ example:+ environment: Enim molestias at.+ id: Ratione voluptas exercitationem maiores natus.+ key: Et eum dolores tempore ullam possimus quisquam.+ projectId: Consequatur autem pariatur.+ value: Sunt in.+ required:+ - id+ - key+ - value+ - environment+ - projectId+ Secret5:+ type: object+ properties:+ environment:+ type: string+ description: Environment slug+ example: Porro et quia tempore quis.+ id:+ type: string+ description: Secret ID+ example: Voluptas inventore est ut.+ key:+ type: string+ description: Secret key+ example: Quam rem.+ projectId:+ type: string+ description: Project ID+ example: Et quia eos incidunt.+ value:+ type: string+ description: Secret value+ example: Quidem dolor recusandae voluptates et inventore.+ example:+ environment: Qui excepturi numquam est accusamus natus qui.+ id: Quod aut exercitationem enim consectetur dolor ut.+ key: Ex delectus.+ projectId: Voluptas nesciunt illum sed magni facere et.+ value: Laboriosam odio repellendus officiis.+ required:+ - id+ - key+ - value+ - environment+ - projectId+ Secret6:+ type: object+ properties:+ environment:+ type: string+ description: Environment slug+ example: Quam eius doloribus dolorem odio similique.+ id:+ type: string+ description: Secret ID+ example: Alias sed aut ut.+ key:+ type: string+ description: Secret key+ example: Ratione aliquam quas expedita ipsam delectus.+ projectId:+ type: string+ description: Project ID+ example: Dolor nulla dolore mollitia facilis sed.+ value:+ type: string+ description: Secret value+ example: Corrupti et velit quod nihil dolor.+ example:+ environment: Exercitationem eligendi saepe et earum corporis.+ id: Omnis et ut aliquid atque ipsum vero.+ key: Suscipit velit molestias ratione itaque exercitationem voluptate.+ projectId: Voluptas culpa.+ value: Iste quia.+ required:+ - id+ - key+ - value+ - environment+ - projectId+ SecretResultCollection:+ type: array+ items:+ $ref: '#/components/schemas/Secret6'+ example:+ - environment: Magnam quidem necessitatibus minima quia.+ id: Est et omnis nobis.+ key: Inventore similique quae est nesciunt aperiam dolorem.+ projectId: Dolore laudantium occaecati accusamus mollitia voluptas vero.+ value: Animi unde nihil enim.+ - environment: Magnam quidem necessitatibus minima quia.+ id: Est et omnis nobis.+ key: Inventore similique quae est nesciunt aperiam dolorem.+ projectId: Dolore laudantium occaecati accusamus mollitia voluptas vero.+ value: Animi unde nihil enim.+ UpdateSecretRequestBody:+ type: object+ properties:+ key:+ type: string+ description: Secret key+ example: Et in et quos eius soluta.+ value:+ type: string+ description: Secret value+ example: Impedit adipisci voluptatem molestiae voluptas nemo.+ example:+ key: Unde modi.+ value: Voluptatibus officia magni et ducimus pariatur.+tags:+ - name: projects+ description: Service for managing projects.+ - name: secrets+ description: Service for managing secrets.diff --git a/backend-go/internal/server/gen/http/projects/client/cli.go b/backend-go/internal/server/gen/http/projects/client/cli.gonew file mode 100644index 0000000000..abdeebcbf8--- /dev/null+++ b/backend-go/internal/server/gen/http/projects/client/cli.go@@ -0,0 +1,43 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects HTTP client CLI support package+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++import (+ "encoding/json"+ "fmt"+ "unicode/utf8"++ projects "github.com/infisical/api/internal/server/gen/projects"+ goa "goa.design/goa/v3/pkg"+)++// BuildCreateProjectPayload builds the payload for the projects createProject+// endpoint from CLI flags.+func BuildCreateProjectPayload(projectsCreateProjectBody string) (*projects.CreateProjectPayload, error) {+ var err error+ var body CreateProjectRequestBody+ {+ err = json.Unmarshal([]byte(projectsCreateProjectBody), &body)+ if err != nil {+ return nil, fmt.Errorf("invalid JSON for body, \nerror: %s, \nexample of valid JSON:\n%s", err, "'{\n \"name\": \"hay\",\n \"orgId\": \"Id eveniet atque sed.\"\n }'")+ }+ if utf8.RuneCountInString(body.Name) < 1 {+ err = goa.MergeErrors(err, goa.InvalidLengthError("body.name", body.Name, utf8.RuneCountInString(body.Name), 1, true))+ }+ if err != nil {+ return nil, err+ }+ }+ v := &projects.CreateProjectPayload{+ Name: body.Name,+ OrgID: body.OrgID,+ }++ return v, nil+}diff --git a/backend-go/internal/server/gen/http/projects/client/client.go b/backend-go/internal/server/gen/http/projects/client/client.gonew file mode 100644index 0000000000..bd18e234e2--- /dev/null+++ b/backend-go/internal/server/gen/http/projects/client/client.go@@ -0,0 +1,100 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects client HTTP transport+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++import (+ "context"+ "net/http"++ goahttp "goa.design/goa/v3/http"+ goa "goa.design/goa/v3/pkg"+)++// Client lists the projects service endpoint HTTP clients.+type Client struct {+ // GetHealth Doer is the HTTP client used to make requests to the getHealth+ // endpoint.+ GetHealthDoer goahttp.Doer++ // CreateProject Doer is the HTTP client used to make requests to the+ // createProject endpoint.+ CreateProjectDoer goahttp.Doer++ // RestoreResponseBody controls whether the response bodies are reset after+ // decoding so they can be read again.+ RestoreResponseBody bool++ scheme string+ host string+ encoder func(*http.Request) goahttp.Encoder+ decoder func(*http.Response) goahttp.Decoder+}++// NewClient instantiates HTTP clients for all the projects service servers.+func NewClient(+ scheme string,+ host string,+ doer goahttp.Doer,+ enc func(*http.Request) goahttp.Encoder,+ dec func(*http.Response) goahttp.Decoder,+ restoreBody bool,+) *Client {+ return &Client{+ GetHealthDoer: doer,+ CreateProjectDoer: doer,+ RestoreResponseBody: restoreBody,+ scheme: scheme,+ host: host,+ decoder: dec,+ encoder: enc,+ }+}++// GetHealth returns an endpoint that makes HTTP requests to the projects+// service getHealth server.+func (c *Client) GetHealth() goa.Endpoint {+ var (+ decodeResponse = DecodeGetHealthResponse(c.decoder, c.RestoreResponseBody)+ )+ return func(ctx context.Context, v any) (any, error) {+ req, err := c.BuildGetHealthRequest(ctx, v)+ if err != nil {+ return nil, err+ }+ resp, err := c.GetHealthDoer.Do(req)+ if err != nil {+ return nil, goahttp.ErrRequestError("projects", "getHealth", err)+ }+ return decodeResponse(resp)+ }+}++// CreateProject returns an endpoint that makes HTTP requests to the projects+// service createProject server.+func (c *Client) CreateProject() goa.Endpoint {+ var (+ encodeRequest = EncodeCreateProjectRequest(c.encoder)+ decodeResponse = DecodeCreateProjectResponse(c.decoder, c.RestoreResponseBody)+ )+ return func(ctx context.Context, v any) (any, error) {+ req, err := c.BuildCreateProjectRequest(ctx, v)+ if err != nil {+ return nil, err+ }+ err = encodeRequest(req, v)+ if err != nil {+ return nil, err+ }+ resp, err := c.CreateProjectDoer.Do(req)+ if err != nil {+ return nil, goahttp.ErrRequestError("projects", "createProject", err)+ }+ return decodeResponse(resp)+ }+}diff --git a/backend-go/internal/server/gen/http/projects/client/encode_decode.go b/backend-go/internal/server/gen/http/projects/client/encode_decode.gonew file mode 100644index 0000000000..853fd68647--- /dev/null+++ b/backend-go/internal/server/gen/http/projects/client/encode_decode.go@@ -0,0 +1,144 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects HTTP client encoders and decoders+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++import (+ "bytes"+ "context"+ "io"+ "net/http"+ "net/url"++ projects "github.com/infisical/api/internal/server/gen/projects"+ projectsviews "github.com/infisical/api/internal/server/gen/projects/views"+ goahttp "goa.design/goa/v3/http"+)++// BuildGetHealthRequest instantiates a HTTP request object with method and+// path set to call the "projects" service "getHealth" endpoint+func (c *Client) BuildGetHealthRequest(ctx context.Context, v any) (*http.Request, error) {+ u := &url.URL{Scheme: c.scheme, Host: c.host, Path: GetHealthProjectsPath()}+ req, err := http.NewRequest("GET", u.String(), nil)+ if err != nil {+ return nil, goahttp.ErrInvalidURL("projects", "getHealth", u.String(), err)+ }+ if ctx != nil {+ req = req.WithContext(ctx)+ }++ return req, nil+}++// DecodeGetHealthResponse returns a decoder for responses returned by the+// projects getHealth endpoint. restoreBody controls whether the response body+// should be restored after having been read.+func DecodeGetHealthResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {+ return func(resp *http.Response) (any, error) {+ if restoreBody {+ b, err := io.ReadAll(resp.Body)+ if err != nil {+ return nil, err+ }+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ defer func() {+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ }()+ } else {+ defer resp.Body.Close()+ }+ switch resp.StatusCode {+ case http.StatusOK:+ var (+ body string+ err error+ )+ err = decoder(resp).Decode(&body)+ if err != nil {+ return nil, goahttp.ErrDecodingError("projects", "getHealth", err)+ }+ return body, nil+ default:+ body, _ := io.ReadAll(resp.Body)+ return nil, goahttp.ErrInvalidResponse("projects", "getHealth", resp.StatusCode, string(body))+ }+ }+}++// BuildCreateProjectRequest instantiates a HTTP request object with method and+// path set to call the "projects" service "createProject" endpoint+func (c *Client) BuildCreateProjectRequest(ctx context.Context, v any) (*http.Request, error) {+ u := &url.URL{Scheme: c.scheme, Host: c.host, Path: CreateProjectProjectsPath()}+ req, err := http.NewRequest("POST", u.String(), nil)+ if err != nil {+ return nil, goahttp.ErrInvalidURL("projects", "createProject", u.String(), err)+ }+ if ctx != nil {+ req = req.WithContext(ctx)+ }++ return req, nil+}++// EncodeCreateProjectRequest returns an encoder for requests sent to the+// projects createProject server.+func EncodeCreateProjectRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error {+ return func(req *http.Request, v any) error {+ p, ok := v.(*projects.CreateProjectPayload)+ if !ok {+ return goahttp.ErrInvalidType("projects", "createProject", "*projects.CreateProjectPayload", v)+ }+ body := NewCreateProjectRequestBody(p)+ if err := encoder(req).Encode(&body); err != nil {+ return goahttp.ErrEncodingError("projects", "createProject", err)+ }+ return nil+ }+}++// DecodeCreateProjectResponse returns a decoder for responses returned by the+// projects createProject endpoint. restoreBody controls whether the response+// body should be restored after having been read.+func DecodeCreateProjectResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {+ return func(resp *http.Response) (any, error) {+ if restoreBody {+ b, err := io.ReadAll(resp.Body)+ if err != nil {+ return nil, err+ }+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ defer func() {+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ }()+ } else {+ defer resp.Body.Close()+ }+ switch resp.StatusCode {+ case http.StatusCreated:+ var (+ body CreateProjectResponseBody+ err error+ )+ err = decoder(resp).Decode(&body)+ if err != nil {+ return nil, goahttp.ErrDecodingError("projects", "createProject", err)+ }+ p := NewCreateProjectProjectResultCreated(&body)+ view := "default"+ vres := &projectsviews.ProjectResult{Projected: p, View: view}+ if err = projectsviews.ValidateProjectResult(vres); err != nil {+ return nil, goahttp.ErrValidationError("projects", "createProject", err)+ }+ res := projects.NewProjectResult(vres)+ return res, nil+ default:+ body, _ := io.ReadAll(resp.Body)+ return nil, goahttp.ErrInvalidResponse("projects", "createProject", resp.StatusCode, string(body))+ }+ }+}diff --git a/backend-go/internal/server/gen/http/projects/client/paths.go b/backend-go/internal/server/gen/http/projects/client/paths.gonew file mode 100644index 0000000000..3870e4104f--- /dev/null+++ b/backend-go/internal/server/gen/http/projects/client/paths.go@@ -0,0 +1,19 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// HTTP request path constructors for the projects service.+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++// GetHealthProjectsPath returns the URL path to the projects service getHealth HTTP endpoint.+func GetHealthProjectsPath() string {+ return "/api/v1/platform/projects/health"+}++// CreateProjectProjectsPath returns the URL path to the projects service createProject HTTP endpoint.+func CreateProjectProjectsPath() string {+ return "/api/v1/platform/projects"+}diff --git a/backend-go/internal/server/gen/http/projects/client/types.go b/backend-go/internal/server/gen/http/projects/client/types.gonew file mode 100644index 0000000000..0753835da2--- /dev/null+++ b/backend-go/internal/server/gen/http/projects/client/types.go@@ -0,0 +1,56 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects HTTP client types+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++import (+ projects "github.com/infisical/api/internal/server/gen/projects"+ projectsviews "github.com/infisical/api/internal/server/gen/projects/views"+)++// CreateProjectRequestBody is the type of the "projects" service+// "createProject" endpoint HTTP request body.+type CreateProjectRequestBody struct {+ // Project name+ Name string `form:"name" json:"name" xml:"name"`+ // Organization ID+ OrgID string `form:"orgId" json:"orgId" xml:"orgId"`+}++// CreateProjectResponseBody is the type of the "projects" service+// "createProject" endpoint HTTP response body.+type CreateProjectResponseBody struct {+ // Project ID+ ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`+ // Project name+ Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`+ // Organization ID+ OrgID *string `form:"orgId,omitempty" json:"orgId,omitempty" xml:"orgId,omitempty"`+}++// NewCreateProjectRequestBody builds the HTTP request body from the payload of+// the "createProject" endpoint of the "projects" service.+func NewCreateProjectRequestBody(p *projects.CreateProjectPayload) *CreateProjectRequestBody {+ body := &CreateProjectRequestBody{+ Name: p.Name,+ OrgID: p.OrgID,+ }+ return body+}++// NewCreateProjectProjectResultCreated builds a "projects" service+// "createProject" endpoint result from a HTTP "Created" response.+func NewCreateProjectProjectResultCreated(body *CreateProjectResponseBody) *projectsviews.ProjectResultView {+ v := &projectsviews.ProjectResultView{+ ID: body.ID,+ Name: body.Name,+ OrgID: body.OrgID,+ }++ return v+}diff --git a/backend-go/internal/server/gen/http/projects/server/encode_decode.go b/backend-go/internal/server/gen/http/projects/server/encode_decode.gonew file mode 100644index 0000000000..646b8066d6--- /dev/null+++ b/backend-go/internal/server/gen/http/projects/server/encode_decode.go@@ -0,0 +1,75 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects HTTP server encoders and decoders+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package server++import (+ "context"+ "errors"+ "io"+ "net/http"++ projects "github.com/infisical/api/internal/server/gen/projects"+ projectsviews "github.com/infisical/api/internal/server/gen/projects/views"+ goahttp "goa.design/goa/v3/http"+ goa "goa.design/goa/v3/pkg"+)++// EncodeGetHealthResponse returns an encoder for responses returned by the+// projects getHealth endpoint.+func EncodeGetHealthResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {+ return func(ctx context.Context, w http.ResponseWriter, v any) error {+ res, _ := v.(string)+ enc := encoder(ctx, w)+ body := res+ w.WriteHeader(http.StatusOK)+ return enc.Encode(body)+ }+}++// EncodeCreateProjectResponse returns an encoder for responses returned by the+// projects createProject endpoint.+func EncodeCreateProjectResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {+ return func(ctx context.Context, w http.ResponseWriter, v any) error {+ res := v.(*projectsviews.ProjectResult)+ enc := encoder(ctx, w)+ body := NewCreateProjectResponseBody(res.Projected)+ w.WriteHeader(http.StatusCreated)+ return enc.Encode(body)+ }+}++// DecodeCreateProjectRequest returns a decoder for requests sent to the+// projects createProject endpoint.+func DecodeCreateProjectRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*projects.CreateProjectPayload, error) {+ return func(r *http.Request) (*projects.CreateProjectPayload, error) {+ var payload *projects.CreateProjectPayload+ var (+ body CreateProjectRequestBody+ err error+ )+ err = decoder(r).Decode(&body)+ if err != nil {+ if errors.Is(err, io.EOF) {+ return payload, goa.MissingPayloadError()+ }+ var gerr *goa.ServiceError+ if errors.As(err, &gerr) {+ return payload, gerr+ }+ return payload, goa.DecodePayloadError(err.Error())+ }+ err = ValidateCreateProjectRequestBody(&body)+ if err != nil {+ return payload, err+ }+ payload = NewCreateProjectPayload(&body)++ return payload, nil+ }+}diff --git a/backend-go/internal/server/gen/http/projects/server/paths.go b/backend-go/internal/server/gen/http/projects/server/paths.gonew file mode 100644index 0000000000..72cbc19dd7--- /dev/null+++ b/backend-go/internal/server/gen/http/projects/server/paths.go@@ -0,0 +1,19 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// HTTP request path constructors for the projects service.+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package server++// GetHealthProjectsPath returns the URL path to the projects service getHealth HTTP endpoint.+func GetHealthProjectsPath() string {+ return "/api/v1/platform/projects/health"+}++// CreateProjectProjectsPath returns the URL path to the projects service createProject HTTP endpoint.+func CreateProjectProjectsPath() string {+ return "/api/v1/platform/projects"+}diff --git a/backend-go/internal/server/gen/http/projects/server/server.go b/backend-go/internal/server/gen/http/projects/server/server.gonew file mode 100644index 0000000000..6918b050d5--- /dev/null+++ b/backend-go/internal/server/gen/http/projects/server/server.go@@ -0,0 +1,182 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects HTTP server+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package server++import (+ "context"+ "net/http"++ projects "github.com/infisical/api/internal/server/gen/projects"+ goahttp "goa.design/goa/v3/http"+ goa "goa.design/goa/v3/pkg"+)++// Server lists the projects service endpoint HTTP handlers.+type Server struct {+ Mounts []*MountPoint+ GetHealth http.Handler+ CreateProject http.Handler+}++// MountPoint holds information about the mounted endpoints.+type MountPoint struct {+ // Method is the name of the service method served by the mounted HTTP handler.+ Method string+ // Verb is the HTTP method used to match requests to the mounted handler.+ Verb string+ // Pattern is the HTTP request path pattern used to match requests to the+ // mounted handler.+ Pattern string+}++// New instantiates HTTP handlers for all the projects service endpoints using+// the provided encoder and decoder. The handlers are mounted on the given mux+// using the HTTP verb and path defined in the design. errhandler is called+// whenever a response fails to be encoded. formatter is used to format errors+// returned by the service methods prior to encoding. Both errhandler and+// formatter are optional and can be nil.+func New(+ e *projects.Endpoints,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) *Server {+ return &Server{+ Mounts: []*MountPoint{+ {"GetHealth", "GET", "/api/v1/platform/projects/health"},+ {"CreateProject", "POST", "/api/v1/platform/projects"},+ },+ GetHealth: NewGetHealthHandler(e.GetHealth, mux, decoder, encoder, errhandler, formatter),+ CreateProject: NewCreateProjectHandler(e.CreateProject, mux, decoder, encoder, errhandler, formatter),+ }+}++// Service returns the name of the service served.+func (s *Server) Service() string { return "projects" }++// Use wraps the server handlers with the given middleware.+func (s *Server) Use(m func(http.Handler) http.Handler) {+ s.GetHealth = m(s.GetHealth)+ s.CreateProject = m(s.CreateProject)+}++// MethodNames returns the methods served.+func (s *Server) MethodNames() []string { return projects.MethodNames[:] }++// Mount configures the mux to serve the projects endpoints.+func Mount(mux goahttp.Muxer, h *Server) {+ MountGetHealthHandler(mux, h.GetHealth)+ MountCreateProjectHandler(mux, h.CreateProject)+}++// Mount configures the mux to serve the projects endpoints.+func (s *Server) Mount(mux goahttp.Muxer) {+ Mount(mux, s)+}++// MountGetHealthHandler configures the mux to serve the "projects" service+// "getHealth" endpoint.+func MountGetHealthHandler(mux goahttp.Muxer, h http.Handler) {+ f, ok := h.(http.HandlerFunc)+ if !ok {+ f = func(w http.ResponseWriter, r *http.Request) {+ h.ServeHTTP(w, r)+ }+ }+ mux.Handle("GET", "/api/v1/platform/projects/health", f)+}++// NewGetHealthHandler creates a HTTP handler which loads the HTTP request and+// calls the "projects" service "getHealth" endpoint.+func NewGetHealthHandler(+ endpoint goa.Endpoint,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) http.Handler {+ var (+ encodeResponse = EncodeGetHealthResponse(encoder)+ encodeError = goahttp.ErrorEncoder(encoder, formatter)+ )+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept"))+ ctx = context.WithValue(ctx, goa.MethodKey, "getHealth")+ ctx = context.WithValue(ctx, goa.ServiceKey, "projects")+ var err error+ res, err := endpoint(ctx, nil)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ if err := encodeResponse(ctx, w, res); err != nil {+ if errhandler != nil {+ errhandler(ctx, w, err)+ }+ }+ })+}++// MountCreateProjectHandler configures the mux to serve the "projects" service+// "createProject" endpoint.+func MountCreateProjectHandler(mux goahttp.Muxer, h http.Handler) {+ f, ok := h.(http.HandlerFunc)+ if !ok {+ f = func(w http.ResponseWriter, r *http.Request) {+ h.ServeHTTP(w, r)+ }+ }+ mux.Handle("POST", "/api/v1/platform/projects", f)+}++// NewCreateProjectHandler creates a HTTP handler which loads the HTTP request+// and calls the "projects" service "createProject" endpoint.+func NewCreateProjectHandler(+ endpoint goa.Endpoint,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) http.Handler {+ var (+ decodeRequest = DecodeCreateProjectRequest(mux, decoder)+ encodeResponse = EncodeCreateProjectResponse(encoder)+ encodeError = goahttp.ErrorEncoder(encoder, formatter)+ )+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept"))+ ctx = context.WithValue(ctx, goa.MethodKey, "createProject")+ ctx = context.WithValue(ctx, goa.ServiceKey, "projects")+ payload, err := decodeRequest(r)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ res, err := endpoint(ctx, payload)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ if err := encodeResponse(ctx, w, res); err != nil {+ if errhandler != nil {+ errhandler(ctx, w, err)+ }+ }+ })+}diff --git a/backend-go/internal/server/gen/http/projects/server/types.go b/backend-go/internal/server/gen/http/projects/server/types.gonew file mode 100644index 0000000000..443bb73faa--- /dev/null+++ b/backend-go/internal/server/gen/http/projects/server/types.go@@ -0,0 +1,76 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects HTTP server types+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package server++import (+ "unicode/utf8"++ projects "github.com/infisical/api/internal/server/gen/projects"+ projectsviews "github.com/infisical/api/internal/server/gen/projects/views"+ goa "goa.design/goa/v3/pkg"+)++// CreateProjectRequestBody is the type of the "projects" service+// "createProject" endpoint HTTP request body.+type CreateProjectRequestBody struct {+ // Project name+ Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`+ // Organization ID+ OrgID *string `form:"orgId,omitempty" json:"orgId,omitempty" xml:"orgId,omitempty"`+}++// CreateProjectResponseBody is the type of the "projects" service+// "createProject" endpoint HTTP response body.+type CreateProjectResponseBody struct {+ // Project ID+ ID string `form:"id" json:"id" xml:"id"`+ // Project name+ Name string `form:"name" json:"name" xml:"name"`+ // Organization ID+ OrgID string `form:"orgId" json:"orgId" xml:"orgId"`+}++// NewCreateProjectResponseBody builds the HTTP response body from the result+// of the "createProject" endpoint of the "projects" service.+func NewCreateProjectResponseBody(res *projectsviews.ProjectResultView) *CreateProjectResponseBody {+ body := &CreateProjectResponseBody{+ ID: *res.ID,+ Name: *res.Name,+ OrgID: *res.OrgID,+ }+ return body+}++// NewCreateProjectPayload builds a projects service createProject endpoint+// payload.+func NewCreateProjectPayload(body *CreateProjectRequestBody) *projects.CreateProjectPayload {+ v := &projects.CreateProjectPayload{+ Name: *body.Name,+ OrgID: *body.OrgID,+ }++ return v+}++// ValidateCreateProjectRequestBody runs the validations defined on+// CreateProjectRequestBody+func ValidateCreateProjectRequestBody(body *CreateProjectRequestBody) (err error) {+ if body.Name == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("name", "body"))+ }+ if body.OrgID == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("orgId", "body"))+ }+ if body.Name != nil {+ if utf8.RuneCountInString(*body.Name) < 1 {+ err = goa.MergeErrors(err, goa.InvalidLengthError("body.name", *body.Name, utf8.RuneCountInString(*body.Name), 1, true))+ }+ }+ return+}diff --git a/backend-go/internal/server/gen/http/secrets/client/cli.go b/backend-go/internal/server/gen/http/secrets/client/cli.gonew file mode 100644index 0000000000..6b10f8a139--- /dev/null+++ b/backend-go/internal/server/gen/http/secrets/client/cli.go@@ -0,0 +1,105 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets HTTP client CLI support package+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++import (+ "encoding/json"+ "fmt"++ secrets "github.com/infisical/api/internal/server/gen/secrets"+)++// BuildCreateSecretPayload builds the payload for the secrets createSecret+// endpoint from CLI flags.+func BuildCreateSecretPayload(secretsCreateSecretBody string) (*secrets.Secret, error) {+ var err error+ var body CreateSecretRequestBody+ {+ err = json.Unmarshal([]byte(secretsCreateSecretBody), &body)+ if err != nil {+ return nil, fmt.Errorf("invalid JSON for body, \nerror: %s, \nexample of valid JSON:\n%s", err, "'{\n \"environment\": \"Qui eum quos eum pariatur.\",\n \"key\": \"DATABASE_URL\",\n \"projectId\": \"Deleniti itaque voluptatum.\",\n \"value\": \"Reiciendis minima.\"\n }'")+ }+ }+ v := &secrets.Secret{+ Key: body.Key,+ Value: body.Value,+ Environment: body.Environment,+ ProjectID: body.ProjectID,+ }++ return v, nil+}++// BuildGetSecretPayload builds the payload for the secrets getSecret endpoint+// from CLI flags.+func BuildGetSecretPayload(secretsGetSecretID string) (*secrets.GetSecretPayload, error) {+ var id string+ {+ id = secretsGetSecretID+ }+ v := &secrets.GetSecretPayload{}+ v.ID = id++ return v, nil+}++// BuildUpdateSecretPayload builds the payload for the secrets updateSecret+// endpoint from CLI flags.+func BuildUpdateSecretPayload(secretsUpdateSecretBody string, secretsUpdateSecretID string) (*secrets.UpdateSecretPayload, error) {+ var err error+ var body UpdateSecretRequestBody+ {+ err = json.Unmarshal([]byte(secretsUpdateSecretBody), &body)+ if err != nil {+ return nil, fmt.Errorf("invalid JSON for body, \nerror: %s, \nexample of valid JSON:\n%s", err, "'{\n \"key\": \"Omnis autem quo ducimus facilis veritatis.\",\n \"value\": \"Eligendi quasi iusto.\"\n }'")+ }+ }+ var id string+ {+ id = secretsUpdateSecretID+ }+ v := &secrets.UpdateSecretPayload{+ Key: body.Key,+ Value: body.Value,+ }+ v.ID = id++ return v, nil+}++// BuildDeleteSecretPayload builds the payload for the secrets deleteSecret+// endpoint from CLI flags.+func BuildDeleteSecretPayload(secretsDeleteSecretID string) (*secrets.DeleteSecretPayload, error) {+ var id string+ {+ id = secretsDeleteSecretID+ }+ v := &secrets.DeleteSecretPayload{}+ v.ID = id++ return v, nil+}++// BuildListSecretsPayload builds the payload for the secrets listSecrets+// endpoint from CLI flags.+func BuildListSecretsPayload(secretsListSecretsProjectID string, secretsListSecretsEnvironment string) (*secrets.ListSecretsPayload, error) {+ var projectID string+ {+ projectID = secretsListSecretsProjectID+ }+ var environment string+ {+ environment = secretsListSecretsEnvironment+ }+ v := &secrets.ListSecretsPayload{}+ v.ProjectID = projectID+ v.Environment = environment++ return v, nil+}diff --git a/backend-go/internal/server/gen/http/secrets/client/client.go b/backend-go/internal/server/gen/http/secrets/client/client.gonew file mode 100644index 0000000000..110a6a3471--- /dev/null+++ b/backend-go/internal/server/gen/http/secrets/client/client.go@@ -0,0 +1,206 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets client HTTP transport+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++import (+ "context"+ "net/http"++ goahttp "goa.design/goa/v3/http"+ goa "goa.design/goa/v3/pkg"+)++// Client lists the secrets service endpoint HTTP clients.+type Client struct {+ // GetHealth Doer is the HTTP client used to make requests to the getHealth+ // endpoint.+ GetHealthDoer goahttp.Doer++ // CreateSecret Doer is the HTTP client used to make requests to the+ // createSecret endpoint.+ CreateSecretDoer goahttp.Doer++ // GetSecret Doer is the HTTP client used to make requests to the getSecret+ // endpoint.+ GetSecretDoer goahttp.Doer++ // UpdateSecret Doer is the HTTP client used to make requests to the+ // updateSecret endpoint.+ UpdateSecretDoer goahttp.Doer++ // DeleteSecret Doer is the HTTP client used to make requests to the+ // deleteSecret endpoint.+ DeleteSecretDoer goahttp.Doer++ // ListSecrets Doer is the HTTP client used to make requests to the listSecrets+ // endpoint.+ ListSecretsDoer goahttp.Doer++ // RestoreResponseBody controls whether the response bodies are reset after+ // decoding so they can be read again.+ RestoreResponseBody bool++ scheme string+ host string+ encoder func(*http.Request) goahttp.Encoder+ decoder func(*http.Response) goahttp.Decoder+}++// NewClient instantiates HTTP clients for all the secrets service servers.+func NewClient(+ scheme string,+ host string,+ doer goahttp.Doer,+ enc func(*http.Request) goahttp.Encoder,+ dec func(*http.Response) goahttp.Decoder,+ restoreBody bool,+) *Client {+ return &Client{+ GetHealthDoer: doer,+ CreateSecretDoer: doer,+ GetSecretDoer: doer,+ UpdateSecretDoer: doer,+ DeleteSecretDoer: doer,+ ListSecretsDoer: doer,+ RestoreResponseBody: restoreBody,+ scheme: scheme,+ host: host,+ decoder: dec,+ encoder: enc,+ }+}++// GetHealth returns an endpoint that makes HTTP requests to the secrets+// service getHealth server.+func (c *Client) GetHealth() goa.Endpoint {+ var (+ decodeResponse = DecodeGetHealthResponse(c.decoder, c.RestoreResponseBody)+ )+ return func(ctx context.Context, v any) (any, error) {+ req, err := c.BuildGetHealthRequest(ctx, v)+ if err != nil {+ return nil, err+ }+ resp, err := c.GetHealthDoer.Do(req)+ if err != nil {+ return nil, goahttp.ErrRequestError("secrets", "getHealth", err)+ }+ return decodeResponse(resp)+ }+}++// CreateSecret returns an endpoint that makes HTTP requests to the secrets+// service createSecret server.+func (c *Client) CreateSecret() goa.Endpoint {+ var (+ encodeRequest = EncodeCreateSecretRequest(c.encoder)+ decodeResponse = DecodeCreateSecretResponse(c.decoder, c.RestoreResponseBody)+ )+ return func(ctx context.Context, v any) (any, error) {+ req, err := c.BuildCreateSecretRequest(ctx, v)+ if err != nil {+ return nil, err+ }+ err = encodeRequest(req, v)+ if err != nil {+ return nil, err+ }+ resp, err := c.CreateSecretDoer.Do(req)+ if err != nil {+ return nil, goahttp.ErrRequestError("secrets", "createSecret", err)+ }+ return decodeResponse(resp)+ }+}++// GetSecret returns an endpoint that makes HTTP requests to the secrets+// service getSecret server.+func (c *Client) GetSecret() goa.Endpoint {+ var (+ decodeResponse = DecodeGetSecretResponse(c.decoder, c.RestoreResponseBody)+ )+ return func(ctx context.Context, v any) (any, error) {+ req, err := c.BuildGetSecretRequest(ctx, v)+ if err != nil {+ return nil, err+ }+ resp, err := c.GetSecretDoer.Do(req)+ if err != nil {+ return nil, goahttp.ErrRequestError("secrets", "getSecret", err)+ }+ return decodeResponse(resp)+ }+}++// UpdateSecret returns an endpoint that makes HTTP requests to the secrets+// service updateSecret server.+func (c *Client) UpdateSecret() goa.Endpoint {+ var (+ encodeRequest = EncodeUpdateSecretRequest(c.encoder)+ decodeResponse = DecodeUpdateSecretResponse(c.decoder, c.RestoreResponseBody)+ )+ return func(ctx context.Context, v any) (any, error) {+ req, err := c.BuildUpdateSecretRequest(ctx, v)+ if err != nil {+ return nil, err+ }+ err = encodeRequest(req, v)+ if err != nil {+ return nil, err+ }+ resp, err := c.UpdateSecretDoer.Do(req)+ if err != nil {+ return nil, goahttp.ErrRequestError("secrets", "updateSecret", err)+ }+ return decodeResponse(resp)+ }+}++// DeleteSecret returns an endpoint that makes HTTP requests to the secrets+// service deleteSecret server.+func (c *Client) DeleteSecret() goa.Endpoint {+ var (+ decodeResponse = DecodeDeleteSecretResponse(c.decoder, c.RestoreResponseBody)+ )+ return func(ctx context.Context, v any) (any, error) {+ req, err := c.BuildDeleteSecretRequest(ctx, v)+ if err != nil {+ return nil, err+ }+ resp, err := c.DeleteSecretDoer.Do(req)+ if err != nil {+ return nil, goahttp.ErrRequestError("secrets", "deleteSecret", err)+ }+ return decodeResponse(resp)+ }+}++// ListSecrets returns an endpoint that makes HTTP requests to the secrets+// service listSecrets server.+func (c *Client) ListSecrets() goa.Endpoint {+ var (+ encodeRequest = EncodeListSecretsRequest(c.encoder)+ decodeResponse = DecodeListSecretsResponse(c.decoder, c.RestoreResponseBody)+ )+ return func(ctx context.Context, v any) (any, error) {+ req, err := c.BuildListSecretsRequest(ctx, v)+ if err != nil {+ return nil, err+ }+ err = encodeRequest(req, v)+ if err != nil {+ return nil, err+ }+ resp, err := c.ListSecretsDoer.Do(req)+ if err != nil {+ return nil, goahttp.ErrRequestError("secrets", "listSecrets", err)+ }+ return decodeResponse(resp)+ }+}diff --git a/backend-go/internal/server/gen/http/secrets/client/encode_decode.go b/backend-go/internal/server/gen/http/secrets/client/encode_decode.gonew file mode 100644index 0000000000..7509ccfd8c--- /dev/null+++ b/backend-go/internal/server/gen/http/secrets/client/encode_decode.go@@ -0,0 +1,434 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets HTTP client encoders and decoders+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++import (+ "bytes"+ "context"+ "io"+ "net/http"+ "net/url"++ secrets "github.com/infisical/api/internal/server/gen/secrets"+ secretsviews "github.com/infisical/api/internal/server/gen/secrets/views"+ goahttp "goa.design/goa/v3/http"+)++// BuildGetHealthRequest instantiates a HTTP request object with method and+// path set to call the "secrets" service "getHealth" endpoint+func (c *Client) BuildGetHealthRequest(ctx context.Context, v any) (*http.Request, error) {+ u := &url.URL{Scheme: c.scheme, Host: c.host, Path: GetHealthSecretsPath()}+ req, err := http.NewRequest("GET", u.String(), nil)+ if err != nil {+ return nil, goahttp.ErrInvalidURL("secrets", "getHealth", u.String(), err)+ }+ if ctx != nil {+ req = req.WithContext(ctx)+ }++ return req, nil+}++// DecodeGetHealthResponse returns a decoder for responses returned by the+// secrets getHealth endpoint. restoreBody controls whether the response body+// should be restored after having been read.+func DecodeGetHealthResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {+ return func(resp *http.Response) (any, error) {+ if restoreBody {+ b, err := io.ReadAll(resp.Body)+ if err != nil {+ return nil, err+ }+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ defer func() {+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ }()+ } else {+ defer resp.Body.Close()+ }+ switch resp.StatusCode {+ case http.StatusOK:+ var (+ body string+ err error+ )+ err = decoder(resp).Decode(&body)+ if err != nil {+ return nil, goahttp.ErrDecodingError("secrets", "getHealth", err)+ }+ return body, nil+ default:+ body, _ := io.ReadAll(resp.Body)+ return nil, goahttp.ErrInvalidResponse("secrets", "getHealth", resp.StatusCode, string(body))+ }+ }+}++// BuildCreateSecretRequest instantiates a HTTP request object with method and+// path set to call the "secrets" service "createSecret" endpoint+func (c *Client) BuildCreateSecretRequest(ctx context.Context, v any) (*http.Request, error) {+ u := &url.URL{Scheme: c.scheme, Host: c.host, Path: CreateSecretSecretsPath()}+ req, err := http.NewRequest("POST", u.String(), nil)+ if err != nil {+ return nil, goahttp.ErrInvalidURL("secrets", "createSecret", u.String(), err)+ }+ if ctx != nil {+ req = req.WithContext(ctx)+ }++ return req, nil+}++// EncodeCreateSecretRequest returns an encoder for requests sent to the+// secrets createSecret server.+func EncodeCreateSecretRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error {+ return func(req *http.Request, v any) error {+ p, ok := v.(*secrets.Secret)+ if !ok {+ return goahttp.ErrInvalidType("secrets", "createSecret", "*secrets.Secret", v)+ }+ body := NewCreateSecretRequestBody(p)+ if err := encoder(req).Encode(&body); err != nil {+ return goahttp.ErrEncodingError("secrets", "createSecret", err)+ }+ return nil+ }+}++// DecodeCreateSecretResponse returns a decoder for responses returned by the+// secrets createSecret endpoint. restoreBody controls whether the response+// body should be restored after having been read.+func DecodeCreateSecretResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {+ return func(resp *http.Response) (any, error) {+ if restoreBody {+ b, err := io.ReadAll(resp.Body)+ if err != nil {+ return nil, err+ }+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ defer func() {+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ }()+ } else {+ defer resp.Body.Close()+ }+ switch resp.StatusCode {+ case http.StatusCreated:+ var (+ body CreateSecretResponseBody+ err error+ )+ err = decoder(resp).Decode(&body)+ if err != nil {+ return nil, goahttp.ErrDecodingError("secrets", "createSecret", err)+ }+ p := NewCreateSecretSecretResultCreated(&body)+ view := "default"+ vres := &secretsviews.SecretResult{Projected: p, View: view}+ if err = secretsviews.ValidateSecretResult(vres); err != nil {+ return nil, goahttp.ErrValidationError("secrets", "createSecret", err)+ }+ res := secrets.NewSecretResult(vres)+ return res, nil+ default:+ body, _ := io.ReadAll(resp.Body)+ return nil, goahttp.ErrInvalidResponse("secrets", "createSecret", resp.StatusCode, string(body))+ }+ }+}++// BuildGetSecretRequest instantiates a HTTP request object with method and+// path set to call the "secrets" service "getSecret" endpoint+func (c *Client) BuildGetSecretRequest(ctx context.Context, v any) (*http.Request, error) {+ var (+ id string+ )+ {+ p, ok := v.(*secrets.GetSecretPayload)+ if !ok {+ return nil, goahttp.ErrInvalidType("secrets", "getSecret", "*secrets.GetSecretPayload", v)+ }+ id = p.ID+ }+ u := &url.URL{Scheme: c.scheme, Host: c.host, Path: GetSecretSecretsPath(id)}+ req, err := http.NewRequest("GET", u.String(), nil)+ if err != nil {+ return nil, goahttp.ErrInvalidURL("secrets", "getSecret", u.String(), err)+ }+ if ctx != nil {+ req = req.WithContext(ctx)+ }++ return req, nil+}++// DecodeGetSecretResponse returns a decoder for responses returned by the+// secrets getSecret endpoint. restoreBody controls whether the response body+// should be restored after having been read.+func DecodeGetSecretResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {+ return func(resp *http.Response) (any, error) {+ if restoreBody {+ b, err := io.ReadAll(resp.Body)+ if err != nil {+ return nil, err+ }+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ defer func() {+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ }()+ } else {+ defer resp.Body.Close()+ }+ switch resp.StatusCode {+ case http.StatusOK:+ var (+ body GetSecretResponseBody+ err error+ )+ err = decoder(resp).Decode(&body)+ if err != nil {+ return nil, goahttp.ErrDecodingError("secrets", "getSecret", err)+ }+ p := NewGetSecretSecretResultOK(&body)+ view := "default"+ vres := &secretsviews.SecretResult{Projected: p, View: view}+ if err = secretsviews.ValidateSecretResult(vres); err != nil {+ return nil, goahttp.ErrValidationError("secrets", "getSecret", err)+ }+ res := secrets.NewSecretResult(vres)+ return res, nil+ default:+ body, _ := io.ReadAll(resp.Body)+ return nil, goahttp.ErrInvalidResponse("secrets", "getSecret", resp.StatusCode, string(body))+ }+ }+}++// BuildUpdateSecretRequest instantiates a HTTP request object with method and+// path set to call the "secrets" service "updateSecret" endpoint+func (c *Client) BuildUpdateSecretRequest(ctx context.Context, v any) (*http.Request, error) {+ var (+ id string+ )+ {+ p, ok := v.(*secrets.UpdateSecretPayload)+ if !ok {+ return nil, goahttp.ErrInvalidType("secrets", "updateSecret", "*secrets.UpdateSecretPayload", v)+ }+ id = p.ID+ }+ u := &url.URL{Scheme: c.scheme, Host: c.host, Path: UpdateSecretSecretsPath(id)}+ req, err := http.NewRequest("PATCH", u.String(), nil)+ if err != nil {+ return nil, goahttp.ErrInvalidURL("secrets", "updateSecret", u.String(), err)+ }+ if ctx != nil {+ req = req.WithContext(ctx)+ }++ return req, nil+}++// EncodeUpdateSecretRequest returns an encoder for requests sent to the+// secrets updateSecret server.+func EncodeUpdateSecretRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error {+ return func(req *http.Request, v any) error {+ p, ok := v.(*secrets.UpdateSecretPayload)+ if !ok {+ return goahttp.ErrInvalidType("secrets", "updateSecret", "*secrets.UpdateSecretPayload", v)+ }+ body := NewUpdateSecretRequestBody(p)+ if err := encoder(req).Encode(&body); err != nil {+ return goahttp.ErrEncodingError("secrets", "updateSecret", err)+ }+ return nil+ }+}++// DecodeUpdateSecretResponse returns a decoder for responses returned by the+// secrets updateSecret endpoint. restoreBody controls whether the response+// body should be restored after having been read.+func DecodeUpdateSecretResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {+ return func(resp *http.Response) (any, error) {+ if restoreBody {+ b, err := io.ReadAll(resp.Body)+ if err != nil {+ return nil, err+ }+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ defer func() {+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ }()+ } else {+ defer resp.Body.Close()+ }+ switch resp.StatusCode {+ case http.StatusOK:+ var (+ body UpdateSecretResponseBody+ err error+ )+ err = decoder(resp).Decode(&body)+ if err != nil {+ return nil, goahttp.ErrDecodingError("secrets", "updateSecret", err)+ }+ p := NewUpdateSecretSecretResultOK(&body)+ view := "default"+ vres := &secretsviews.SecretResult{Projected: p, View: view}+ if err = secretsviews.ValidateSecretResult(vres); err != nil {+ return nil, goahttp.ErrValidationError("secrets", "updateSecret", err)+ }+ res := secrets.NewSecretResult(vres)+ return res, nil+ default:+ body, _ := io.ReadAll(resp.Body)+ return nil, goahttp.ErrInvalidResponse("secrets", "updateSecret", resp.StatusCode, string(body))+ }+ }+}++// BuildDeleteSecretRequest instantiates a HTTP request object with method and+// path set to call the "secrets" service "deleteSecret" endpoint+func (c *Client) BuildDeleteSecretRequest(ctx context.Context, v any) (*http.Request, error) {+ var (+ id string+ )+ {+ p, ok := v.(*secrets.DeleteSecretPayload)+ if !ok {+ return nil, goahttp.ErrInvalidType("secrets", "deleteSecret", "*secrets.DeleteSecretPayload", v)+ }+ id = p.ID+ }+ u := &url.URL{Scheme: c.scheme, Host: c.host, Path: DeleteSecretSecretsPath(id)}+ req, err := http.NewRequest("DELETE", u.String(), nil)+ if err != nil {+ return nil, goahttp.ErrInvalidURL("secrets", "deleteSecret", u.String(), err)+ }+ if ctx != nil {+ req = req.WithContext(ctx)+ }++ return req, nil+}++// DecodeDeleteSecretResponse returns a decoder for responses returned by the+// secrets deleteSecret endpoint. restoreBody controls whether the response+// body should be restored after having been read.+func DecodeDeleteSecretResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {+ return func(resp *http.Response) (any, error) {+ if restoreBody {+ b, err := io.ReadAll(resp.Body)+ if err != nil {+ return nil, err+ }+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ defer func() {+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ }()+ } else {+ defer resp.Body.Close()+ }+ switch resp.StatusCode {+ case http.StatusNoContent:+ return nil, nil+ default:+ body, _ := io.ReadAll(resp.Body)+ return nil, goahttp.ErrInvalidResponse("secrets", "deleteSecret", resp.StatusCode, string(body))+ }+ }+}++// BuildListSecretsRequest instantiates a HTTP request object with method and+// path set to call the "secrets" service "listSecrets" endpoint+func (c *Client) BuildListSecretsRequest(ctx context.Context, v any) (*http.Request, error) {+ u := &url.URL{Scheme: c.scheme, Host: c.host, Path: ListSecretsSecretsPath()}+ req, err := http.NewRequest("GET", u.String(), nil)+ if err != nil {+ return nil, goahttp.ErrInvalidURL("secrets", "listSecrets", u.String(), err)+ }+ if ctx != nil {+ req = req.WithContext(ctx)+ }++ return req, nil+}++// EncodeListSecretsRequest returns an encoder for requests sent to the secrets+// listSecrets server.+func EncodeListSecretsRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error {+ return func(req *http.Request, v any) error {+ p, ok := v.(*secrets.ListSecretsPayload)+ if !ok {+ return goahttp.ErrInvalidType("secrets", "listSecrets", "*secrets.ListSecretsPayload", v)+ }+ values := req.URL.Query()+ values.Add("projectId", p.ProjectID)+ values.Add("environment", p.Environment)+ req.URL.RawQuery = values.Encode()+ return nil+ }+}++// DecodeListSecretsResponse returns a decoder for responses returned by the+// secrets listSecrets endpoint. restoreBody controls whether the response body+// should be restored after having been read.+func DecodeListSecretsResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {+ return func(resp *http.Response) (any, error) {+ if restoreBody {+ b, err := io.ReadAll(resp.Body)+ if err != nil {+ return nil, err+ }+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ defer func() {+ resp.Body = io.NopCloser(bytes.NewBuffer(b))+ }()+ } else {+ defer resp.Body.Close()+ }+ switch resp.StatusCode {+ case http.StatusOK:+ var (+ body ListSecretsResponseBody+ err error+ )+ err = decoder(resp).Decode(&body)+ if err != nil {+ return nil, goahttp.ErrDecodingError("secrets", "listSecrets", err)+ }+ p := NewListSecretsSecretResultCollectionOK(body)+ view := "default"+ vres := secretsviews.SecretResultCollection{Projected: p, View: view}+ if err = secretsviews.ValidateSecretResultCollection(vres); err != nil {+ return nil, goahttp.ErrValidationError("secrets", "listSecrets", err)+ }+ res := secrets.NewSecretResultCollection(vres)+ return res, nil+ default:+ body, _ := io.ReadAll(resp.Body)+ return nil, goahttp.ErrInvalidResponse("secrets", "listSecrets", resp.StatusCode, string(body))+ }+ }+}++// unmarshalSecretResultResponseToSecretsviewsSecretResultView builds a value+// of type *secretsviews.SecretResultView from a value of type+// *SecretResultResponse.+func unmarshalSecretResultResponseToSecretsviewsSecretResultView(v *SecretResultResponse) *secretsviews.SecretResultView {+ res := &secretsviews.SecretResultView{+ ID: v.ID,+ Key: v.Key,+ Value: v.Value,+ Environment: v.Environment,+ ProjectID: v.ProjectID,+ }++ return res+}diff --git a/backend-go/internal/server/gen/http/secrets/client/paths.go b/backend-go/internal/server/gen/http/secrets/client/paths.gonew file mode 100644index 0000000000..8bf9cb5521--- /dev/null+++ b/backend-go/internal/server/gen/http/secrets/client/paths.go@@ -0,0 +1,43 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// HTTP request path constructors for the secrets service.+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++import (+ "fmt"+)++// GetHealthSecretsPath returns the URL path to the secrets service getHealth HTTP endpoint.+func GetHealthSecretsPath() string {+ return "/api/v1/secret-manager/secrets/health"+}++// CreateSecretSecretsPath returns the URL path to the secrets service createSecret HTTP endpoint.+func CreateSecretSecretsPath() string {+ return "/api/v1/secret-manager/secrets"+}++// GetSecretSecretsPath returns the URL path to the secrets service getSecret HTTP endpoint.+func GetSecretSecretsPath(id string) string {+ return fmt.Sprintf("/api/v1/secret-manager/secrets/%v", id)+}++// UpdateSecretSecretsPath returns the URL path to the secrets service updateSecret HTTP endpoint.+func UpdateSecretSecretsPath(id string) string {+ return fmt.Sprintf("/api/v1/secret-manager/secrets/%v", id)+}++// DeleteSecretSecretsPath returns the URL path to the secrets service deleteSecret HTTP endpoint.+func DeleteSecretSecretsPath(id string) string {+ return fmt.Sprintf("/api/v1/secret-manager/secrets/%v", id)+}++// ListSecretsSecretsPath returns the URL path to the secrets service listSecrets HTTP endpoint.+func ListSecretsSecretsPath() string {+ return "/api/v1/secret-manager/secrets"+}diff --git a/backend-go/internal/server/gen/http/secrets/client/types.go b/backend-go/internal/server/gen/http/secrets/client/types.gonew file mode 100644index 0000000000..14436983ca--- /dev/null+++ b/backend-go/internal/server/gen/http/secrets/client/types.go@@ -0,0 +1,200 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets HTTP client types+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package client++import (+ secrets "github.com/infisical/api/internal/server/gen/secrets"+ secretsviews "github.com/infisical/api/internal/server/gen/secrets/views"+ goa "goa.design/goa/v3/pkg"+)++// CreateSecretRequestBody is the type of the "secrets" service "createSecret"+// endpoint HTTP request body.+type CreateSecretRequestBody struct {+ // Secret key+ Key string `form:"key" json:"key" xml:"key"`+ // Secret value+ Value string `form:"value" json:"value" xml:"value"`+ // Environment slug+ Environment string `form:"environment" json:"environment" xml:"environment"`+ // Project ID+ ProjectID string `form:"projectId" json:"projectId" xml:"projectId"`+}++// UpdateSecretRequestBody is the type of the "secrets" service "updateSecret"+// endpoint HTTP request body.+type UpdateSecretRequestBody struct {+ // Secret key+ Key *string `form:"key,omitempty" json:"key,omitempty" xml:"key,omitempty"`+ // Secret value+ Value *string `form:"value,omitempty" json:"value,omitempty" xml:"value,omitempty"`+}++// CreateSecretResponseBody is the type of the "secrets" service "createSecret"+// endpoint HTTP response body.+type CreateSecretResponseBody struct {+ // Secret ID+ ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`+ // Secret key+ Key *string `form:"key,omitempty" json:"key,omitempty" xml:"key,omitempty"`+ // Secret value+ Value *string `form:"value,omitempty" json:"value,omitempty" xml:"value,omitempty"`+ // Environment slug+ Environment *string `form:"environment,omitempty" json:"environment,omitempty" xml:"environment,omitempty"`+ // Project ID+ ProjectID *string `form:"projectId,omitempty" json:"projectId,omitempty" xml:"projectId,omitempty"`+}++// GetSecretResponseBody is the type of the "secrets" service "getSecret"+// endpoint HTTP response body.+type GetSecretResponseBody struct {+ // Secret ID+ ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`+ // Secret key+ Key *string `form:"key,omitempty" json:"key,omitempty" xml:"key,omitempty"`+ // Secret value+ Value *string `form:"value,omitempty" json:"value,omitempty" xml:"value,omitempty"`+ // Environment slug+ Environment *string `form:"environment,omitempty" json:"environment,omitempty" xml:"environment,omitempty"`+ // Project ID+ ProjectID *string `form:"projectId,omitempty" json:"projectId,omitempty" xml:"projectId,omitempty"`+}++// UpdateSecretResponseBody is the type of the "secrets" service "updateSecret"+// endpoint HTTP response body.+type UpdateSecretResponseBody struct {+ // Secret ID+ ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`+ // Secret key+ Key *string `form:"key,omitempty" json:"key,omitempty" xml:"key,omitempty"`+ // Secret value+ Value *string `form:"value,omitempty" json:"value,omitempty" xml:"value,omitempty"`+ // Environment slug+ Environment *string `form:"environment,omitempty" json:"environment,omitempty" xml:"environment,omitempty"`+ // Project ID+ ProjectID *string `form:"projectId,omitempty" json:"projectId,omitempty" xml:"projectId,omitempty"`+}++// ListSecretsResponseBody is the type of the "secrets" service "listSecrets"+// endpoint HTTP response body.+type ListSecretsResponseBody []*SecretResultResponse++// SecretResultResponse is used to define fields on response body types.+type SecretResultResponse struct {+ // Secret ID+ ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`+ // Secret key+ Key *string `form:"key,omitempty" json:"key,omitempty" xml:"key,omitempty"`+ // Secret value+ Value *string `form:"value,omitempty" json:"value,omitempty" xml:"value,omitempty"`+ // Environment slug+ Environment *string `form:"environment,omitempty" json:"environment,omitempty" xml:"environment,omitempty"`+ // Project ID+ ProjectID *string `form:"projectId,omitempty" json:"projectId,omitempty" xml:"projectId,omitempty"`+}++// NewCreateSecretRequestBody builds the HTTP request body from the payload of+// the "createSecret" endpoint of the "secrets" service.+func NewCreateSecretRequestBody(p *secrets.Secret) *CreateSecretRequestBody {+ body := &CreateSecretRequestBody{+ Key: p.Key,+ Value: p.Value,+ Environment: p.Environment,+ ProjectID: p.ProjectID,+ }+ return body+}++// NewUpdateSecretRequestBody builds the HTTP request body from the payload of+// the "updateSecret" endpoint of the "secrets" service.+func NewUpdateSecretRequestBody(p *secrets.UpdateSecretPayload) *UpdateSecretRequestBody {+ body := &UpdateSecretRequestBody{+ Key: p.Key,+ Value: p.Value,+ }+ return body+}++// NewCreateSecretSecretResultCreated builds a "secrets" service "createSecret"+// endpoint result from a HTTP "Created" response.+func NewCreateSecretSecretResultCreated(body *CreateSecretResponseBody) *secretsviews.SecretResultView {+ v := &secretsviews.SecretResultView{+ ID: body.ID,+ Key: body.Key,+ Value: body.Value,+ Environment: body.Environment,+ ProjectID: body.ProjectID,+ }++ return v+}++// NewGetSecretSecretResultOK builds a "secrets" service "getSecret" endpoint+// result from a HTTP "OK" response.+func NewGetSecretSecretResultOK(body *GetSecretResponseBody) *secretsviews.SecretResultView {+ v := &secretsviews.SecretResultView{+ ID: body.ID,+ Key: body.Key,+ Value: body.Value,+ Environment: body.Environment,+ ProjectID: body.ProjectID,+ }++ return v+}++// NewUpdateSecretSecretResultOK builds a "secrets" service "updateSecret"+// endpoint result from a HTTP "OK" response.+func NewUpdateSecretSecretResultOK(body *UpdateSecretResponseBody) *secretsviews.SecretResultView {+ v := &secretsviews.SecretResultView{+ ID: body.ID,+ Key: body.Key,+ Value: body.Value,+ Environment: body.Environment,+ ProjectID: body.ProjectID,+ }++ return v+}++// NewListSecretsSecretResultCollectionOK builds a "secrets" service+// "listSecrets" endpoint result from a HTTP "OK" response.+func NewListSecretsSecretResultCollectionOK(body ListSecretsResponseBody) secretsviews.SecretResultCollectionView {+ v := make([]*secretsviews.SecretResultView, len(body))+ for i, val := range body {+ if val == nil {+ v[i] = nil+ continue+ }+ v[i] = unmarshalSecretResultResponseToSecretsviewsSecretResultView(val)+ }++ return v+}++// ValidateSecretResultResponse runs the validations defined on+// SecretResultResponse+func ValidateSecretResultResponse(body *SecretResultResponse) (err error) {+ if body.ID == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("id", "body"))+ }+ if body.Key == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("key", "body"))+ }+ if body.Value == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("value", "body"))+ }+ if body.Environment == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("environment", "body"))+ }+ if body.ProjectID == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("projectId", "body"))+ }+ return+}diff --git a/backend-go/internal/server/gen/http/secrets/server/encode_decode.go b/backend-go/internal/server/gen/http/secrets/server/encode_decode.gonew file mode 100644index 0000000000..40f0e0fc2c--- /dev/null+++ b/backend-go/internal/server/gen/http/secrets/server/encode_decode.go@@ -0,0 +1,230 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets HTTP server encoders and decoders+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package server++import (+ "context"+ "errors"+ "io"+ "net/http"++ secrets "github.com/infisical/api/internal/server/gen/secrets"+ secretsviews "github.com/infisical/api/internal/server/gen/secrets/views"+ goahttp "goa.design/goa/v3/http"+ goa "goa.design/goa/v3/pkg"+)++// EncodeGetHealthResponse returns an encoder for responses returned by the+// secrets getHealth endpoint.+func EncodeGetHealthResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {+ return func(ctx context.Context, w http.ResponseWriter, v any) error {+ res, _ := v.(string)+ enc := encoder(ctx, w)+ body := res+ w.WriteHeader(http.StatusOK)+ return enc.Encode(body)+ }+}++// EncodeCreateSecretResponse returns an encoder for responses returned by the+// secrets createSecret endpoint.+func EncodeCreateSecretResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {+ return func(ctx context.Context, w http.ResponseWriter, v any) error {+ res := v.(*secretsviews.SecretResult)+ enc := encoder(ctx, w)+ body := NewCreateSecretResponseBody(res.Projected)+ w.WriteHeader(http.StatusCreated)+ return enc.Encode(body)+ }+}++// DecodeCreateSecretRequest returns a decoder for requests sent to the secrets+// createSecret endpoint.+func DecodeCreateSecretRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*secrets.Secret, error) {+ return func(r *http.Request) (*secrets.Secret, error) {+ var payload *secrets.Secret+ var (+ body CreateSecretRequestBody+ err error+ )+ err = decoder(r).Decode(&body)+ if err != nil {+ if errors.Is(err, io.EOF) {+ return payload, goa.MissingPayloadError()+ }+ var gerr *goa.ServiceError+ if errors.As(err, &gerr) {+ return payload, gerr+ }+ return payload, goa.DecodePayloadError(err.Error())+ }+ err = ValidateCreateSecretRequestBody(&body)+ if err != nil {+ return payload, err+ }+ payload = NewCreateSecretSecret(&body)++ return payload, nil+ }+}++// EncodeGetSecretResponse returns an encoder for responses returned by the+// secrets getSecret endpoint.+func EncodeGetSecretResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {+ return func(ctx context.Context, w http.ResponseWriter, v any) error {+ res := v.(*secretsviews.SecretResult)+ enc := encoder(ctx, w)+ body := NewGetSecretResponseBody(res.Projected)+ w.WriteHeader(http.StatusOK)+ return enc.Encode(body)+ }+}++// DecodeGetSecretRequest returns a decoder for requests sent to the secrets+// getSecret endpoint.+func DecodeGetSecretRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*secrets.GetSecretPayload, error) {+ return func(r *http.Request) (*secrets.GetSecretPayload, error) {+ var payload *secrets.GetSecretPayload+ var (+ id string++ params = mux.Vars(r)+ )+ id = params["id"]+ payload = NewGetSecretPayload(id)++ return payload, nil+ }+}++// EncodeUpdateSecretResponse returns an encoder for responses returned by the+// secrets updateSecret endpoint.+func EncodeUpdateSecretResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {+ return func(ctx context.Context, w http.ResponseWriter, v any) error {+ res := v.(*secretsviews.SecretResult)+ enc := encoder(ctx, w)+ body := NewUpdateSecretResponseBody(res.Projected)+ w.WriteHeader(http.StatusOK)+ return enc.Encode(body)+ }+}++// DecodeUpdateSecretRequest returns a decoder for requests sent to the secrets+// updateSecret endpoint.+func DecodeUpdateSecretRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*secrets.UpdateSecretPayload, error) {+ return func(r *http.Request) (*secrets.UpdateSecretPayload, error) {+ var payload *secrets.UpdateSecretPayload+ var (+ body UpdateSecretRequestBody+ err error+ )+ err = decoder(r).Decode(&body)+ if err != nil {+ if errors.Is(err, io.EOF) {+ return payload, goa.MissingPayloadError()+ }+ var gerr *goa.ServiceError+ if errors.As(err, &gerr) {+ return payload, gerr+ }+ return payload, goa.DecodePayloadError(err.Error())+ }++ var (+ id string++ params = mux.Vars(r)+ )+ id = params["id"]+ payload = NewUpdateSecretPayload(&body, id)++ return payload, nil+ }+}++// EncodeDeleteSecretResponse returns an encoder for responses returned by the+// secrets deleteSecret endpoint.+func EncodeDeleteSecretResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {+ return func(ctx context.Context, w http.ResponseWriter, v any) error {+ w.WriteHeader(http.StatusNoContent)+ return nil+ }+}++// DecodeDeleteSecretRequest returns a decoder for requests sent to the secrets+// deleteSecret endpoint.+func DecodeDeleteSecretRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*secrets.DeleteSecretPayload, error) {+ return func(r *http.Request) (*secrets.DeleteSecretPayload, error) {+ var payload *secrets.DeleteSecretPayload+ var (+ id string++ params = mux.Vars(r)+ )+ id = params["id"]+ payload = NewDeleteSecretPayload(id)++ return payload, nil+ }+}++// EncodeListSecretsResponse returns an encoder for responses returned by the+// secrets listSecrets endpoint.+func EncodeListSecretsResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {+ return func(ctx context.Context, w http.ResponseWriter, v any) error {+ res := v.(secretsviews.SecretResultCollection)+ enc := encoder(ctx, w)+ body := NewSecretResultResponseCollection(res.Projected)+ w.WriteHeader(http.StatusOK)+ return enc.Encode(body)+ }+}++// DecodeListSecretsRequest returns a decoder for requests sent to the secrets+// listSecrets endpoint.+func DecodeListSecretsRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*secrets.ListSecretsPayload, error) {+ return func(r *http.Request) (*secrets.ListSecretsPayload, error) {+ var payload *secrets.ListSecretsPayload+ var (+ projectID string+ environment string+ err error+ )+ qp := r.URL.Query()+ projectID = qp.Get("projectId")+ if projectID == "" {+ err = goa.MergeErrors(err, goa.MissingFieldError("projectId", "query string"))+ }+ environment = qp.Get("environment")+ if environment == "" {+ err = goa.MergeErrors(err, goa.MissingFieldError("environment", "query string"))+ }+ if err != nil {+ return payload, err+ }+ payload = NewListSecretsPayload(projectID, environment)++ return payload, nil+ }+}++// marshalSecretsviewsSecretResultViewToSecretResultResponse builds a value of+// type *SecretResultResponse from a value of type+// *secretsviews.SecretResultView.+func marshalSecretsviewsSecretResultViewToSecretResultResponse(v *secretsviews.SecretResultView) *SecretResultResponse {+ res := &SecretResultResponse{+ ID: *v.ID,+ Key: *v.Key,+ Value: *v.Value,+ Environment: *v.Environment,+ ProjectID: *v.ProjectID,+ }++ return res+}diff --git a/backend-go/internal/server/gen/http/secrets/server/paths.go b/backend-go/internal/server/gen/http/secrets/server/paths.gonew file mode 100644index 0000000000..1662515156--- /dev/null+++ b/backend-go/internal/server/gen/http/secrets/server/paths.go@@ -0,0 +1,43 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// HTTP request path constructors for the secrets service.+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package server++import (+ "fmt"+)++// GetHealthSecretsPath returns the URL path to the secrets service getHealth HTTP endpoint.+func GetHealthSecretsPath() string {+ return "/api/v1/secret-manager/secrets/health"+}++// CreateSecretSecretsPath returns the URL path to the secrets service createSecret HTTP endpoint.+func CreateSecretSecretsPath() string {+ return "/api/v1/secret-manager/secrets"+}++// GetSecretSecretsPath returns the URL path to the secrets service getSecret HTTP endpoint.+func GetSecretSecretsPath(id string) string {+ return fmt.Sprintf("/api/v1/secret-manager/secrets/%v", id)+}++// UpdateSecretSecretsPath returns the URL path to the secrets service updateSecret HTTP endpoint.+func UpdateSecretSecretsPath(id string) string {+ return fmt.Sprintf("/api/v1/secret-manager/secrets/%v", id)+}++// DeleteSecretSecretsPath returns the URL path to the secrets service deleteSecret HTTP endpoint.+func DeleteSecretSecretsPath(id string) string {+ return fmt.Sprintf("/api/v1/secret-manager/secrets/%v", id)+}++// ListSecretsSecretsPath returns the URL path to the secrets service listSecrets HTTP endpoint.+func ListSecretsSecretsPath() string {+ return "/api/v1/secret-manager/secrets"+}diff --git a/backend-go/internal/server/gen/http/secrets/server/server.go b/backend-go/internal/server/gen/http/secrets/server/server.gonew file mode 100644index 0000000000..5284424c05--- /dev/null+++ b/backend-go/internal/server/gen/http/secrets/server/server.go@@ -0,0 +1,414 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets HTTP server+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package server++import (+ "context"+ "net/http"++ secrets "github.com/infisical/api/internal/server/gen/secrets"+ goahttp "goa.design/goa/v3/http"+ goa "goa.design/goa/v3/pkg"+)++// Server lists the secrets service endpoint HTTP handlers.+type Server struct {+ Mounts []*MountPoint+ GetHealth http.Handler+ CreateSecret http.Handler+ GetSecret http.Handler+ UpdateSecret http.Handler+ DeleteSecret http.Handler+ ListSecrets http.Handler+}++// MountPoint holds information about the mounted endpoints.+type MountPoint struct {+ // Method is the name of the service method served by the mounted HTTP handler.+ Method string+ // Verb is the HTTP method used to match requests to the mounted handler.+ Verb string+ // Pattern is the HTTP request path pattern used to match requests to the+ // mounted handler.+ Pattern string+}++// New instantiates HTTP handlers for all the secrets service endpoints using+// the provided encoder and decoder. The handlers are mounted on the given mux+// using the HTTP verb and path defined in the design. errhandler is called+// whenever a response fails to be encoded. formatter is used to format errors+// returned by the service methods prior to encoding. Both errhandler and+// formatter are optional and can be nil.+func New(+ e *secrets.Endpoints,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) *Server {+ return &Server{+ Mounts: []*MountPoint{+ {"GetHealth", "GET", "/api/v1/secret-manager/secrets/health"},+ {"CreateSecret", "POST", "/api/v1/secret-manager/secrets"},+ {"GetSecret", "GET", "/api/v1/secret-manager/secrets/{id}"},+ {"UpdateSecret", "PATCH", "/api/v1/secret-manager/secrets/{id}"},+ {"DeleteSecret", "DELETE", "/api/v1/secret-manager/secrets/{id}"},+ {"ListSecrets", "GET", "/api/v1/secret-manager/secrets"},+ },+ GetHealth: NewGetHealthHandler(e.GetHealth, mux, decoder, encoder, errhandler, formatter),+ CreateSecret: NewCreateSecretHandler(e.CreateSecret, mux, decoder, encoder, errhandler, formatter),+ GetSecret: NewGetSecretHandler(e.GetSecret, mux, decoder, encoder, errhandler, formatter),+ UpdateSecret: NewUpdateSecretHandler(e.UpdateSecret, mux, decoder, encoder, errhandler, formatter),+ DeleteSecret: NewDeleteSecretHandler(e.DeleteSecret, mux, decoder, encoder, errhandler, formatter),+ ListSecrets: NewListSecretsHandler(e.ListSecrets, mux, decoder, encoder, errhandler, formatter),+ }+}++// Service returns the name of the service served.+func (s *Server) Service() string { return "secrets" }++// Use wraps the server handlers with the given middleware.+func (s *Server) Use(m func(http.Handler) http.Handler) {+ s.GetHealth = m(s.GetHealth)+ s.CreateSecret = m(s.CreateSecret)+ s.GetSecret = m(s.GetSecret)+ s.UpdateSecret = m(s.UpdateSecret)+ s.DeleteSecret = m(s.DeleteSecret)+ s.ListSecrets = m(s.ListSecrets)+}++// MethodNames returns the methods served.+func (s *Server) MethodNames() []string { return secrets.MethodNames[:] }++// Mount configures the mux to serve the secrets endpoints.+func Mount(mux goahttp.Muxer, h *Server) {+ MountGetHealthHandler(mux, h.GetHealth)+ MountCreateSecretHandler(mux, h.CreateSecret)+ MountGetSecretHandler(mux, h.GetSecret)+ MountUpdateSecretHandler(mux, h.UpdateSecret)+ MountDeleteSecretHandler(mux, h.DeleteSecret)+ MountListSecretsHandler(mux, h.ListSecrets)+}++// Mount configures the mux to serve the secrets endpoints.+func (s *Server) Mount(mux goahttp.Muxer) {+ Mount(mux, s)+}++// MountGetHealthHandler configures the mux to serve the "secrets" service+// "getHealth" endpoint.+func MountGetHealthHandler(mux goahttp.Muxer, h http.Handler) {+ f, ok := h.(http.HandlerFunc)+ if !ok {+ f = func(w http.ResponseWriter, r *http.Request) {+ h.ServeHTTP(w, r)+ }+ }+ mux.Handle("GET", "/api/v1/secret-manager/secrets/health", f)+}++// NewGetHealthHandler creates a HTTP handler which loads the HTTP request and+// calls the "secrets" service "getHealth" endpoint.+func NewGetHealthHandler(+ endpoint goa.Endpoint,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) http.Handler {+ var (+ encodeResponse = EncodeGetHealthResponse(encoder)+ encodeError = goahttp.ErrorEncoder(encoder, formatter)+ )+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept"))+ ctx = context.WithValue(ctx, goa.MethodKey, "getHealth")+ ctx = context.WithValue(ctx, goa.ServiceKey, "secrets")+ var err error+ res, err := endpoint(ctx, nil)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ if err := encodeResponse(ctx, w, res); err != nil {+ if errhandler != nil {+ errhandler(ctx, w, err)+ }+ }+ })+}++// MountCreateSecretHandler configures the mux to serve the "secrets" service+// "createSecret" endpoint.+func MountCreateSecretHandler(mux goahttp.Muxer, h http.Handler) {+ f, ok := h.(http.HandlerFunc)+ if !ok {+ f = func(w http.ResponseWriter, r *http.Request) {+ h.ServeHTTP(w, r)+ }+ }+ mux.Handle("POST", "/api/v1/secret-manager/secrets", f)+}++// NewCreateSecretHandler creates a HTTP handler which loads the HTTP request+// and calls the "secrets" service "createSecret" endpoint.+func NewCreateSecretHandler(+ endpoint goa.Endpoint,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) http.Handler {+ var (+ decodeRequest = DecodeCreateSecretRequest(mux, decoder)+ encodeResponse = EncodeCreateSecretResponse(encoder)+ encodeError = goahttp.ErrorEncoder(encoder, formatter)+ )+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept"))+ ctx = context.WithValue(ctx, goa.MethodKey, "createSecret")+ ctx = context.WithValue(ctx, goa.ServiceKey, "secrets")+ payload, err := decodeRequest(r)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ res, err := endpoint(ctx, payload)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ if err := encodeResponse(ctx, w, res); err != nil {+ if errhandler != nil {+ errhandler(ctx, w, err)+ }+ }+ })+}++// MountGetSecretHandler configures the mux to serve the "secrets" service+// "getSecret" endpoint.+func MountGetSecretHandler(mux goahttp.Muxer, h http.Handler) {+ f, ok := h.(http.HandlerFunc)+ if !ok {+ f = func(w http.ResponseWriter, r *http.Request) {+ h.ServeHTTP(w, r)+ }+ }+ mux.Handle("GET", "/api/v1/secret-manager/secrets/{id}", f)+}++// NewGetSecretHandler creates a HTTP handler which loads the HTTP request and+// calls the "secrets" service "getSecret" endpoint.+func NewGetSecretHandler(+ endpoint goa.Endpoint,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) http.Handler {+ var (+ decodeRequest = DecodeGetSecretRequest(mux, decoder)+ encodeResponse = EncodeGetSecretResponse(encoder)+ encodeError = goahttp.ErrorEncoder(encoder, formatter)+ )+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept"))+ ctx = context.WithValue(ctx, goa.MethodKey, "getSecret")+ ctx = context.WithValue(ctx, goa.ServiceKey, "secrets")+ payload, err := decodeRequest(r)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ res, err := endpoint(ctx, payload)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ if err := encodeResponse(ctx, w, res); err != nil {+ if errhandler != nil {+ errhandler(ctx, w, err)+ }+ }+ })+}++// MountUpdateSecretHandler configures the mux to serve the "secrets" service+// "updateSecret" endpoint.+func MountUpdateSecretHandler(mux goahttp.Muxer, h http.Handler) {+ f, ok := h.(http.HandlerFunc)+ if !ok {+ f = func(w http.ResponseWriter, r *http.Request) {+ h.ServeHTTP(w, r)+ }+ }+ mux.Handle("PATCH", "/api/v1/secret-manager/secrets/{id}", f)+}++// NewUpdateSecretHandler creates a HTTP handler which loads the HTTP request+// and calls the "secrets" service "updateSecret" endpoint.+func NewUpdateSecretHandler(+ endpoint goa.Endpoint,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) http.Handler {+ var (+ decodeRequest = DecodeUpdateSecretRequest(mux, decoder)+ encodeResponse = EncodeUpdateSecretResponse(encoder)+ encodeError = goahttp.ErrorEncoder(encoder, formatter)+ )+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept"))+ ctx = context.WithValue(ctx, goa.MethodKey, "updateSecret")+ ctx = context.WithValue(ctx, goa.ServiceKey, "secrets")+ payload, err := decodeRequest(r)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ res, err := endpoint(ctx, payload)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ if err := encodeResponse(ctx, w, res); err != nil {+ if errhandler != nil {+ errhandler(ctx, w, err)+ }+ }+ })+}++// MountDeleteSecretHandler configures the mux to serve the "secrets" service+// "deleteSecret" endpoint.+func MountDeleteSecretHandler(mux goahttp.Muxer, h http.Handler) {+ f, ok := h.(http.HandlerFunc)+ if !ok {+ f = func(w http.ResponseWriter, r *http.Request) {+ h.ServeHTTP(w, r)+ }+ }+ mux.Handle("DELETE", "/api/v1/secret-manager/secrets/{id}", f)+}++// NewDeleteSecretHandler creates a HTTP handler which loads the HTTP request+// and calls the "secrets" service "deleteSecret" endpoint.+func NewDeleteSecretHandler(+ endpoint goa.Endpoint,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) http.Handler {+ var (+ decodeRequest = DecodeDeleteSecretRequest(mux, decoder)+ encodeResponse = EncodeDeleteSecretResponse(encoder)+ encodeError = goahttp.ErrorEncoder(encoder, formatter)+ )+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept"))+ ctx = context.WithValue(ctx, goa.MethodKey, "deleteSecret")+ ctx = context.WithValue(ctx, goa.ServiceKey, "secrets")+ payload, err := decodeRequest(r)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ res, err := endpoint(ctx, payload)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ if err := encodeResponse(ctx, w, res); err != nil {+ if errhandler != nil {+ errhandler(ctx, w, err)+ }+ }+ })+}++// MountListSecretsHandler configures the mux to serve the "secrets" service+// "listSecrets" endpoint.+func MountListSecretsHandler(mux goahttp.Muxer, h http.Handler) {+ f, ok := h.(http.HandlerFunc)+ if !ok {+ f = func(w http.ResponseWriter, r *http.Request) {+ h.ServeHTTP(w, r)+ }+ }+ mux.Handle("GET", "/api/v1/secret-manager/secrets", f)+}++// NewListSecretsHandler creates a HTTP handler which loads the HTTP request+// and calls the "secrets" service "listSecrets" endpoint.+func NewListSecretsHandler(+ endpoint goa.Endpoint,+ mux goahttp.Muxer,+ decoder func(*http.Request) goahttp.Decoder,+ encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,+ errhandler func(context.Context, http.ResponseWriter, error),+ formatter func(ctx context.Context, err error) goahttp.Statuser,+) http.Handler {+ var (+ decodeRequest = DecodeListSecretsRequest(mux, decoder)+ encodeResponse = EncodeListSecretsResponse(encoder)+ encodeError = goahttp.ErrorEncoder(encoder, formatter)+ )+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ ctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get("Accept"))+ ctx = context.WithValue(ctx, goa.MethodKey, "listSecrets")+ ctx = context.WithValue(ctx, goa.ServiceKey, "secrets")+ payload, err := decodeRequest(r)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ res, err := endpoint(ctx, payload)+ if err != nil {+ if err := encodeError(ctx, w, err); err != nil && errhandler != nil {+ errhandler(ctx, w, err)+ }+ return+ }+ if err := encodeResponse(ctx, w, res); err != nil {+ if errhandler != nil {+ errhandler(ctx, w, err)+ }+ }+ })+}diff --git a/backend-go/internal/server/gen/http/secrets/server/types.go b/backend-go/internal/server/gen/http/secrets/server/types.gonew file mode 100644index 0000000000..079217d93a--- /dev/null+++ b/backend-go/internal/server/gen/http/secrets/server/types.go@@ -0,0 +1,221 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets HTTP server types+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package server++import (+ secrets "github.com/infisical/api/internal/server/gen/secrets"+ secretsviews "github.com/infisical/api/internal/server/gen/secrets/views"+ goa "goa.design/goa/v3/pkg"+)++// CreateSecretRequestBody is the type of the "secrets" service "createSecret"+// endpoint HTTP request body.+type CreateSecretRequestBody struct {+ // Secret key+ Key *string `form:"key,omitempty" json:"key,omitempty" xml:"key,omitempty"`+ // Secret value+ Value *string `form:"value,omitempty" json:"value,omitempty" xml:"value,omitempty"`+ // Environment slug+ Environment *string `form:"environment,omitempty" json:"environment,omitempty" xml:"environment,omitempty"`+ // Project ID+ ProjectID *string `form:"projectId,omitempty" json:"projectId,omitempty" xml:"projectId,omitempty"`+}++// UpdateSecretRequestBody is the type of the "secrets" service "updateSecret"+// endpoint HTTP request body.+type UpdateSecretRequestBody struct {+ // Secret key+ Key *string `form:"key,omitempty" json:"key,omitempty" xml:"key,omitempty"`+ // Secret value+ Value *string `form:"value,omitempty" json:"value,omitempty" xml:"value,omitempty"`+}++// CreateSecretResponseBody is the type of the "secrets" service "createSecret"+// endpoint HTTP response body.+type CreateSecretResponseBody struct {+ // Secret ID+ ID string `form:"id" json:"id" xml:"id"`+ // Secret key+ Key string `form:"key" json:"key" xml:"key"`+ // Secret value+ Value string `form:"value" json:"value" xml:"value"`+ // Environment slug+ Environment string `form:"environment" json:"environment" xml:"environment"`+ // Project ID+ ProjectID string `form:"projectId" json:"projectId" xml:"projectId"`+}++// GetSecretResponseBody is the type of the "secrets" service "getSecret"+// endpoint HTTP response body.+type GetSecretResponseBody struct {+ // Secret ID+ ID string `form:"id" json:"id" xml:"id"`+ // Secret key+ Key string `form:"key" json:"key" xml:"key"`+ // Secret value+ Value string `form:"value" json:"value" xml:"value"`+ // Environment slug+ Environment string `form:"environment" json:"environment" xml:"environment"`+ // Project ID+ ProjectID string `form:"projectId" json:"projectId" xml:"projectId"`+}++// UpdateSecretResponseBody is the type of the "secrets" service "updateSecret"+// endpoint HTTP response body.+type UpdateSecretResponseBody struct {+ // Secret ID+ ID string `form:"id" json:"id" xml:"id"`+ // Secret key+ Key string `form:"key" json:"key" xml:"key"`+ // Secret value+ Value string `form:"value" json:"value" xml:"value"`+ // Environment slug+ Environment string `form:"environment" json:"environment" xml:"environment"`+ // Project ID+ ProjectID string `form:"projectId" json:"projectId" xml:"projectId"`+}++// SecretResultResponseCollection is the type of the "secrets" service+// "listSecrets" endpoint HTTP response body.+type SecretResultResponseCollection []*SecretResultResponse++// SecretResultResponse is used to define fields on response body types.+type SecretResultResponse struct {+ // Secret ID+ ID string `form:"id" json:"id" xml:"id"`+ // Secret key+ Key string `form:"key" json:"key" xml:"key"`+ // Secret value+ Value string `form:"value" json:"value" xml:"value"`+ // Environment slug+ Environment string `form:"environment" json:"environment" xml:"environment"`+ // Project ID+ ProjectID string `form:"projectId" json:"projectId" xml:"projectId"`+}++// NewCreateSecretResponseBody builds the HTTP response body from the result of+// the "createSecret" endpoint of the "secrets" service.+func NewCreateSecretResponseBody(res *secretsviews.SecretResultView) *CreateSecretResponseBody {+ body := &CreateSecretResponseBody{+ ID: *res.ID,+ Key: *res.Key,+ Value: *res.Value,+ Environment: *res.Environment,+ ProjectID: *res.ProjectID,+ }+ return body+}++// NewGetSecretResponseBody builds the HTTP response body from the result of+// the "getSecret" endpoint of the "secrets" service.+func NewGetSecretResponseBody(res *secretsviews.SecretResultView) *GetSecretResponseBody {+ body := &GetSecretResponseBody{+ ID: *res.ID,+ Key: *res.Key,+ Value: *res.Value,+ Environment: *res.Environment,+ ProjectID: *res.ProjectID,+ }+ return body+}++// NewUpdateSecretResponseBody builds the HTTP response body from the result of+// the "updateSecret" endpoint of the "secrets" service.+func NewUpdateSecretResponseBody(res *secretsviews.SecretResultView) *UpdateSecretResponseBody {+ body := &UpdateSecretResponseBody{+ ID: *res.ID,+ Key: *res.Key,+ Value: *res.Value,+ Environment: *res.Environment,+ ProjectID: *res.ProjectID,+ }+ return body+}++// NewSecretResultResponseCollection builds the HTTP response body from the+// result of the "listSecrets" endpoint of the "secrets" service.+func NewSecretResultResponseCollection(res secretsviews.SecretResultCollectionView) SecretResultResponseCollection {+ body := make([]*SecretResultResponse, len(res))+ for i, val := range res {+ if val == nil {+ body[i] = nil+ continue+ }+ body[i] = marshalSecretsviewsSecretResultViewToSecretResultResponse(val)+ }+ return body+}++// NewCreateSecretSecret builds a secrets service createSecret endpoint payload.+func NewCreateSecretSecret(body *CreateSecretRequestBody) *secrets.Secret {+ v := &secrets.Secret{+ Key: *body.Key,+ Value: *body.Value,+ Environment: *body.Environment,+ ProjectID: *body.ProjectID,+ }++ return v+}++// NewGetSecretPayload builds a secrets service getSecret endpoint payload.+func NewGetSecretPayload(id string) *secrets.GetSecretPayload {+ v := &secrets.GetSecretPayload{}+ v.ID = id++ return v+}++// NewUpdateSecretPayload builds a secrets service updateSecret endpoint+// payload.+func NewUpdateSecretPayload(body *UpdateSecretRequestBody, id string) *secrets.UpdateSecretPayload {+ v := &secrets.UpdateSecretPayload{+ Key: body.Key,+ Value: body.Value,+ }+ v.ID = id++ return v+}++// NewDeleteSecretPayload builds a secrets service deleteSecret endpoint+// payload.+func NewDeleteSecretPayload(id string) *secrets.DeleteSecretPayload {+ v := &secrets.DeleteSecretPayload{}+ v.ID = id++ return v+}++// NewListSecretsPayload builds a secrets service listSecrets endpoint payload.+func NewListSecretsPayload(projectID string, environment string) *secrets.ListSecretsPayload {+ v := &secrets.ListSecretsPayload{}+ v.ProjectID = projectID+ v.Environment = environment++ return v+}++// ValidateCreateSecretRequestBody runs the validations defined on+// CreateSecretRequestBody+func ValidateCreateSecretRequestBody(body *CreateSecretRequestBody) (err error) {+ if body.Key == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("key", "body"))+ }+ if body.Value == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("value", "body"))+ }+ if body.Environment == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("environment", "body"))+ }+ if body.ProjectID == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("projectId", "body"))+ }+ return+}diff --git a/backend-go/internal/server/gen/projects/client.go b/backend-go/internal/server/gen/projects/client.gonew file mode 100644index 0000000000..a1a7b78aaf--- /dev/null+++ b/backend-go/internal/server/gen/projects/client.go@@ -0,0 +1,49 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects client+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package projects++import (+ "context"++ goa "goa.design/goa/v3/pkg"+)++// Client is the "projects" service client.+type Client struct {+ GetHealthEndpoint goa.Endpoint+ CreateProjectEndpoint goa.Endpoint+}++// NewClient initializes a "projects" service client given the endpoints.+func NewClient(getHealth, createProject goa.Endpoint) *Client {+ return &Client{+ GetHealthEndpoint: getHealth,+ CreateProjectEndpoint: createProject,+ }+}++// GetHealth calls the "getHealth" endpoint of the "projects" service.+func (c *Client) GetHealth(ctx context.Context) (res string, err error) {+ var ires any+ ires, err = c.GetHealthEndpoint(ctx, nil)+ if err != nil {+ return+ }+ return ires.(string), nil+}++// CreateProject calls the "createProject" endpoint of the "projects" service.+func (c *Client) CreateProject(ctx context.Context, p *CreateProjectPayload) (res *ProjectResult, err error) {+ var ires any+ ires, err = c.CreateProjectEndpoint(ctx, p)+ if err != nil {+ return+ }+ return ires.(*ProjectResult), nil+}diff --git a/backend-go/internal/server/gen/projects/endpoints.go b/backend-go/internal/server/gen/projects/endpoints.gonew file mode 100644index 0000000000..2a99a992e2--- /dev/null+++ b/backend-go/internal/server/gen/projects/endpoints.go@@ -0,0 +1,57 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects endpoints+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package projects++import (+ "context"++ goa "goa.design/goa/v3/pkg"+)++// Endpoints wraps the "projects" service endpoints.+type Endpoints struct {+ GetHealth goa.Endpoint+ CreateProject goa.Endpoint+}++// NewEndpoints wraps the methods of the "projects" service with endpoints.+func NewEndpoints(s Service) *Endpoints {+ return &Endpoints{+ GetHealth: NewGetHealthEndpoint(s),+ CreateProject: NewCreateProjectEndpoint(s),+ }+}++// Use applies the given middleware to all the "projects" service endpoints.+func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint) {+ e.GetHealth = m(e.GetHealth)+ e.CreateProject = m(e.CreateProject)+}++// NewGetHealthEndpoint returns an endpoint function that calls the method+// "getHealth" of service "projects".+func NewGetHealthEndpoint(s Service) goa.Endpoint {+ return func(ctx context.Context, req any) (any, error) {+ return s.GetHealth(ctx)+ }+}++// NewCreateProjectEndpoint returns an endpoint function that calls the method+// "createProject" of service "projects".+func NewCreateProjectEndpoint(s Service) goa.Endpoint {+ return func(ctx context.Context, req any) (any, error) {+ p := req.(*CreateProjectPayload)+ res, err := s.CreateProject(ctx, p)+ if err != nil {+ return nil, err+ }+ vres := NewViewedProjectResult(res, "default")+ return vres, nil+ }+}diff --git a/backend-go/internal/server/gen/projects/service.go b/backend-go/internal/server/gen/projects/service.gonew file mode 100644index 0000000000..055924fdeb--- /dev/null+++ b/backend-go/internal/server/gen/projects/service.go@@ -0,0 +1,99 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects service+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package projects++import (+ "context"++ projectsviews "github.com/infisical/api/internal/server/gen/projects/views"+)++// Service for managing projects.+type Service interface {+ // Health check for the projects service.+ GetHealth(context.Context) (res string, err error)+ // Create a new project.+ CreateProject(context.Context, *CreateProjectPayload) (res *ProjectResult, err error)+}++// APIName is the name of the API as defined in the design.+const APIName = "infisical"++// APIVersion is the version of the API as defined in the design.+const APIVersion = "0.0.1"++// ServiceName is the name of the service as defined in the design. This is the+// same value that is set in the endpoint request contexts under the ServiceKey+// key.+const ServiceName = "projects"++// MethodNames lists the service method names as defined in the design. These+// are the same values that are set in the endpoint request contexts under the+// MethodKey key.+var MethodNames = [2]string{"getHealth", "createProject"}++// CreateProjectPayload is the payload type of the projects service+// createProject method.+type CreateProjectPayload struct {+ // Project name+ Name string+ // Organization ID+ OrgID string+}++// ProjectResult is the result type of the projects service createProject+// method.+type ProjectResult struct {+ // Project ID+ ID string+ // Project name+ Name string+ // Organization ID+ OrgID string+}++// NewProjectResult initializes result type ProjectResult from viewed result+// type ProjectResult.+func NewProjectResult(vres *projectsviews.ProjectResult) *ProjectResult {+ return newProjectResult(vres.Projected)+}++// NewViewedProjectResult initializes viewed result type ProjectResult from+// result type ProjectResult using the given view.+func NewViewedProjectResult(res *ProjectResult, view string) *projectsviews.ProjectResult {+ p := newProjectResultView(res)+ return &projectsviews.ProjectResult{Projected: p, View: "default"}+}++// newProjectResult converts projected type ProjectResult to service type+// ProjectResult.+func newProjectResult(vres *projectsviews.ProjectResultView) *ProjectResult {+ res := &ProjectResult{}+ if vres.ID != nil {+ res.ID = *vres.ID+ }+ if vres.Name != nil {+ res.Name = *vres.Name+ }+ if vres.OrgID != nil {+ res.OrgID = *vres.OrgID+ }+ return res+}++// newProjectResultView projects result type ProjectResult to projected type+// ProjectResultView using the "default" view.+func newProjectResultView(res *ProjectResult) *projectsviews.ProjectResultView {+ vres := &projectsviews.ProjectResultView{+ ID: &res.ID,+ Name: &res.Name,+ OrgID: &res.OrgID,+ }+ return vres+}diff --git a/backend-go/internal/server/gen/projects/views/view.go b/backend-go/internal/server/gen/projects/views/view.gonew file mode 100644index 0000000000..f9d2422e26--- /dev/null+++ b/backend-go/internal/server/gen/projects/views/view.go@@ -0,0 +1,70 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// projects views+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package views++import (+ goa "goa.design/goa/v3/pkg"+)++// ProjectResult is the viewed result type that is projected based on a view.+type ProjectResult struct {+ // Type to project+ Projected *ProjectResultView+ // View to render+ View string+}++// ProjectResultView is a type that runs validations on a projected type.+type ProjectResultView struct {+ // Project ID+ ID *string+ // Project name+ Name *string+ // Organization ID+ OrgID *string+}++var (+ // ProjectResultMap is a map indexing the attribute names of ProjectResult by+ // view name.+ ProjectResultMap = map[string][]string{+ "default": {+ "id",+ "name",+ "orgId",+ },+ }+)++// ValidateProjectResult runs the validations defined on the viewed result type+// ProjectResult.+func ValidateProjectResult(result *ProjectResult) (err error) {+ switch result.View {+ case "default", "":+ err = ValidateProjectResultView(result.Projected)+ default:+ err = goa.InvalidEnumValueError("view", result.View, []any{"default"})+ }+ return+}++// ValidateProjectResultView runs the validations defined on ProjectResultView+// using the "default" view.+func ValidateProjectResultView(result *ProjectResultView) (err error) {+ if result.ID == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("id", "result"))+ }+ if result.Name == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("name", "result"))+ }+ if result.OrgID == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("orgId", "result"))+ }+ return+}diff --git a/backend-go/internal/server/gen/secrets/client.go b/backend-go/internal/server/gen/secrets/client.gonew file mode 100644index 0000000000..00ffec8561--- /dev/null+++ b/backend-go/internal/server/gen/secrets/client.go@@ -0,0 +1,93 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets client+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package secrets++import (+ "context"++ goa "goa.design/goa/v3/pkg"+)++// Client is the "secrets" service client.+type Client struct {+ GetHealthEndpoint goa.Endpoint+ CreateSecretEndpoint goa.Endpoint+ GetSecretEndpoint goa.Endpoint+ UpdateSecretEndpoint goa.Endpoint+ DeleteSecretEndpoint goa.Endpoint+ ListSecretsEndpoint goa.Endpoint+}++// NewClient initializes a "secrets" service client given the endpoints.+func NewClient(getHealth, createSecret, getSecret, updateSecret, deleteSecret, listSecrets goa.Endpoint) *Client {+ return &Client{+ GetHealthEndpoint: getHealth,+ CreateSecretEndpoint: createSecret,+ GetSecretEndpoint: getSecret,+ UpdateSecretEndpoint: updateSecret,+ DeleteSecretEndpoint: deleteSecret,+ ListSecretsEndpoint: listSecrets,+ }+}++// GetHealth calls the "getHealth" endpoint of the "secrets" service.+func (c *Client) GetHealth(ctx context.Context) (res string, err error) {+ var ires any+ ires, err = c.GetHealthEndpoint(ctx, nil)+ if err != nil {+ return+ }+ return ires.(string), nil+}++// CreateSecret calls the "createSecret" endpoint of the "secrets" service.+func (c *Client) CreateSecret(ctx context.Context, p *Secret) (res *SecretResult, err error) {+ var ires any+ ires, err = c.CreateSecretEndpoint(ctx, p)+ if err != nil {+ return+ }+ return ires.(*SecretResult), nil+}++// GetSecret calls the "getSecret" endpoint of the "secrets" service.+func (c *Client) GetSecret(ctx context.Context, p *GetSecretPayload) (res *SecretResult, err error) {+ var ires any+ ires, err = c.GetSecretEndpoint(ctx, p)+ if err != nil {+ return+ }+ return ires.(*SecretResult), nil+}++// UpdateSecret calls the "updateSecret" endpoint of the "secrets" service.+func (c *Client) UpdateSecret(ctx context.Context, p *UpdateSecretPayload) (res *SecretResult, err error) {+ var ires any+ ires, err = c.UpdateSecretEndpoint(ctx, p)+ if err != nil {+ return+ }+ return ires.(*SecretResult), nil+}++// DeleteSecret calls the "deleteSecret" endpoint of the "secrets" service.+func (c *Client) DeleteSecret(ctx context.Context, p *DeleteSecretPayload) (err error) {+ _, err = c.DeleteSecretEndpoint(ctx, p)+ return+}++// ListSecrets calls the "listSecrets" endpoint of the "secrets" service.+func (c *Client) ListSecrets(ctx context.Context, p *ListSecretsPayload) (res SecretResultCollection, err error) {+ var ires any+ ires, err = c.ListSecretsEndpoint(ctx, p)+ if err != nil {+ return+ }+ return ires.(SecretResultCollection), nil+}diff --git a/backend-go/internal/server/gen/secrets/endpoints.go b/backend-go/internal/server/gen/secrets/endpoints.gonew file mode 100644index 0000000000..51b3e742b9--- /dev/null+++ b/backend-go/internal/server/gen/secrets/endpoints.go@@ -0,0 +1,120 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets endpoints+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package secrets++import (+ "context"++ goa "goa.design/goa/v3/pkg"+)++// Endpoints wraps the "secrets" service endpoints.+type Endpoints struct {+ GetHealth goa.Endpoint+ CreateSecret goa.Endpoint+ GetSecret goa.Endpoint+ UpdateSecret goa.Endpoint+ DeleteSecret goa.Endpoint+ ListSecrets goa.Endpoint+}++// NewEndpoints wraps the methods of the "secrets" service with endpoints.+func NewEndpoints(s Service) *Endpoints {+ return &Endpoints{+ GetHealth: NewGetHealthEndpoint(s),+ CreateSecret: NewCreateSecretEndpoint(s),+ GetSecret: NewGetSecretEndpoint(s),+ UpdateSecret: NewUpdateSecretEndpoint(s),+ DeleteSecret: NewDeleteSecretEndpoint(s),+ ListSecrets: NewListSecretsEndpoint(s),+ }+}++// Use applies the given middleware to all the "secrets" service endpoints.+func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint) {+ e.GetHealth = m(e.GetHealth)+ e.CreateSecret = m(e.CreateSecret)+ e.GetSecret = m(e.GetSecret)+ e.UpdateSecret = m(e.UpdateSecret)+ e.DeleteSecret = m(e.DeleteSecret)+ e.ListSecrets = m(e.ListSecrets)+}++// NewGetHealthEndpoint returns an endpoint function that calls the method+// "getHealth" of service "secrets".+func NewGetHealthEndpoint(s Service) goa.Endpoint {+ return func(ctx context.Context, req any) (any, error) {+ return s.GetHealth(ctx)+ }+}++// NewCreateSecretEndpoint returns an endpoint function that calls the method+// "createSecret" of service "secrets".+func NewCreateSecretEndpoint(s Service) goa.Endpoint {+ return func(ctx context.Context, req any) (any, error) {+ p := req.(*Secret)+ res, err := s.CreateSecret(ctx, p)+ if err != nil {+ return nil, err+ }+ vres := NewViewedSecretResult(res, "default")+ return vres, nil+ }+}++// NewGetSecretEndpoint returns an endpoint function that calls the method+// "getSecret" of service "secrets".+func NewGetSecretEndpoint(s Service) goa.Endpoint {+ return func(ctx context.Context, req any) (any, error) {+ p := req.(*GetSecretPayload)+ res, err := s.GetSecret(ctx, p)+ if err != nil {+ return nil, err+ }+ vres := NewViewedSecretResult(res, "default")+ return vres, nil+ }+}++// NewUpdateSecretEndpoint returns an endpoint function that calls the method+// "updateSecret" of service "secrets".+func NewUpdateSecretEndpoint(s Service) goa.Endpoint {+ return func(ctx context.Context, req any) (any, error) {+ p := req.(*UpdateSecretPayload)+ res, err := s.UpdateSecret(ctx, p)+ if err != nil {+ return nil, err+ }+ vres := NewViewedSecretResult(res, "default")+ return vres, nil+ }+}++// NewDeleteSecretEndpoint returns an endpoint function that calls the method+// "deleteSecret" of service "secrets".+func NewDeleteSecretEndpoint(s Service) goa.Endpoint {+ return func(ctx context.Context, req any) (any, error) {+ p := req.(*DeleteSecretPayload)+ return nil, s.DeleteSecret(ctx, p)+ }+}++// NewListSecretsEndpoint returns an endpoint function that calls the method+// "listSecrets" of service "secrets".+func NewListSecretsEndpoint(s Service) goa.Endpoint {+ return func(ctx context.Context, req any) (any, error) {+ p := req.(*ListSecretsPayload)+ res, err := s.ListSecrets(ctx, p)+ if err != nil {+ return nil, err+ }+ vres := NewViewedSecretResultCollection(res, "default")+ return vres, nil+ }+}diff --git a/backend-go/internal/server/gen/secrets/service.go b/backend-go/internal/server/gen/secrets/service.gonew file mode 100644index 0000000000..a6335c93ec--- /dev/null+++ b/backend-go/internal/server/gen/secrets/service.go@@ -0,0 +1,192 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets service+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package secrets++import (+ "context"++ secretsviews "github.com/infisical/api/internal/server/gen/secrets/views"+)++// Service for managing secrets.+type Service interface {+ // Health check for the secrets service.+ GetHealth(context.Context) (res string, err error)+ // Create a new secret.+ CreateSecret(context.Context, *Secret) (res *SecretResult, err error)+ // Get a secret by ID.+ GetSecret(context.Context, *GetSecretPayload) (res *SecretResult, err error)+ // Update an existing secret.+ UpdateSecret(context.Context, *UpdateSecretPayload) (res *SecretResult, err error)+ // Delete a secret by ID.+ DeleteSecret(context.Context, *DeleteSecretPayload) (err error)+ // List secrets for an environment.+ ListSecrets(context.Context, *ListSecretsPayload) (res SecretResultCollection, err error)+}++// APIName is the name of the API as defined in the design.+const APIName = "infisical"++// APIVersion is the version of the API as defined in the design.+const APIVersion = "0.0.1"++// ServiceName is the name of the service as defined in the design. This is the+// same value that is set in the endpoint request contexts under the ServiceKey+// key.+const ServiceName = "secrets"++// MethodNames lists the service method names as defined in the design. These+// are the same values that are set in the endpoint request contexts under the+// MethodKey key.+var MethodNames = [6]string{"getHealth", "createSecret", "getSecret", "updateSecret", "deleteSecret", "listSecrets"}++// DeleteSecretPayload is the payload type of the secrets service deleteSecret+// method.+type DeleteSecretPayload struct {+ // Secret ID+ ID string+}++// GetSecretPayload is the payload type of the secrets service getSecret method.+type GetSecretPayload struct {+ // Secret ID+ ID string+}++// ListSecretsPayload is the payload type of the secrets service listSecrets+// method.+type ListSecretsPayload struct {+ // Project ID+ ProjectID string+ // Environment slug+ Environment string+}++// Secret is the payload type of the secrets service createSecret method.+type Secret struct {+ // Secret key+ Key string+ // Secret value+ Value string+ // Environment slug+ Environment string+ // Project ID+ ProjectID string+}++// SecretResult is the result type of the secrets service createSecret method.+type SecretResult struct {+ // Secret ID+ ID string+ // Secret key+ Key string+ // Secret value+ Value string+ // Environment slug+ Environment string+ // Project ID+ ProjectID string+}++// SecretResultCollection is the result type of the secrets service listSecrets+// method.+type SecretResultCollection []*SecretResult++// UpdateSecretPayload is the payload type of the secrets service updateSecret+// method.+type UpdateSecretPayload struct {+ // Secret ID+ ID string+ // Secret key+ Key *string+ // Secret value+ Value *string+}++// NewSecretResult initializes result type SecretResult from viewed result type+// SecretResult.+func NewSecretResult(vres *secretsviews.SecretResult) *SecretResult {+ return newSecretResult(vres.Projected)+}++// NewViewedSecretResult initializes viewed result type SecretResult from+// result type SecretResult using the given view.+func NewViewedSecretResult(res *SecretResult, view string) *secretsviews.SecretResult {+ p := newSecretResultView(res)+ return &secretsviews.SecretResult{Projected: p, View: "default"}+}++// NewSecretResultCollection initializes result type SecretResultCollection+// from viewed result type SecretResultCollection.+func NewSecretResultCollection(vres secretsviews.SecretResultCollection) SecretResultCollection {+ return newSecretResultCollection(vres.Projected)+}++// NewViewedSecretResultCollection initializes viewed result type+// SecretResultCollection from result type SecretResultCollection using the+// given view.+func NewViewedSecretResultCollection(res SecretResultCollection, view string) secretsviews.SecretResultCollection {+ p := newSecretResultCollectionView(res)+ return secretsviews.SecretResultCollection{Projected: p, View: "default"}+}++// newSecretResult converts projected type SecretResult to service type+// SecretResult.+func newSecretResult(vres *secretsviews.SecretResultView) *SecretResult {+ res := &SecretResult{}+ if vres.ID != nil {+ res.ID = *vres.ID+ }+ if vres.Key != nil {+ res.Key = *vres.Key+ }+ if vres.Value != nil {+ res.Value = *vres.Value+ }+ if vres.Environment != nil {+ res.Environment = *vres.Environment+ }+ if vres.ProjectID != nil {+ res.ProjectID = *vres.ProjectID+ }+ return res+}++// newSecretResultView projects result type SecretResult to projected type+// SecretResultView using the "default" view.+func newSecretResultView(res *SecretResult) *secretsviews.SecretResultView {+ vres := &secretsviews.SecretResultView{+ ID: &res.ID,+ Key: &res.Key,+ Value: &res.Value,+ Environment: &res.Environment,+ ProjectID: &res.ProjectID,+ }+ return vres+}++// newSecretResultCollection converts projected type SecretResultCollection to+// service type SecretResultCollection.+func newSecretResultCollection(vres secretsviews.SecretResultCollectionView) SecretResultCollection {+ res := make(SecretResultCollection, len(vres))+ for i, n := range vres {+ res[i] = newSecretResult(n)+ }+ return res+}++// newSecretResultCollectionView projects result type SecretResultCollection to+// projected type SecretResultCollectionView using the "default" view.+func newSecretResultCollectionView(res SecretResultCollection) secretsviews.SecretResultCollectionView {+ vres := make(secretsviews.SecretResultCollectionView, len(res))+ for i, n := range res {+ vres[i] = newSecretResultView(n)+ }+ return vres+}diff --git a/backend-go/internal/server/gen/secrets/views/view.go b/backend-go/internal/server/gen/secrets/views/view.gonew file mode 100644index 0000000000..df56868025--- /dev/null+++ b/backend-go/internal/server/gen/secrets/views/view.go@@ -0,0 +1,129 @@+// Code generated by goa v3.25.3, DO NOT EDIT.+//+// secrets views+//+// Command:+// $ goa gen github.com/infisical/api/internal/server/design -o+// ./internal/server/++package views++import (+ goa "goa.design/goa/v3/pkg"+)++// SecretResult is the viewed result type that is projected based on a view.+type SecretResult struct {+ // Type to project+ Projected *SecretResultView+ // View to render+ View string+}++// SecretResultCollection is the viewed result type that is projected based on+// a view.+type SecretResultCollection struct {+ // Type to project+ Projected SecretResultCollectionView+ // View to render+ View string+}++// SecretResultView is a type that runs validations on a projected type.+type SecretResultView struct {+ // Secret ID+ ID *string+ // Secret key+ Key *string+ // Secret value+ Value *string+ // Environment slug+ Environment *string+ // Project ID+ ProjectID *string+}++// SecretResultCollectionView is a type that runs validations on a projected+// type.+type SecretResultCollectionView []*SecretResultView++var (+ // SecretResultMap is a map indexing the attribute names of SecretResult by+ // view name.+ SecretResultMap = map[string][]string{+ "default": {+ "id",+ "key",+ "value",+ "environment",+ "projectId",+ },+ }+ // SecretResultCollectionMap is a map indexing the attribute names of+ // SecretResultCollection by view name.+ SecretResultCollectionMap = map[string][]string{+ "default": {+ "id",+ "key",+ "value",+ "environment",+ "projectId",+ },+ }+)++// ValidateSecretResult runs the validations defined on the viewed result type+// SecretResult.+func ValidateSecretResult(result *SecretResult) (err error) {+ switch result.View {+ case "default", "":+ err = ValidateSecretResultView(result.Projected)+ default:+ err = goa.InvalidEnumValueError("view", result.View, []any{"default"})+ }+ return+}++// ValidateSecretResultCollection runs the validations defined on the viewed+// result type SecretResultCollection.+func ValidateSecretResultCollection(result SecretResultCollection) (err error) {+ switch result.View {+ case "default", "":+ err = ValidateSecretResultCollectionView(result.Projected)+ default:+ err = goa.InvalidEnumValueError("view", result.View, []any{"default"})+ }+ return+}++// ValidateSecretResultView runs the validations defined on SecretResultView+// using the "default" view.+func ValidateSecretResultView(result *SecretResultView) (err error) {+ if result.ID == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("id", "result"))+ }+ if result.Key == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("key", "result"))+ }+ if result.Value == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("value", "result"))+ }+ if result.Environment == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("environment", "result"))+ }+ if result.ProjectID == nil {+ err = goa.MergeErrors(err, goa.MissingFieldError("projectId", "result"))+ }+ return+}++// ValidateSecretResultCollectionView runs the validations defined on+// SecretResultCollectionView using the "default" view.+func ValidateSecretResultCollectionView(result SecretResultCollectionView) (err error) {+ for _, item := range result {+ if err2 := ValidateSecretResultView(item); err2 != nil {+ err = goa.MergeErrors(err, err2)+ }+ }+ return+}diff --git a/backend-go/internal/server/platform.go b/backend-go/internal/server/platform.gonew file mode 100644index 0000000000..664390936a--- /dev/null+++ b/backend-go/internal/server/platform.go@@ -0,0 +1,15 @@+package server++import (+ projectssvr "github.com/infisical/api/internal/server/gen/http/projects/server"+ genprojects "github.com/infisical/api/internal/server/gen/projects"+)++func (s *Server) mountPlatform() {+ projectsEndpoints := genprojects.NewEndpoints(s.svc.Platform.Projects)+ projectsServer := projectssvr.New(projectsEndpoints, s.mux, s.dec, s.enc, s.eh, nil)+ projectssvr.Mount(s.mux, projectsServer)+ for _, mount := range projectsServer.Mounts {+ s.logger.Info("route mounted", "method", mount.Method, "verb", mount.Verb, "pattern", mount.Pattern)+ }+}diff --git a/backend-go/internal/server/secretmanager.go b/backend-go/internal/server/secretmanager.gonew file mode 100644index 0000000000..0df5ac6649--- /dev/null+++ b/backend-go/internal/server/secretmanager.go@@ -0,0 +1,15 @@+package server++import (+ secretssvr "github.com/infisical/api/internal/server/gen/http/secrets/server"+ gensecrets "github.com/infisical/api/internal/server/gen/secrets"+)++func (s *Server) mountSecretManager() {+ secretsEndpoints := gensecrets.NewEndpoints(s.svc.SecretManager.Secrets)+ secretsServer := secretssvr.New(secretsEndpoints, s.mux, s.dec, s.enc, s.eh, nil)+ secretssvr.Mount(s.mux, secretsServer)+ for _, mount := range secretsServer.Mounts {+ s.logger.Info("route mounted", "method", mount.Method, "verb", mount.Verb, "pattern", mount.Pattern)+ }+}diff --git a/backend-go/internal/server/server.go b/backend-go/internal/server/server.gonew file mode 100644index 0000000000..899ab4e41a--- /dev/null+++ b/backend-go/internal/server/server.go@@ -0,0 +1,82 @@+package server++import (+ "context"+ "log/slog"+ "net/http"+ "sync"+ "time"++ "github.com/infisical/api/internal/services"+ goahttp "goa.design/goa/v3/http"+)++type Server struct {+ svc *services.Service+ logger *slog.Logger+ mux goahttp.Muxer+ dec func(*http.Request) goahttp.Decoder+ enc func(context.Context, http.ResponseWriter) goahttp.Encoder+ eh func(context.Context, http.ResponseWriter, error)+}++func NewServer(svc *services.Service, logger *slog.Logger) *Server {+ s := &Server{+ svc: svc,+ logger: logger,+ mux: goahttp.NewMuxer(),+ dec: goahttp.RequestDecoder,+ enc: goahttp.ResponseEncoder,+ }+ s.eh = func(ctx context.Context, w http.ResponseWriter, err error) {+ logger.ErrorContext(ctx, "server error", "error", err)+ }++ s.mountPlatform()+ s.mountSecretManager()++ return s+}++func (s *Server) Listen(ctx context.Context, addr string, wg *sync.WaitGroup, errc chan error) {+ var handler http.Handler = requestLogger(s.mux, s.logger)++ srv := &http.Server{+ Addr: addr,+ Handler: handler,+ ReadHeaderTimeout: 60 * time.Second,+ }++ wg.Add(1)+ go func() {+ defer wg.Done()++ go func() {+ s.logger.Info("HTTP server listening", "addr", addr)+ errc <- srv.ListenAndServe()+ }()++ <-ctx.Done()+ s.logger.Info("shutting down HTTP server", "addr", addr)++ shutdownCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)+ defer cancel()++ if err := srv.Shutdown(shutdownCtx); err != nil {+ s.logger.Error("HTTP server shutdown error", "error", err)+ }+ }()+}++func requestLogger(next http.Handler, logger *slog.Logger) http.Handler {+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ start := time.Now()+ next.ServeHTTP(w, r)+ logger.Info("request",+ "method", r.Method,+ "path", r.URL.Path,+ "duration", time.Since(start).String(),+ "remote", r.RemoteAddr,+ )+ })+}diff --git a/backend-go/internal/services/platform/platform.go b/backend-go/internal/services/platform/platform.gonew file mode 100644index 0000000000..e48c8cfdb3--- /dev/null+++ b/backend-go/internal/services/platform/platform.go@@ -0,0 +1,19 @@+package platform++import (+ "log/slog"++ genprojects "github.com/infisical/api/internal/server/gen/projects"+ "github.com/infisical/api/internal/services/platform/projects"+)++type Service struct {+ Projects genprojects.Service+}++func NewService(logger *slog.Logger) *Service {+ l := logger.With("product", "platform")+ return &Service{+ Projects: projects.NewService(l),+ }+}diff --git a/backend-go/internal/services/platform/projects/projects.go b/backend-go/internal/services/platform/projects/projects.gonew file mode 100644index 0000000000..c77b227193--- /dev/null+++ b/backend-go/internal/services/platform/projects/projects.go@@ -0,0 +1,32 @@+package projects++import (+ "context"+ "log/slog"++ genprojects "github.com/infisical/api/internal/server/gen/projects"+)++type service struct {+ logger *slog.Logger+}++func NewService(logger *slog.Logger) genprojects.Service {+ return &service{+ logger: logger.With("service", "projects"),+ }+}++func (s *service) GetHealth(ctx context.Context) (string, error) {+ s.logger.InfoContext(ctx, "health check")+ return "projects service is healthy", nil+}++func (s *service) CreateProject(ctx context.Context, p *genprojects.CreateProjectPayload) (*genprojects.ProjectResult, error) {+ s.logger.InfoContext(ctx, "creating project", "name", p.Name)+ return &genprojects.ProjectResult{+ ID: "generated-id",+ Name: p.Name,+ OrgID: p.OrgID,+ }, nil+}diff --git a/backend-go/internal/services/secretmanager/secretmanager.go b/backend-go/internal/services/secretmanager/secretmanager.gonew file mode 100644index 0000000000..ead4cca08e--- /dev/null+++ b/backend-go/internal/services/secretmanager/secretmanager.go@@ -0,0 +1,19 @@+package secretmanager++import (+ "log/slog"++ gensecrets "github.com/infisical/api/internal/server/gen/secrets"+ "github.com/infisical/api/internal/services/secretmanager/secrets"+)++type Service struct {+ Secrets gensecrets.Service+}++func NewService(logger *slog.Logger) *Service {+ l := logger.With("product", "secretmanager")+ return &Service{+ Secrets: secrets.NewService(l),+ }+}diff --git a/backend-go/internal/services/secretmanager/secrets/secrets.go b/backend-go/internal/services/secretmanager/secrets/secrets.gonew file mode 100644index 0000000000..834a909684--- /dev/null+++ b/backend-go/internal/services/secretmanager/secrets/secrets.go@@ -0,0 +1,54 @@+package secrets++import (+ "context"+ "log/slog"++ gensecrets "github.com/infisical/api/internal/server/gen/secrets"+)++type service struct {+ logger *slog.Logger+}++func NewService(logger *slog.Logger) gensecrets.Service {+ return &service{+ logger: logger.With("service", "secrets"),+ }+}++func (s *service) GetHealth(ctx context.Context) (string, error) {+ s.logger.InfoContext(ctx, "health check")+ return "secrets service is healthy", nil+}++func (s *service) CreateSecret(ctx context.Context, p *gensecrets.Secret) (*gensecrets.SecretResult, error) {+ s.logger.InfoContext(ctx, "creating secret", "key", p.Key)+ return &gensecrets.SecretResult{+ ID: "generated-id",+ Key: p.Key,+ Value: p.Value,+ Environment: p.Environment,+ ProjectID: p.ProjectID,+ }, nil+}++func (s *service) GetSecret(ctx context.Context, p *gensecrets.GetSecretPayload) (*gensecrets.SecretResult, error) {+ s.logger.InfoContext(ctx, "getting secret", "id", p.ID)+ return &gensecrets.SecretResult{ID: p.ID, Key: "stub", Value: "stub", Environment: "dev", ProjectID: "proj-1"}, nil+}++func (s *service) UpdateSecret(ctx context.Context, p *gensecrets.UpdateSecretPayload) (*gensecrets.SecretResult, error) {+ s.logger.InfoContext(ctx, "updating secret", "id", p.ID)+ return &gensecrets.SecretResult{ID: p.ID, Key: "updated", Value: "updated", Environment: "dev", ProjectID: "proj-1"}, nil+}++func (s *service) DeleteSecret(ctx context.Context, p *gensecrets.DeleteSecretPayload) error {+ s.logger.InfoContext(ctx, "deleting secret", "id", p.ID)+ return nil+}++func (s *service) ListSecrets(ctx context.Context, p *gensecrets.ListSecretsPayload) (gensecrets.SecretResultCollection, error) {+ s.logger.InfoContext(ctx, "listing secrets", "projectId", p.ProjectID, "env", p.Environment)+ return gensecrets.SecretResultCollection{}, nil+}diff --git a/backend-go/internal/services/services.go b/backend-go/internal/services/services.gonew file mode 100644index 0000000000..7c18e2671f--- /dev/null+++ b/backend-go/internal/services/services.go@@ -0,0 +1,20 @@+package services++import (+ "log/slog"++ "github.com/infisical/api/internal/services/platform"+ "github.com/infisical/api/internal/services/secretmanager"+)++type Service struct {+ Platform *platform.Service+ SecretManager *secretmanager.Service+}++func NewService(logger *slog.Logger) *Service {+ return &Service{+ Platform: platform.NewService(logger),+ SecretManager: secretmanager.NewService(logger),+ }+}