diff --git a/charts/console-backend-rbac/templates/rbac.yaml b/charts/console-backend-rbac/templates/rbac.yaml index 715aa0e95..79d7840d3 100644 --- a/charts/console-backend-rbac/templates/rbac.yaml +++ b/charts/console-backend-rbac/templates/rbac.yaml @@ -119,6 +119,13 @@ rules: - update - patch - delete + - apiGroups: + - "nais.io" + resources: + - postgresaccesses + verbs: + - get + - create - apiGroups: - "aiven.nais.io" resources: @@ -273,6 +280,13 @@ rules: - get - list - watch + - apiGroups: + - "nais.io" + resources: + - postgresaccesses + verbs: + - get + - create - apiGroups: - "" resources: diff --git a/integration_tests/create_postgres_access.lua b/integration_tests/create_postgres_access.lua new file mode 100644 index 000000000..15cb4119f --- /dev/null +++ b/integration_tests/create_postgres_access.lua @@ -0,0 +1,311 @@ +local user = User.new("user", "user@usersen.com") +local otherMemberUser = User.new("othermember", "othermember@usersen.com") +local nonMemberUser = User.new("nonmember", "other@user.com") + +local mainTeam = Team.new("someteamname", "purpose", "#slack_channel") +mainTeam:addMember(user) +mainTeam:addMember(otherMemberUser) + +Helper.readK8sResources("k8s_resources/create_postgres_access") + +Test.gql("Create personal postgres access without authorization", function(t) + t.addHeader("x-user-email", nonMemberUser:email()) + t.query [[ + mutation CreatePostgresAccess { + createPostgresAccess(input: { + postgresInstance: "foobar" + environmentName: "dev" + teamSlug: "someteamname" + accessLevel: READ + clientWireGuardPublicKey: "client-public-key" + reason: "Testing personal database access" + }) { + name + expiresAt + } + } + ]] + + t.check { + errors = { + { + locations = NotNull(), + message = Contains('you need the "postgres:access:grant" authorization.'), + path = { "createPostgresAccess" }, + }, + }, + data = Null, + } +end) + +Test.gql("Create personal postgres access requires an audit reason", function(t) + t.addHeader("x-user-email", user:email()) + t.query [[ + mutation CreatePostgresAccess { + createPostgresAccess(input: { + postgresInstance: "foobar" + environmentName: "dev" + teamSlug: "someteamname" + accessLevel: READ + clientWireGuardPublicKey: "client-public-key" + reason: "short" + }) { + name + } + } + ]] + + t.check { + errors = { + { + extensions = { field = "reason" }, + message = Contains("Reason must be at least 10 characters"), + path = { "createPostgresAccess" }, + }, + }, + data = Null, + } +end) + +Test.gql("Create personal postgres access rejects an unknown instance", function(t) + t.addHeader("x-user-email", user:email()) + t.query [[ + mutation CreatePostgresAccess { + createPostgresAccess(input: { + postgresInstance: "unknown" + environmentName: "dev" + teamSlug: "someteamname" + accessLevel: READ + clientWireGuardPublicKey: "client-public-key" + reason: "Testing personal database access" + }) { + name + expiresAt + } + } + ]] + + t.check { + errors = { + { + extensions = { field = "postgresInstance" }, + message = Contains("Could not find postgres cluster"), + path = { "createPostgresAccess" }, + }, + }, + data = Null, + } +end) + +Test.gql("Create personal postgres access rejects an unavailable instance", function(t) + t.addHeader("x-user-email", user:email()) + t.query [[ + mutation CreatePostgresAccess { + createPostgresAccess(input: { + postgresInstance: "progressing" + environmentName: "dev" + teamSlug: "someteamname" + accessLevel: READ + clientWireGuardPublicKey: "client-public-key" + reason: "Testing personal database access" + }) { + name + expiresAt + } + } + ]] + + t.check { + errors = { + { + extensions = { field = "postgresInstance" }, + message = Contains("is not available"), + path = { "createPostgresAccess" }, + }, + }, + data = Null, + } +end) + +Test.gql("Create personal postgres access", function(t) + t.addHeader("x-user-email", user:email()) + t.query [[ + mutation CreatePostgresAccess { + createPostgresAccess(input: { + postgresInstance: "foobar" + environmentName: "dev" + teamSlug: "someteamname" + accessLevel: READWRITE + clientWireGuardPublicKey: "client-public-key" + reason: "Testing personal database access" + ttl: "2h" + }) { + name + expiresAt + } + } + ]] + + t.check { + data = { + createPostgresAccess = { + name = NotNull(), + expiresAt = NotNull(), + }, + }, + } +end) + +Test.gql("Personal postgres access is audited as a self-grant", function(t) + t.addHeader("x-user-email", user:email()) + t.query [[ + { + team(slug: "someteamname") { + activityLog { + nodes { + message + ... on PostgresPersonalAccessCreatedActivityLogEntry { + data { + username + expiresAt + reason + } + } + } + } + } + } + ]] + + t.check { + data = { + team = { + activityLog = { + nodes = { + { + message = Contains("Created personal Postgres access for user@usersen.com"), + data = { + username = "user@usersen.com", + expiresAt = NotNull(), + reason = "Testing personal database access", + }, + }, + }, + }, + }, + }, + } +end) + +Test.gql("PostgresAccess status is visible to authorized team members", function(t) + t.addHeader("x-user-email", otherMemberUser:email()) + for _, test in ipairs({ + { name = "ready-access", state = "READY", message = "Database role and tunnel are ready" }, + { name = "pending-access", state = "PENDING", message = Null }, + { name = "failed-access", state = "FAILED", message = Contains("not supported") }, + { name = "expired-access", state = "EXPIRED", message = "access has expired" }, + }) do + t.query(string.format( + [[query { postgresAccess(name: "%s", teamSlug: "someteamname", environmentName: "dev") { name state message } }]], + test.name)) + t.check { + data = { + postgresAccess = { + name = test.name, + state = test.state, + message = test.message, + }, + }, + } + end +end) + +Test.gql("PostgresAccess status rejects users outside the team", function(t) + t.addHeader("x-user-email", nonMemberUser:email()) + t.query [[ + query { postgresAccess(name: "ready-access", teamSlug: "someteamname", environmentName: "dev") { state } } + ]] + t.check { + errors = { + { + locations = NotNull(), + message = Contains('you need the "postgres:access:grant" authorization.'), + path = { "postgresAccess" }, + }, + }, + data = Null, + } +end) + +Test.gql("PostgresAccess connection returns credentials only to its owner", function(t) + t.addHeader("x-user-email", user:email()) + t.query [[ + query GetPostgresAccessConnection { + postgresAccessConnection(input: {name: "ready-access", teamSlug: "someteamname", environmentName: "dev"}) { + password + caCertificate + serverName + tunnel { + endpoint + gatewayPublicKey + } + } + } + ]] + + t.check { + data = { + postgresAccessConnection = { + password = "supersecret", + caCertificate = "test-ca-certificate", + serverName = "pg-foobar-rw.someteamname.svc.cluster.local", + tunnel = { endpoint = "1.2.3.4:12345", gatewayPublicKey = "gw-public-key" }, + }, + }, + } +end) + +Test.gql("PostgresAccess connection rejects a different team member", function(t) + t.addHeader("x-user-email", otherMemberUser:email()) + t.query [[ + query { postgresAccessConnection(input: {name: "ready-access", teamSlug: "someteamname", environmentName: "dev"}) { password } } + ]] + t.check { + errors = { { locations = NotNull(), path = { "postgresAccessConnection" }, message = Contains("not authorized") } }, + data = Null, + } +end) + +Test.gql("PostgresAccess connection rejects expired, unready, and missing-secret access", function(t) + t.addHeader("x-user-email", user:email()) + for _, test in ipairs({ + { name = "expired-access", message = "has expired" }, + { name = "pending-access", message = "is not ready" }, + { name = "missing-secret-access", message = "credentials" }, + }) do + t.query(string.format( + [[query { postgresAccessConnection(input: {name: "%s", teamSlug: "someteamname", environmentName: "dev"}) { password } }]], + test.name)) + t.check { + errors = { { locations = NotNull(), path = { "postgresAccessConnection" }, message = Contains(test.message) } }, + data = Null, + } + end +end) + +Test.gql("Personal postgres connection retrieval is audited", function(t) + t.addHeader("x-user-email", user:email()) + t.query [[ + query { postgresAccessConnection(input: {name: "ready-access", teamSlug: "someteamname", environmentName: "dev"}) { password } } + ]] + t.check { data = { postgresAccessConnection = { password = "supersecret" } } } + + t.query [[ + { team(slug: "someteamname") { activityLog(first: 1) { nodes { message ... on PostgresPersonalAccessConnectionActivityLogEntry { resourceName } } } } } + ]] + t.check { + data = { team = { activityLog = { nodes = { + { message = Contains("Retrieved personal Postgres connection materials"), resourceName = "ready-access" }, + } } } }, + } +end) diff --git a/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_expired-access.yaml b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_expired-access.yaml new file mode 100644 index 000000000..0e3b15701 --- /dev/null +++ b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_expired-access.yaml @@ -0,0 +1,20 @@ +apiVersion: nais.io/v1 +kind: PostgresAccess +metadata: + name: expired-access + namespace: someteamname +spec: + postgresInstance: foobar + username: user@usersen.com + accessLevel: read + expiresAt: "2000-01-01T00:00:00Z" + clientWireGuardPublicKey: client-public-key +status: + credentialSecretName: expired-access-credentials + serverName: pg-foobar-rw.someteamname.svc.cluster.local + conditions: + - type: Ready + status: "True" + tunnel: + endpoint: "1.2.3.4:12345" + gatewayPublicKey: gw-public-key diff --git a/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_failed-access.yaml b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_failed-access.yaml new file mode 100644 index 000000000..144463575 --- /dev/null +++ b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_failed-access.yaml @@ -0,0 +1,17 @@ +apiVersion: nais.io/v1 +kind: PostgresAccess +metadata: + name: failed-access + namespace: someteamname +spec: + postgresInstance: foobar + username: user@usersen.com + accessLevel: readwritecreate + expiresAt: "2099-09-17T12:00:00Z" + clientWireGuardPublicKey: client-public-key +status: + conditions: + - type: Ready + status: "False" + reason: UnsupportedAccessLevel + message: "readwritecreate is not supported for this Postgres instance" diff --git a/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_missing-secret-access.yaml b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_missing-secret-access.yaml new file mode 100644 index 000000000..b8beb8444 --- /dev/null +++ b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_missing-secret-access.yaml @@ -0,0 +1,20 @@ +apiVersion: nais.io/v1 +kind: PostgresAccess +metadata: + name: missing-secret-access + namespace: someteamname +spec: + postgresInstance: foobar + username: user@usersen.com + accessLevel: read + expiresAt: "2099-09-17T12:00:00Z" + clientWireGuardPublicKey: client-public-key +status: + credentialSecretName: missing-secret-access-credentials + serverName: pg-foobar-rw.someteamname.svc.cluster.local + conditions: + - type: Ready + status: "True" + tunnel: + endpoint: "1.2.3.4:12345" + gatewayPublicKey: gw-public-key diff --git a/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_pending-access.yaml b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_pending-access.yaml new file mode 100644 index 000000000..67410521c --- /dev/null +++ b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_pending-access.yaml @@ -0,0 +1,20 @@ +apiVersion: nais.io/v1 +kind: PostgresAccess +metadata: + name: pending-access + namespace: someteamname +spec: + postgresInstance: foobar + username: user@usersen.com + accessLevel: read + expiresAt: "2099-09-17T12:00:00Z" + clientWireGuardPublicKey: client-public-key +status: + credentialSecretName: pending-access-credentials + serverName: pg-foobar-rw.someteamname.svc.cluster.local + conditions: + - type: Ready + status: "False" + tunnel: + endpoint: "1.2.3.4:12345" + gatewayPublicKey: gw-public-key diff --git a/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_ready.yaml b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_ready.yaml new file mode 100644 index 000000000..0a611ad72 --- /dev/null +++ b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_access_ready.yaml @@ -0,0 +1,23 @@ +apiVersion: nais.io/v1 +kind: PostgresAccess +metadata: + name: ready-access + namespace: someteamname +spec: + postgresInstance: foobar + username: user@usersen.com + accessLevel: readwrite + expiresAt: "2099-09-17T12:00:00Z" + clientWireGuardPublicKey: client-public-key +status: + credentialSecretName: ready-access-credentials + serverName: pg-foobar-rw.someteamname.svc.cluster.local + conditions: + - type: Ready + status: "True" + reason: Ready + message: "Database role and tunnel are ready" + tunnel: + name: ready-access + endpoint: "1.2.3.4:12345" + gatewayPublicKey: "gw-public-key" diff --git a/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_foobar.yaml b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_foobar.yaml new file mode 100644 index 000000000..6796d66e0 --- /dev/null +++ b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_foobar.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: data.nais.io/v1 +kind: Postgres +metadata: + name: foobar + namespace: someteamname +spec: + cluster: + majorVersion: "17" + resources: + cpu: 100m + diskSize: 2Gi + memory: 2G + database: + collation: nb_NO diff --git a/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_progressing.yaml b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_progressing.yaml new file mode 100644 index 000000000..8a926e827 --- /dev/null +++ b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/postgres_progressing.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: data.nais.io/v1 +kind: Postgres +metadata: + name: progressing + namespace: someteamname +spec: + cluster: + majorVersion: "17" + resources: + cpu: 100m + diskSize: 2Gi + memory: 2G + database: + collation: nb_NO +status: + conditions: + - type: Progressing + status: "True" + reason: Reconciling + message: Creating Postgres cluster + lastTransitionTime: "2026-09-17T00:00:00Z" diff --git a/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/secret_ready_access_credentials.yaml b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/secret_ready_access_credentials.yaml new file mode 100644 index 000000000..4a845780e --- /dev/null +++ b/integration_tests/k8s_resources/create_postgres_access/dev/someteamname/secret_ready_access_credentials.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: ready-access-credentials + namespace: someteamname +type: kubernetes.io/basic-auth +data: + username: YXBwLWZvb2Jhci1hYmMxMjM= + password: c3VwZXJzZWNyZXQ= + ca.crt: dGVzdC1jYS1jZXJ0aWZpY2F0ZQ== diff --git a/internal/cmd/api/api.go b/internal/cmd/api/api.go index 2b5bec209..0735961f5 100644 --- a/internal/cmd/api/api.go +++ b/internal/cmd/api/api.go @@ -393,7 +393,7 @@ func run(ctx context.Context, cfg *Config, log logrus.FieldLogger) error { }) wg.Go(func() error { - if err := grpc.Run(ctx, cfg.GRPCListenAddress, pool, watchers.SqlDatabaseWatcher, watchers.ZalandoPostgresWatcher, log.WithField("subsystem", "grpc")); err != nil { + if err := grpc.Run(ctx, cfg.GRPCListenAddress, pool, watchers.SqlDatabaseWatcher, watchers.PostgresWatcher, log.WithField("subsystem", "grpc")); err != nil { log.WithError(err).Errorf("error in GRPC server") return err } diff --git a/internal/cmd/api/http.go b/internal/cmd/api/http.go index bb41fe3b9..8e9d396b2 100644 --- a/internal/cmd/api/http.go +++ b/internal/cmd/api/http.go @@ -232,7 +232,7 @@ func ConfigureGraph( kafkatopic.AddSearch(searcher, watchers.KafkaTopicWatcher) opensearch.AddSearch(searcher, watchers.OpenSearchWatcher) sqlinstance.AddSearchSQLInstance(searcher, watchers.SqlInstanceWatcher) - postgres.AddSearchZalandoPostgres(searcher, watchers.ZalandoPostgresWatcher) + postgres.AddSearchPostgres(searcher, watchers.PostgresWatcher) valkey.AddSearch(searcher, watchers.ValkeyWatcher) team.AddSearch(searcher, pool, notifier, log.WithField("subsystem", "team_search")) return nil @@ -355,7 +355,7 @@ func ConfigureGraph( ctx = alerts.NewLoaderContext(ctx, prometheusClient, log) ctx = metrics.NewLoaderContext(ctx, prometheusClient, log) ctx = sqlinstance.NewLoaderContext(ctx, sqlAdminService, watchers.SqlDatabaseWatcher, watchers.SqlInstanceWatcher, auditLogProjectID, auditLogLocation) - ctx = postgres.NewLoaderContext(ctx, watchers.ZalandoPostgresWatcher, auditLogProjectID, auditLogLocation) + ctx = postgres.NewLoaderContext(ctx, watchers.PostgresWatcher, auditLogProjectID, auditLogLocation) ctx = aivencredentials.NewClientContext(ctx, dynamicClients, log) ctx = database.NewLoaderContext(ctx, pool) ctx = issue.NewContext(ctx, pool) diff --git a/internal/graph/gengql/activitylog.generated.go b/internal/graph/gengql/activitylog.generated.go index 8152a69b2..dbdf65c8c 100644 --- a/internal/graph/gengql/activitylog.generated.go +++ b/internal/graph/gengql/activitylog.generated.go @@ -789,6 +789,20 @@ func (ec *executionContext) _ActivityLogEntry(ctx context.Context, sel ast.Selec return graphql.Null } return ec._ReconcilerConfiguredActivityLogEntry(ctx, sel, obj) + case postgres.PostgresPersonalAccessCreatedActivityLogEntry: + return ec._PostgresPersonalAccessCreatedActivityLogEntry(ctx, sel, &obj) + case *postgres.PostgresPersonalAccessCreatedActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._PostgresPersonalAccessCreatedActivityLogEntry(ctx, sel, obj) + case postgres.PostgresPersonalAccessConnectionActivityLogEntry: + return ec._PostgresPersonalAccessConnectionActivityLogEntry(ctx, sel, &obj) + case *postgres.PostgresPersonalAccessConnectionActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._PostgresPersonalAccessConnectionActivityLogEntry(ctx, sel, obj) case postgres.PostgresGrantAccessActivityLogEntry: return ec._PostgresGrantAccessActivityLogEntry(ctx, sel, &obj) case *postgres.PostgresGrantAccessActivityLogEntry: diff --git a/internal/graph/gengql/postgres.generated.go b/internal/graph/gengql/postgres.generated.go index fc1a3e91c..437760ad6 100644 --- a/internal/graph/gengql/postgres.generated.go +++ b/internal/graph/gengql/postgres.generated.go @@ -24,6 +24,11 @@ import ( // region ************************** generated!.gotpl ************************** +type PostgresAccessResolver interface { + Team(ctx context.Context, obj *postgres.PostgresAccess) (*team.Team, error) + TeamEnvironment(ctx context.Context, obj *postgres.PostgresAccess) (*team.TeamEnvironment, error) + PostgresInstance(ctx context.Context, obj *postgres.PostgresAccess) (*postgres.PostgresInstance, error) +} type PostgresInstanceResolver interface { Team(ctx context.Context, obj *postgres.PostgresInstance) (*team.Team, error) TeamEnvironment(ctx context.Context, obj *postgres.PostgresInstance) (*team.TeamEnvironment, error) @@ -86,6 +91,52 @@ func (ec *executionContext) field_PostgresInstance_workloads_args(ctx context.Co // region **************************** field.gotpl ***************************** +func (ec *executionContext) _CreatePostgresAccessPayload_name(ctx context.Context, field graphql.CollectedField, obj *postgres.CreatePostgresAccessPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreatePostgresAccessPayload_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_CreatePostgresAccessPayload_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("CreatePostgresAccessPayload", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _CreatePostgresAccessPayload_expiresAt(ctx context.Context, field graphql.CollectedField, obj *postgres.CreatePostgresAccessPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CreatePostgresAccessPayload_expiresAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ExpiresAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_CreatePostgresAccessPayload_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("CreatePostgresAccessPayload", field, false, false, errors.New("field of type Time does not have child fields")) +} + func (ec *executionContext) _DeletePostgresPayload_postgresDeleted(ctx context.Context, field graphql.CollectedField, obj *postgres.DeletePostgresPayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -132,13 +183,13 @@ func (ec *executionContext) fieldContext_GrantPostgresAccessPayload_error(_ cont return graphql.NewScalarFieldContext("GrantPostgresAccessPayload", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresDeletedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccess_id(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresDeletedActivityLogEntry_id(ctx, field) + return ec.fieldContext_PostgresAccess_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID(), nil @@ -151,20 +202,20 @@ func (ec *executionContext) _PostgresDeletedActivityLogEntry_id(ctx context.Cont true, ) } -func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccess_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccess", field, true, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _PostgresDeletedActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccess_name(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresDeletedActivityLogEntry_actor(ctx, field) + return ec.fieldContext_PostgresAccess_name(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Actor, nil + return obj.Name, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -174,135 +225,185 @@ func (ec *executionContext) _PostgresDeletedActivityLogEntry_actor(ctx context.C true, ) } -func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccess_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccess", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresDeletedActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccess_team(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresDeletedActivityLogEntry_createdAt(ctx, field) + return ec.fieldContext_PostgresAccess_team(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return ec.Resolvers.PostgresAccess().Team(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { - return ec.marshalNTime2timeᚐTime(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *team.Team) graphql.Marshaler { + return ec.marshalNTeam2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋteamᚐTeam(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccess_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresAccess", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Team(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _PostgresDeletedActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccess_teamEnvironment(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresDeletedActivityLogEntry_message(ctx, field) + return ec.fieldContext_PostgresAccess_teamEnvironment(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Message, nil + return ec.Resolvers.PostgresAccess().TeamEnvironment(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *team.TeamEnvironment) graphql.Marshaler { + return ec.marshalNTeamEnvironment2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋteamᚐTeamEnvironment(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccess_teamEnvironment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresAccess", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_TeamEnvironment(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _PostgresDeletedActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccess_postgresInstance(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresDeletedActivityLogEntry_resourceType(ctx, field) + return ec.fieldContext_PostgresAccess_postgresInstance(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ResourceType, nil + return ec.Resolvers.PostgresAccess().PostgresInstance(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v activitylog.ActivityLogEntryResourceType) graphql.Marshaler { - return ec.marshalNActivityLogEntryResourceType2githubᚗcomᚋnaisᚋapiᚋinternalᚋactivitylogᚐActivityLogEntryResourceType(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresInstance) graphql.Marshaler { + return ec.marshalNPostgresInstance2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstance(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccess_postgresInstance(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresAccess", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresInstance(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _PostgresDeletedActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccess_accessLevel(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresDeletedActivityLogEntry_resourceName(ctx, field) + return ec.fieldContext_PostgresAccess_accessLevel(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ResourceName, nil + return obj.AccessLevel, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v postgres.PostgresAccessLevel) graphql.Marshaler { + return ec.marshalNPostgresAccessLevel2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessLevel(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccess_accessLevel(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccess", field, false, false, errors.New("field of type PostgresAccessLevel does not have child fields")) } -func (ec *executionContext) _PostgresDeletedActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccess_expiresAt(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresDeletedActivityLogEntry_teamSlug(ctx, field) + return ec.fieldContext_PostgresAccess_expiresAt(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.TeamSlug, nil + return obj.ExpiresAt, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *slug.Slug) graphql.Marshaler { - return ec.marshalNSlug2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccess_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccess", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _PostgresDeletedActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccess_state(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresDeletedActivityLogEntry_environmentName(ctx, field) + return ec.fieldContext_PostgresAccess_state(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.EnvironmentName, nil + return obj.State, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v postgres.PostgresAccessState) graphql.Marshaler { + return ec.marshalNPostgresAccessState2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessState(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresAccess_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccess", field, false, false, errors.New("field of type PostgresAccessState does not have child fields")) +} + +func (ec *executionContext) _PostgresAccess_message(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresAccess_message(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Message, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { @@ -312,43 +413,52 @@ func (ec *executionContext) _PostgresDeletedActivityLogEntry_environmentName(ctx false, ) } -func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccess_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccess", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccess_tunnel(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccess) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntry_id(ctx, field) + return ec.fieldContext_PostgresAccess_tunnel(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ID(), nil + return obj.Tunnel, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { - return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresAccessTunnel) graphql.Marshaler { + return ec.marshalOPostgresAccessTunnel2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessTunnel(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccess_tunnel(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresAccess", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresAccessTunnel(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccessConnection_password(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccessConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntry_actor(ctx, field) + return ec.fieldContext_PostgresAccessConnection_password(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Actor, nil + return obj.Password, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -358,43 +468,43 @@ func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_actor(ctx conte true, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccessConnection_password(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccessConnection", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccessConnection_caCertificate(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccessConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntry_createdAt(ctx, field) + return ec.fieldContext_PostgresAccessConnection_caCertificate(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil + return obj.CACertificate, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { - return ec.marshalNTime2timeᚐTime(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccessConnection_caCertificate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccessConnection", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccessConnection_serverName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccessConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntry_message(ctx, field) + return ec.fieldContext_PostgresAccessConnection_serverName(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Message, nil + return obj.ServerName, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -404,43 +514,52 @@ func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_message(ctx con true, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccessConnection_serverName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccessConnection", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccessConnection_tunnel(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccessConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntry_resourceType(ctx, field) + return ec.fieldContext_PostgresAccessConnection_tunnel(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ResourceType, nil + return obj.Tunnel, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v activitylog.ActivityLogEntryResourceType) graphql.Marshaler { - return ec.marshalNActivityLogEntryResourceType2githubᚗcomᚋnaisᚋapiᚋinternalᚋactivitylogᚐActivityLogEntryResourceType(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v postgres.PostgresAccessConnectionTunnel) graphql.Marshaler { + return ec.marshalNPostgresAccessConnectionTunnel2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessConnectionTunnel(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccessConnection_tunnel(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresAccessConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresAccessConnectionTunnel(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccessConnectionTunnel_endpoint(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccessConnectionTunnel) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntry_resourceName(ctx, field) + return ec.fieldContext_PostgresAccessConnectionTunnel_endpoint(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ResourceName, nil + return obj.Endpoint, nil }, nil, func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { @@ -450,1097 +569,2198 @@ func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_resourceName(ct true, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccessConnectionTunnel_endpoint(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccessConnectionTunnel", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccessConnectionTunnel_gatewayPublicKey(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccessConnectionTunnel) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntry_teamSlug(ctx, field) + return ec.fieldContext_PostgresAccessConnectionTunnel_gatewayPublicKey(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.TeamSlug, nil + return obj.GatewayPublicKey, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *slug.Slug) graphql.Marshaler { - return ec.marshalNSlug2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccessConnectionTunnel_gatewayPublicKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccessConnectionTunnel", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccessTunnel_name(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccessTunnel) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntry_environmentName(ctx, field) + return ec.fieldContext_PostgresAccessTunnel_name(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.EnvironmentName, nil + return obj.Name, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccessTunnel_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccessTunnel", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccessTunnel_endpoint(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccessTunnel) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntry_data(ctx, field) + return ec.fieldContext_PostgresAccessTunnel_endpoint(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Data, nil + return obj.Endpoint, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresGrantAccessActivityLogEntryData) graphql.Marshaler { - return ec.marshalNPostgresGrantAccessActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresGrantAccessActivityLogEntryData(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresGrantAccessActivityLogEntry", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PostgresGrantAccessActivityLogEntryData(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresAccessTunnel_endpoint(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccessTunnel", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntryData_grantee(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntryData) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresAccessTunnel_gatewayPublicKey(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresAccessTunnel) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntryData_grantee(ctx, field) + return ec.fieldContext_PostgresAccessTunnel_gatewayPublicKey(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Grantee, nil + return obj.GatewayPublicKey, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntryData_grantee(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresAccessTunnel_gatewayPublicKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresAccessTunnel", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresGrantAccessActivityLogEntryData_until(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntryData) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresDeletedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresGrantAccessActivityLogEntryData_until(ctx, field) + return ec.fieldContext_PostgresDeletedActivityLogEntry_id(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Until, nil + return obj.ID(), nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { - return ec.marshalNTime2timeᚐTime(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { + return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntryData_until(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntryData", field, false, false, errors.New("field of type Time does not have child fields")) +func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _PostgresInstance_id(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresDeletedActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_id(ctx, field) + return ec.fieldContext_PostgresDeletedActivityLogEntry_actor(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.ID(), nil + return obj.Actor, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { - return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstance", field, true, false, errors.New("field of type ID does not have child fields")) +func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstance_name(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresDeletedActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_name(ctx, field) + return ec.fieldContext_PostgresDeletedActivityLogEntry_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.CreatedAt, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstance", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _PostgresInstance_team(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresDeletedActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_team(ctx, field) + return ec.fieldContext_PostgresDeletedActivityLogEntry_message(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.PostgresInstance().Team(ctx, obj) + return obj.Message, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *team.Team) graphql.Marshaler { - return ec.marshalNTeam2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋteamᚐTeam(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstance", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_Team(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstance_teamEnvironment(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresDeletedActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_teamEnvironment(ctx, field) + return ec.fieldContext_PostgresDeletedActivityLogEntry_resourceType(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.PostgresInstance().TeamEnvironment(ctx, obj) + return obj.ResourceType, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *team.TeamEnvironment) graphql.Marshaler { - return ec.marshalNTeamEnvironment2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋteamᚐTeamEnvironment(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v activitylog.ActivityLogEntryResourceType) graphql.Marshaler { + return ec.marshalNActivityLogEntryResourceType2githubᚗcomᚋnaisᚋapiᚋinternalᚋactivitylogᚐActivityLogEntryResourceType(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_teamEnvironment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstance", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_TeamEnvironment(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) } -func (ec *executionContext) _PostgresInstance_workloads(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresDeletedActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_workloads(ctx, field) + return ec.fieldContext_PostgresDeletedActivityLogEntry_resourceName(ctx, field) }, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.PostgresInstance().Workloads(ctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*pagination.Cursor), fc.Args["last"].(*int), fc.Args["before"].(*pagination.Cursor)) + return obj.ResourceName, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *pagination.Connection[workload.Workload]) graphql.Marshaler { - return ec.marshalNWorkloadConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_workloads(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstance", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_WorkloadConnection(ctx, field) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_PostgresInstance_workloads_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstance_resources(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresDeletedActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_resources(ctx, field) + return ec.fieldContext_PostgresDeletedActivityLogEntry_teamSlug(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Resources, nil + return obj.TeamSlug, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresInstanceResources) graphql.Marshaler { - return ec.marshalNPostgresInstanceResources2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceResources(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *slug.Slug) graphql.Marshaler { + return ec.marshalNSlug2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_resources(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstance", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PostgresInstanceResources(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) } -func (ec *executionContext) _PostgresInstance_majorVersion(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresDeletedActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_majorVersion(ctx, field) + return ec.fieldContext_PostgresDeletedActivityLogEntry_environmentName(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.MajorVersion, nil + return obj.EnvironmentName, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_PostgresInstance_majorVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstance", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresDeletedActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresDeletedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstance_audit(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_audit(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntry_id(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Audit, nil + return obj.ID(), nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v postgres.PostgresInstanceAudit) graphql.Marshaler { - return ec.marshalNPostgresInstanceAudit2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceAudit(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { + return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_audit(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstance", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PostgresInstanceAudit(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _PostgresInstance_highAvailability(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_highAvailability(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntry_actor(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.HighAvailability, nil + return obj.Actor, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { - return ec.marshalNBoolean2bool(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_highAvailability(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstance", field, false, false, errors.New("field of type Boolean does not have child fields")) +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstance_state(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_state(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntry_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.State, nil + return obj.CreatedAt, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v postgres.PostgresInstanceState) graphql.Marshaler { - return ec.marshalNPostgresInstanceState2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceState(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstance", field, false, false, errors.New("field of type PostgresInstanceState does not have child fields")) +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _PostgresInstance_maintenanceWindow(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_maintenanceWindow(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntry_message(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.MaintenanceWindow, nil + return obj.Message, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresInstanceMaintenanceWindow) graphql.Marshaler { - return ec.marshalOPostgresInstanceMaintenanceWindow2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceMaintenanceWindow(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, - false, + true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_maintenanceWindow(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstance", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PostgresInstanceMaintenanceWindow(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstance_labels(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstance_labels(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntry_resourceType(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Labels, nil + return obj.ResourceType, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []*model.ResourceLabel) graphql.Marshaler { - return ec.marshalNResourceLabel2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐResourceLabelᚄ(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v activitylog.ActivityLogEntryResourceType) graphql.Marshaler { + return ec.marshalNActivityLogEntryResourceType2githubᚗcomᚋnaisᚋapiᚋinternalᚋactivitylogᚐActivityLogEntryResourceType(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstance_labels(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstance", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ResourceLabel(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) } -func (ec *executionContext) _PostgresInstanceAudit_enabled(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceAudit) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceAudit_enabled(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntry_resourceName(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Enabled, nil + return obj.ResourceName, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { - return ec.marshalNBoolean2bool(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceAudit_enabled(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceAudit", field, false, false, errors.New("field of type Boolean does not have child fields")) +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstanceAudit_url(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceAudit) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceAudit_url(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntry_teamSlug(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.PostgresInstanceAudit().URL(ctx, obj) + return obj.TeamSlug, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { - return ec.marshalOString2ᚖstring(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *slug.Slug) graphql.Marshaler { + return ec.marshalNSlug2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, selections, v) }, true, - false, + true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceAudit_url(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceAudit", field, true, true, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) } -func (ec *executionContext) _PostgresInstanceAudit_statementClasses(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceAudit) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceAudit_statementClasses(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntry_environmentName(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.StatementClasses, nil + return obj.EnvironmentName, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { - return ec.marshalOString2ᚕstringᚄ(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, false, ) } -func (ec *executionContext) fieldContext_PostgresInstanceAudit_statementClasses(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceAudit", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstanceConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *pagination.FacetableConnection[*postgres.PostgresInstance, *postgres.PostgresInstanceFilter]) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceConnection_pageInfo(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntry_data(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.PageInfo, nil + return obj.Data, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v pagination.PageInfo) graphql.Marshaler { - return ec.marshalNPageInfo2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐPageInfo(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresGrantAccessActivityLogEntryData) graphql.Marshaler { + return ec.marshalNPostgresGrantAccessActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresGrantAccessActivityLogEntryData(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PostgresInstanceConnection", + Object: "PostgresGrantAccessActivityLogEntry", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PageInfo(ctx, field) + return ec.childFields_PostgresGrantAccessActivityLogEntryData(ctx, field) }, } return fc, nil } -func (ec *executionContext) _PostgresInstanceConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *pagination.FacetableConnection[*postgres.PostgresInstance, *postgres.PostgresInstanceFilter]) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntryData_grantee(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntryData) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceConnection_nodes(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntryData_grantee(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Nodes(), nil + return obj.Grantee, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []*postgres.PostgresInstance) graphql.Marshaler { - return ec.marshalNPostgresInstance2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceᚄ(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceConnection_nodes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstanceConnection", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PostgresInstance(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntryData_grantee(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstanceConnection_edges(ctx context.Context, field graphql.CollectedField, obj *pagination.FacetableConnection[*postgres.PostgresInstance, *postgres.PostgresInstanceFilter]) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresGrantAccessActivityLogEntryData_until(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresGrantAccessActivityLogEntryData) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceConnection_edges(ctx, field) + return ec.fieldContext_PostgresGrantAccessActivityLogEntryData_until(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Edges, nil + return obj.Until, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []pagination.Edge[*postgres.PostgresInstance]) graphql.Marshaler { - return ec.marshalNPostgresInstanceEdge2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdgeᚄ(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstanceConnection", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PostgresInstanceEdge(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresGrantAccessActivityLogEntryData_until(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresGrantAccessActivityLogEntryData", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _PostgresInstanceConnection_facets(ctx context.Context, field graphql.CollectedField, obj *pagination.FacetableConnection[*postgres.PostgresInstance, *postgres.PostgresInstanceFilter]) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_id(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceConnection_facets(ctx, field) + return ec.fieldContext_PostgresInstance_id(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.PostgresInstanceConnection().Facets(ctx, obj) + return obj.ID(), nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresInstanceFacets) graphql.Marshaler { - return ec.marshalOPostgresInstanceFacets2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceFacets(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { + return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) }, true, - false, + true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceConnection_facets(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstanceConnection", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PostgresInstanceFacets(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresInstance_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstance", field, true, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _PostgresInstanceEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *pagination.Edge[*postgres.PostgresInstance]) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_name(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceEdge_cursor(ctx, field) + return ec.fieldContext_PostgresInstance_name(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Cursor, nil + return obj.Name, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v pagination.Cursor) graphql.Marshaler { - return ec.marshalNCursor2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐCursor(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) +func (ec *executionContext) fieldContext_PostgresInstance_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstance", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstanceEdge_node(ctx context.Context, field graphql.CollectedField, obj *pagination.Edge[*postgres.PostgresInstance]) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_team(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceEdge_node(ctx, field) + return ec.fieldContext_PostgresInstance_team(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Node, nil + return ec.Resolvers.PostgresInstance().Team(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresInstance) graphql.Marshaler { - return ec.marshalNPostgresInstance2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstance(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *team.Team) graphql.Marshaler { + return ec.marshalNTeam2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋteamᚐTeam(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PostgresInstance_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PostgresInstanceEdge", + Object: "PostgresInstance", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PostgresInstance(ctx, field) + return ec.childFields_Team(ctx, field) }, } return fc, nil } -func (ec *executionContext) _PostgresInstanceFacets_environments(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_teamEnvironment(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceFacets_environments(ctx, field) + return ec.fieldContext_PostgresInstance_teamEnvironment(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Environments(ctx), nil + return ec.Resolvers.PostgresInstance().TeamEnvironment(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []model.StringFacetItem) graphql.Marshaler { - return ec.marshalNStringFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐStringFacetItemᚄ(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *team.TeamEnvironment) graphql.Marshaler { + return ec.marshalNTeamEnvironment2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋteamᚐTeamEnvironment(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceFacets_environments(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PostgresInstance_teamEnvironment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PostgresInstanceFacets", + Object: "PostgresInstance", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_StringFacetItem(ctx, field) + return ec.childFields_TeamEnvironment(ctx, field) }, } return fc, nil } -func (ec *executionContext) _PostgresInstanceFacets_states(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_workloads(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceFacets_states(ctx, field) + return ec.fieldContext_PostgresInstance_workloads(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.States(ctx), nil + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.PostgresInstance().Workloads(ctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*pagination.Cursor), fc.Args["last"].(*int), fc.Args["before"].(*pagination.Cursor)) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []postgres.PostgresInstanceStateFacetItem) graphql.Marshaler { - return ec.marshalNPostgresInstanceStateFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceStateFacetItemᚄ(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *pagination.Connection[workload.Workload]) graphql.Marshaler { + return ec.marshalNWorkloadConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceFacets_states(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PostgresInstance_workloads(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PostgresInstanceFacets", + Object: "PostgresInstance", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_PostgresInstanceStateFacetItem(ctx, field) + return ec.childFields_WorkloadConnection(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_PostgresInstance_workloads_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _PostgresInstanceFacets_highAvailability(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_resources(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceFacets_highAvailability(ctx, field) + return ec.fieldContext_PostgresInstance_resources(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.HighAvailability(ctx), nil + return obj.Resources, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []model.BooleanFacetItem) graphql.Marshaler { - return ec.marshalNBooleanFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐBooleanFacetItemᚄ(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresInstanceResources) graphql.Marshaler { + return ec.marshalNPostgresInstanceResources2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceResources(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceFacets_highAvailability(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PostgresInstance_resources(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PostgresInstanceFacets", + Object: "PostgresInstance", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_BooleanFacetItem(ctx, field) + return ec.childFields_PostgresInstanceResources(ctx, field) }, } return fc, nil } -func (ec *executionContext) _PostgresInstanceFacets_majorVersions(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_majorVersion(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceFacets_majorVersions(ctx, field) + return ec.fieldContext_PostgresInstance_majorVersion(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.MajorVersions(ctx), nil + return obj.MajorVersion, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []model.StringFacetItem) graphql.Marshaler { - return ec.marshalNStringFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐStringFacetItemᚄ(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceFacets_majorVersions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "PostgresInstanceFacets", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_StringFacetItem(ctx, field) - }, - } - return fc, nil +func (ec *executionContext) fieldContext_PostgresInstance_majorVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstance", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstanceFacets_labels(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_audit(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceFacets_labels(ctx, field) + return ec.fieldContext_PostgresInstance_audit(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Labels(ctx), nil + return obj.Audit, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v []model.LabelFacetItem) graphql.Marshaler { - return ec.marshalNLabelFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐLabelFacetItemᚄ(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v postgres.PostgresInstanceAudit) graphql.Marshaler { + return ec.marshalNPostgresInstanceAudit2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceAudit(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceFacets_labels(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_PostgresInstance_audit(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PostgresInstanceFacets", + Object: "PostgresInstance", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_LabelFacetItem(ctx, field) + return ec.childFields_PostgresInstanceAudit(ctx, field) }, } return fc, nil } -func (ec *executionContext) _PostgresInstanceMaintenanceWindow_day(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceMaintenanceWindow) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_highAvailability(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceMaintenanceWindow_day(ctx, field) + return ec.fieldContext_PostgresInstance_highAvailability(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Day, nil + return obj.HighAvailability, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { - return ec.marshalNInt2int(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceMaintenanceWindow_day(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceMaintenanceWindow", field, false, false, errors.New("field of type Int does not have child fields")) +func (ec *executionContext) fieldContext_PostgresInstance_highAvailability(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstance", field, false, false, errors.New("field of type Boolean does not have child fields")) } -func (ec *executionContext) _PostgresInstanceMaintenanceWindow_hour(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceMaintenanceWindow) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_state(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceMaintenanceWindow_hour(ctx, field) + return ec.fieldContext_PostgresInstance_state(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Hour, nil + return obj.State, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { - return ec.marshalNInt2int(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v postgres.PostgresInstanceState) graphql.Marshaler { + return ec.marshalNPostgresInstanceState2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceState(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceMaintenanceWindow_hour(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceMaintenanceWindow", field, false, false, errors.New("field of type Int does not have child fields")) +func (ec *executionContext) fieldContext_PostgresInstance_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstance", field, false, false, errors.New("field of type PostgresInstanceState does not have child fields")) } -func (ec *executionContext) _PostgresInstanceResources_cpu(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceResources) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_maintenanceWindow(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceResources_cpu(ctx, field) + return ec.fieldContext_PostgresInstance_maintenanceWindow(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.CPU, nil + return obj.MaintenanceWindow, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresInstanceMaintenanceWindow) graphql.Marshaler { + return ec.marshalOPostgresInstanceMaintenanceWindow2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceMaintenanceWindow(ctx, selections, v) }, true, - true, + false, ) } -func (ec *executionContext) fieldContext_PostgresInstanceResources_cpu(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceResources", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresInstance_maintenanceWindow(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstance", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresInstanceMaintenanceWindow(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _PostgresInstanceResources_memory(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceResources) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstance_labels(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstance) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceResources_memory(ctx, field) + return ec.fieldContext_PostgresInstance_labels(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Memory, nil + return obj.Labels, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v []*model.ResourceLabel) graphql.Marshaler { + return ec.marshalNResourceLabel2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐResourceLabelᚄ(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceResources_memory(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceResources", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresInstance_labels(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstance", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_ResourceLabel(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _PostgresInstanceResources_diskSize(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceResources) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstanceAudit_enabled(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceAudit) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceResources_diskSize(ctx, field) + return ec.fieldContext_PostgresInstanceAudit_enabled(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.DiskSize, nil + return obj.Enabled, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalNString2string(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceResources_diskSize(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceResources", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_PostgresInstanceAudit_enabled(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceAudit", field, false, false, errors.New("field of type Boolean does not have child fields")) } -func (ec *executionContext) _PostgresInstanceStateFacetItem_state(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceStateFacetItem) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstanceAudit_url(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceAudit) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceStateFacetItem_state(ctx, field) + return ec.fieldContext_PostgresInstanceAudit_url(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.State, nil + return ec.Resolvers.PostgresInstanceAudit().URL(ctx, obj) }, nil, - func(ctx context.Context, selections ast.SelectionSet, v postgres.PostgresInstanceState) graphql.Marshaler { - return ec.marshalNPostgresInstanceState2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceState(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) }, true, + false, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceAudit_url(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceAudit", field, true, true, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresInstanceAudit_statementClasses(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceAudit) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceAudit_statementClasses(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StatementClasses, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalOString2ᚕstringᚄ(ctx, selections, v) + }, true, + false, ) } -func (ec *executionContext) fieldContext_PostgresInstanceStateFacetItem_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceStateFacetItem", field, false, false, errors.New("field of type PostgresInstanceState does not have child fields")) +func (ec *executionContext) fieldContext_PostgresInstanceAudit_statementClasses(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceAudit", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _PostgresInstanceStateFacetItem_count(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceStateFacetItem) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstanceConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *pagination.FacetableConnection[*postgres.PostgresInstance, *postgres.PostgresInstanceFilter]) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_PostgresInstanceStateFacetItem_count(ctx, field) + return ec.fieldContext_PostgresInstanceConnection_pageInfo(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Count, nil + return obj.PageInfo, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { - return ec.marshalNInt2int(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v pagination.PageInfo) graphql.Marshaler { + return ec.marshalNPageInfo2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐPageInfo(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_PostgresInstanceStateFacetItem_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PostgresInstanceStateFacetItem", field, false, false, errors.New("field of type Int does not have child fields")) +func (ec *executionContext) fieldContext_PostgresInstanceConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PageInfo(ctx, field) + }, + } + return fc, nil } -func (ec *executionContext) _TeamInventoryCountPostgresInstances_total(ctx context.Context, field graphql.CollectedField, obj *postgres.TeamInventoryCountPostgresInstances) (ret graphql.Marshaler) { +func (ec *executionContext) _PostgresInstanceConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *pagination.FacetableConnection[*postgres.PostgresInstance, *postgres.PostgresInstanceFilter]) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_TeamInventoryCountPostgresInstances_total(ctx, field) + return ec.fieldContext_PostgresInstanceConnection_nodes(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.Total, nil + return obj.Nodes(), nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { - return ec.marshalNInt2int(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v []*postgres.PostgresInstance) graphql.Marshaler { + return ec.marshalNPostgresInstance2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceᚄ(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_TeamInventoryCountPostgresInstances_total(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("TeamInventoryCountPostgresInstances", field, false, false, errors.New("field of type Int does not have child fields")) +func (ec *executionContext) fieldContext_PostgresInstanceConnection_nodes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceConnection", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresInstance(ctx, field) + }, + } + return fc, nil } -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - -func (ec *executionContext) unmarshalInputDeletePostgresInput(ctx context.Context, obj any) (postgres.DeletePostgresInput, error) { - var it postgres.DeletePostgresInput - if obj == nil { - return it, nil +func (ec *executionContext) _PostgresInstanceConnection_edges(ctx context.Context, field graphql.CollectedField, obj *pagination.FacetableConnection[*postgres.PostgresInstance, *postgres.PostgresInstanceFilter]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceConnection_edges(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Edges, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []pagination.Edge[*postgres.PostgresInstance]) graphql.Marshaler { + return ec.marshalNPostgresInstanceEdge2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdgeᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresInstanceEdge(ctx, field) + }, } + return fc, nil +} - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v +func (ec *executionContext) _PostgresInstanceConnection_facets(ctx context.Context, field graphql.CollectedField, obj *pagination.FacetableConnection[*postgres.PostgresInstance, *postgres.PostgresInstanceFilter]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceConnection_facets(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.PostgresInstanceConnection().Facets(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresInstanceFacets) graphql.Marshaler { + return ec.marshalOPostgresInstanceFacets2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceFacets(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceConnection_facets(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceConnection", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresInstanceFacets(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _PostgresInstanceEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *pagination.Edge[*postgres.PostgresInstance]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceEdge_cursor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Cursor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v pagination.Cursor) graphql.Marshaler { + return ec.marshalNCursor2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐCursor(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) +} + +func (ec *executionContext) _PostgresInstanceEdge_node(ctx context.Context, field graphql.CollectedField, obj *pagination.Edge[*postgres.PostgresInstance]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceEdge_node(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Node, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresInstance) graphql.Marshaler { + return ec.marshalNPostgresInstance2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstance(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresInstance(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _PostgresInstanceFacets_environments(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceFacets_environments(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Environments(ctx), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []model.StringFacetItem) graphql.Marshaler { + return ec.marshalNStringFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐStringFacetItemᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceFacets_environments(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceFacets", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_StringFacetItem(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _PostgresInstanceFacets_states(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceFacets_states(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.States(ctx), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []postgres.PostgresInstanceStateFacetItem) graphql.Marshaler { + return ec.marshalNPostgresInstanceStateFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceStateFacetItemᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceFacets_states(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceFacets", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresInstanceStateFacetItem(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _PostgresInstanceFacets_highAvailability(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceFacets_highAvailability(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.HighAvailability(ctx), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []model.BooleanFacetItem) graphql.Marshaler { + return ec.marshalNBooleanFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐBooleanFacetItemᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceFacets_highAvailability(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceFacets", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_BooleanFacetItem(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _PostgresInstanceFacets_majorVersions(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceFacets_majorVersions(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.MajorVersions(ctx), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []model.StringFacetItem) graphql.Marshaler { + return ec.marshalNStringFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐStringFacetItemᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceFacets_majorVersions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceFacets", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_StringFacetItem(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _PostgresInstanceFacets_labels(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceFacets) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceFacets_labels(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Labels(ctx), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []model.LabelFacetItem) graphql.Marshaler { + return ec.marshalNLabelFacetItem2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐLabelFacetItemᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceFacets_labels(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresInstanceFacets", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_LabelFacetItem(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _PostgresInstanceMaintenanceWindow_day(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceMaintenanceWindow) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceMaintenanceWindow_day(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Day, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceMaintenanceWindow_day(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceMaintenanceWindow", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _PostgresInstanceMaintenanceWindow_hour(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceMaintenanceWindow) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceMaintenanceWindow_hour(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Hour, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceMaintenanceWindow_hour(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceMaintenanceWindow", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _PostgresInstanceResources_cpu(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceResources) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceResources_cpu(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CPU, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceResources_cpu(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceResources", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresInstanceResources_memory(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceResources) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceResources_memory(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Memory, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceResources_memory(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceResources", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresInstanceResources_diskSize(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceResources) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceResources_diskSize(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.DiskSize, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceResources_diskSize(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceResources", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresInstanceStateFacetItem_state(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceStateFacetItem) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceStateFacetItem_state(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.State, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v postgres.PostgresInstanceState) graphql.Marshaler { + return ec.marshalNPostgresInstanceState2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceState(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceStateFacetItem_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceStateFacetItem", field, false, false, errors.New("field of type PostgresInstanceState does not have child fields")) +} + +func (ec *executionContext) _PostgresInstanceStateFacetItem_count(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresInstanceStateFacetItem) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresInstanceStateFacetItem_count(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Count, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresInstanceStateFacetItem_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresInstanceStateFacetItem", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessConnectionActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessConnectionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { + return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessConnectionActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessConnectionActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessConnectionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_actor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Actor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessConnectionActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessConnectionActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessConnectionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_createdAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CreatedAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessConnectionActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessConnectionActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessConnectionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_message(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Message, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessConnectionActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessConnectionActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessConnectionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_resourceType(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ResourceType, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v activitylog.ActivityLogEntryResourceType) graphql.Marshaler { + return ec.marshalNActivityLogEntryResourceType2githubᚗcomᚋnaisᚋapiᚋinternalᚋactivitylogᚐActivityLogEntryResourceType(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessConnectionActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessConnectionActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessConnectionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_resourceName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ResourceName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessConnectionActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessConnectionActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessConnectionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_teamSlug(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TeamSlug, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *slug.Slug) graphql.Marshaler { + return ec.marshalNSlug2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessConnectionActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessConnectionActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessConnectionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_environmentName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.EnvironmentName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessConnectionActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessConnectionActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { + return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_actor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Actor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_createdAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CreatedAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_message(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Message, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_resourceType(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ResourceType, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v activitylog.ActivityLogEntryResourceType) graphql.Marshaler { + return ec.marshalNActivityLogEntryResourceType2githubᚗcomᚋnaisᚋapiᚋinternalᚋactivitylogᚐActivityLogEntryResourceType(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_resourceName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ResourceName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_teamSlug(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TeamSlug, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *slug.Slug) graphql.Marshaler { + return ec.marshalNSlug2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_environmentName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.EnvironmentName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_data(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Data, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresPersonalAccessCreatedActivityLogEntryData) graphql.Marshaler { + return ec.marshalNPostgresPersonalAccessCreatedActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresPersonalAccessCreatedActivityLogEntryData(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PostgresPersonalAccessCreatedActivityLogEntry", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresPersonalAccessCreatedActivityLogEntryData(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntryData_username(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntryData) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntryData_username(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Username, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntryData_username(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntryData_expiresAt(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntryData) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntryData_expiresAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ExpiresAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntryData_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntryData", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntryData_reason(ctx context.Context, field graphql.CollectedField, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntryData) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntryData_reason(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Reason, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_PostgresPersonalAccessCreatedActivityLogEntryData_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("PostgresPersonalAccessCreatedActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _TeamInventoryCountPostgresInstances_total(ctx context.Context, field graphql.CollectedField, obj *postgres.TeamInventoryCountPostgresInstances) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_TeamInventoryCountPostgresInstances_total(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Total, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_TeamInventoryCountPostgresInstances_total(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("TeamInventoryCountPostgresInstances", field, false, false, errors.New("field of type Int does not have child fields")) +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputCreatePostgresAccessInput(ctx context.Context, obj any) (postgres.CreatePostgresAccessInput, error) { + var it postgres.CreatePostgresAccessInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"postgresInstance", "teamSlug", "environmentName", "accessLevel", "clientWireGuardPublicKey", "reason", "ttl"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "postgresInstance": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("postgresInstance")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.PostgresInstance = data + case "teamSlug": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamSlug")) + data, err := ec.unmarshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) + if err != nil { + return it, err + } + it.TeamSlug = data + case "environmentName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentName = data + case "accessLevel": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("accessLevel")) + data, err := ec.unmarshalNPostgresAccessLevel2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessLevel(ctx, v) + if err != nil { + return it, err + } + it.AccessLevel = data + case "clientWireGuardPublicKey": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clientWireGuardPublicKey")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.ClientWireGuardPublicKey = data + case "reason": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reason")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Reason = data + case "ttl": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ttl")) + data, err := ec.unmarshalOString2string(ctx, v) + if err != nil { + return it, err + } + it.TTL = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputDeletePostgresInput(ctx context.Context, obj any) (postgres.DeletePostgresInput, error) { + var it postgres.DeletePostgresInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "environmentName", "teamSlug"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "environmentName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentName = data + case "teamSlug": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamSlug")) + data, err := ec.unmarshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) + if err != nil { + return it, err + } + it.TeamSlug = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputGrantPostgresAccessInput(ctx context.Context, obj any) (postgres.GrantPostgresAccessInput, error) { + var it postgres.GrantPostgresAccessInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"clusterName", "teamSlug", "environmentName", "grantee", "duration"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "clusterName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clusterName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.ClusterName = data + case "teamSlug": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamSlug")) + data, err := ec.unmarshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) + if err != nil { + return it, err + } + it.TeamSlug = data + case "environmentName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentName = data + case "grantee": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("grantee")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Grantee = data + case "duration": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("duration")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Duration = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputPostgresAccessConnectionInput(ctx context.Context, obj any) (postgres.PostgresAccessConnectionInput, error) { + var it postgres.PostgresAccessConnectionInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "teamSlug", "environmentName"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "teamSlug": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamSlug")) + data, err := ec.unmarshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) + if err != nil { + return it, err + } + it.TeamSlug = data + case "environmentName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentName = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputPostgresInstanceFilter(ctx context.Context, obj any) (postgres.PostgresInstanceFilter, error) { + var it postgres.PostgresInstanceFilter + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v } - fieldsInOrder := [...]string{"name", "environmentName", "teamSlug"} + fieldsInOrder := [...]string{"name", "environments", "states", "highAvailability", "majorVersions", "labels"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -1549,211 +2769,458 @@ func (ec *executionContext) unmarshalInputDeletePostgresInput(ctx context.Contex switch k { case "name": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2string(ctx, v) if err != nil { return it, err } it.Name = data - case "environmentName": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentName")) - data, err := ec.unmarshalNString2string(ctx, v) + case "environments": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environments")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } - it.EnvironmentName = data - case "teamSlug": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamSlug")) - data, err := ec.unmarshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) + it.Environments = data + case "states": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("states")) + data, err := ec.unmarshalOPostgresInstanceState2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceStateᚄ(ctx, v) + if err != nil { + return it, err + } + it.States = data + case "highAvailability": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("highAvailability")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HighAvailability = data + case "majorVersions": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("majorVersions")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.MajorVersions = data + case "labels": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labels")) + data, err := ec.unmarshalOLabelFilter2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐLabelFiltersᚄ(ctx, v) + if err != nil { + return it, err + } + it.Labels = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputPostgresInstanceOrder(ctx context.Context, obj any) (postgres.PostgresInstanceOrder, error) { + var it postgres.PostgresInstanceOrder + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"field", "direction"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNPostgresInstanceOrderField2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐOrderDirection(ctx, v) if err != nil { return it, err } - it.TeamSlug = data - } - } - return it, nil -} + it.Direction = data + } + } + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var createPostgresAccessPayloadImplementors = []string{"CreatePostgresAccessPayload"} + +func (ec *executionContext) _CreatePostgresAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *postgres.CreatePostgresAccessPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createPostgresAccessPayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CreatePostgresAccessPayload") + case "name": + out.Values[i] = ec._CreatePostgresAccessPayload_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "expiresAt": + out.Values[i] = ec._CreatePostgresAccessPayload_expiresAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var deletePostgresPayloadImplementors = []string{"DeletePostgresPayload"} + +func (ec *executionContext) _DeletePostgresPayload(ctx context.Context, sel ast.SelectionSet, obj *postgres.DeletePostgresPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deletePostgresPayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DeletePostgresPayload") + case "postgresDeleted": + out.Values[i] = ec._DeletePostgresPayload_postgresDeleted(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var grantPostgresAccessPayloadImplementors = []string{"GrantPostgresAccessPayload"} + +func (ec *executionContext) _GrantPostgresAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *postgres.GrantPostgresAccessPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, grantPostgresAccessPayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("GrantPostgresAccessPayload") + case "error": + out.Values[i] = ec._GrantPostgresAccessPayload_error(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var postgresAccessImplementors = []string{"PostgresAccess", "Node"} + +func (ec *executionContext) _PostgresAccess(ctx context.Context, sel ast.SelectionSet, obj *postgres.PostgresAccess) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, postgresAccessImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PostgresAccess") + case "id": + out.Values[i] = ec._PostgresAccess_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "name": + out.Values[i] = ec._PostgresAccess_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "team": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._PostgresAccess_team(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "teamEnvironment": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._PostgresAccess_teamEnvironment(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } -func (ec *executionContext) unmarshalInputGrantPostgresAccessInput(ctx context.Context, obj any) (postgres.GrantPostgresAccessInput, error) { - var it postgres.GrantPostgresAccessInput - if obj == nil { - return it, nil - } + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } - fieldsInOrder := [...]string{"clusterName", "teamSlug", "environmentName", "grantee", "duration"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "clusterName": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clusterName")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "postgresInstance": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._PostgresAccess_postgresInstance(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res } - it.ClusterName = data - case "teamSlug": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamSlug")) - data, err := ec.unmarshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) - if err != nil { - return it, err + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } - it.TeamSlug = data - case "environmentName": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentName")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "accessLevel": + out.Values[i] = ec._PostgresAccess_accessLevel(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.EnvironmentName = data - case "grantee": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("grantee")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + case "expiresAt": + out.Values[i] = ec._PostgresAccess_expiresAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.Grantee = data - case "duration": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("duration")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + case "state": + out.Values[i] = ec._PostgresAccess_state(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) } - it.Duration = data + case "message": + out.Values[i] = ec._PostgresAccess_message(ctx, field, obj) + case "tunnel": + out.Values[i] = ec._PostgresAccess_tunnel(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } } - return it, nil -} - -func (ec *executionContext) unmarshalInputPostgresInstanceFilter(ctx context.Context, obj any) (postgres.PostgresInstanceFilter, error) { - var it postgres.PostgresInstanceFilter - if obj == nil { - return it, nil + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null } - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) - fieldsInOrder := [...]string{"name", "environments", "states", "highAvailability", "majorVersions", "labels"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "environments": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environments")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.Environments = data - case "states": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("states")) - data, err := ec.unmarshalOPostgresInstanceState2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceStateᚄ(ctx, v) - if err != nil { - return it, err - } - it.States = data - case "highAvailability": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("highAvailability")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) - if err != nil { - return it, err - } - it.HighAvailability = data - case "majorVersions": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("majorVersions")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.MajorVersions = data - case "labels": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labels")) - data, err := ec.unmarshalOLabelFilter2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐLabelFiltersᚄ(ctx, v) - if err != nil { - return it, err - } - it.Labels = data - } + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) } - return it, nil + + return out } -func (ec *executionContext) unmarshalInputPostgresInstanceOrder(ctx context.Context, obj any) (postgres.PostgresInstanceOrder, error) { - var it postgres.PostgresInstanceOrder - if obj == nil { - return it, nil - } +var postgresAccessConnectionImplementors = []string{"PostgresAccessConnection"} - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } +func (ec *executionContext) _PostgresAccessConnection(ctx context.Context, sel ast.SelectionSet, obj *postgres.PostgresAccessConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, postgresAccessConnectionImplementors) - fieldsInOrder := [...]string{"field", "direction"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "field": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNPostgresInstanceOrderField2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceOrderField(ctx, v) - if err != nil { - return it, err + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PostgresAccessConnection") + case "password": + out.Values[i] = ec._PostgresAccessConnection_password(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Field = data - case "direction": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) - data, err := ec.unmarshalNOrderDirection2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋmodelᚐOrderDirection(ctx, v) - if err != nil { - return it, err + case "caCertificate": + out.Values[i] = ec._PostgresAccessConnection_caCertificate(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Direction = data + case "serverName": + out.Values[i] = ec._PostgresAccessConnection_serverName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "tunnel": + out.Values[i] = ec._PostgresAccessConnection_tunnel(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } } - return it, nil -} - -// endregion **************************** input.gotpl ***************************** + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } -// region ************************** interface.gotpl *************************** + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) -// endregion ************************** interface.gotpl *************************** + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } -// region **************************** object.gotpl **************************** + return out +} -var deletePostgresPayloadImplementors = []string{"DeletePostgresPayload"} +var postgresAccessConnectionTunnelImplementors = []string{"PostgresAccessConnectionTunnel"} -func (ec *executionContext) _DeletePostgresPayload(ctx context.Context, sel ast.SelectionSet, obj *postgres.DeletePostgresPayload) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, deletePostgresPayloadImplementors) +func (ec *executionContext) _PostgresAccessConnectionTunnel(ctx context.Context, sel ast.SelectionSet, obj *postgres.PostgresAccessConnectionTunnel) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, postgresAccessConnectionTunnelImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("DeletePostgresPayload") - case "postgresDeleted": - out.Values[i] = ec._DeletePostgresPayload_postgresDeleted(ctx, field, obj) + out.Values[i] = graphql.MarshalString("PostgresAccessConnectionTunnel") + case "endpoint": + out.Values[i] = ec._PostgresAccessConnectionTunnel_endpoint(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "gatewayPublicKey": + out.Values[i] = ec._PostgresAccessConnectionTunnel_gatewayPublicKey(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -1777,19 +3244,26 @@ func (ec *executionContext) _DeletePostgresPayload(ctx context.Context, sel ast. return out } -var grantPostgresAccessPayloadImplementors = []string{"GrantPostgresAccessPayload"} +var postgresAccessTunnelImplementors = []string{"PostgresAccessTunnel"} -func (ec *executionContext) _GrantPostgresAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *postgres.GrantPostgresAccessPayload) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, grantPostgresAccessPayloadImplementors) +func (ec *executionContext) _PostgresAccessTunnel(ctx context.Context, sel ast.SelectionSet, obj *postgres.PostgresAccessTunnel) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, postgresAccessTunnelImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("GrantPostgresAccessPayload") - case "error": - out.Values[i] = ec._GrantPostgresAccessPayload_error(ctx, field, obj) + out.Values[i] = graphql.MarshalString("PostgresAccessTunnel") + case "name": + out.Values[i] = ec._PostgresAccessTunnel_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "endpoint": + out.Values[i] = ec._PostgresAccessTunnel_endpoint(ctx, field, obj) + case "gatewayPublicKey": + out.Values[i] = ec._PostgresAccessTunnel_gatewayPublicKey(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -2739,6 +4213,202 @@ func (ec *executionContext) _PostgresInstanceStateFacetItem(ctx context.Context, return out } +var postgresPersonalAccessConnectionActivityLogEntryImplementors = []string{"PostgresPersonalAccessConnectionActivityLogEntry", "ActivityLogEntry", "Node"} + +func (ec *executionContext) _PostgresPersonalAccessConnectionActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *postgres.PostgresPersonalAccessConnectionActivityLogEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, postgresPersonalAccessConnectionActivityLogEntryImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PostgresPersonalAccessConnectionActivityLogEntry") + case "id": + out.Values[i] = ec._PostgresPersonalAccessConnectionActivityLogEntry_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "actor": + out.Values[i] = ec._PostgresPersonalAccessConnectionActivityLogEntry_actor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._PostgresPersonalAccessConnectionActivityLogEntry_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._PostgresPersonalAccessConnectionActivityLogEntry_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceType": + out.Values[i] = ec._PostgresPersonalAccessConnectionActivityLogEntry_resourceType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceName": + out.Values[i] = ec._PostgresPersonalAccessConnectionActivityLogEntry_resourceName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamSlug": + out.Values[i] = ec._PostgresPersonalAccessConnectionActivityLogEntry_teamSlug(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "environmentName": + out.Values[i] = ec._PostgresPersonalAccessConnectionActivityLogEntry_environmentName(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var postgresPersonalAccessCreatedActivityLogEntryImplementors = []string{"PostgresPersonalAccessCreatedActivityLogEntry", "ActivityLogEntry", "Node"} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, postgresPersonalAccessCreatedActivityLogEntryImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PostgresPersonalAccessCreatedActivityLogEntry") + case "id": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntry_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "actor": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntry_actor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntry_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntry_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceType": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntry_resourceType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceName": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntry_resourceName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamSlug": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntry_teamSlug(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "environmentName": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntry_environmentName(ctx, field, obj) + case "data": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntry_data(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var postgresPersonalAccessCreatedActivityLogEntryDataImplementors = []string{"PostgresPersonalAccessCreatedActivityLogEntryData"} + +func (ec *executionContext) _PostgresPersonalAccessCreatedActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *postgres.PostgresPersonalAccessCreatedActivityLogEntryData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, postgresPersonalAccessCreatedActivityLogEntryDataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PostgresPersonalAccessCreatedActivityLogEntryData") + case "username": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntryData_username(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "expiresAt": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntryData_expiresAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "reason": + out.Values[i] = ec._PostgresPersonalAccessCreatedActivityLogEntryData_reason(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var teamInventoryCountPostgresInstancesImplementors = []string{"TeamInventoryCountPostgresInstances"} func (ec *executionContext) _TeamInventoryCountPostgresInstances(ctx context.Context, sel ast.SelectionSet, obj *postgres.TeamInventoryCountPostgresInstances) graphql.Marshaler { @@ -2782,6 +4452,25 @@ func (ec *executionContext) _TeamInventoryCountPostgresInstances(ctx context.Con // region ***************************** type.gotpl ***************************** +func (ec *executionContext) unmarshalNCreatePostgresAccessInput2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐCreatePostgresAccessInput(ctx context.Context, v any) (postgres.CreatePostgresAccessInput, error) { + res, err := ec.unmarshalInputCreatePostgresAccessInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCreatePostgresAccessPayload2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐCreatePostgresAccessPayload(ctx context.Context, sel ast.SelectionSet, v postgres.CreatePostgresAccessPayload) graphql.Marshaler { + return ec._CreatePostgresAccessPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCreatePostgresAccessPayload2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐCreatePostgresAccessPayload(ctx context.Context, sel ast.SelectionSet, v *postgres.CreatePostgresAccessPayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._CreatePostgresAccessPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNDeletePostgresInput2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐDeletePostgresInput(ctx context.Context, v any) (postgres.DeletePostgresInput, error) { res, err := ec.unmarshalInputDeletePostgresInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -2820,6 +4509,63 @@ func (ec *executionContext) marshalNGrantPostgresAccessPayload2ᚖgithubᚗcom return ec._GrantPostgresAccessPayload(ctx, sel, v) } +func (ec *executionContext) marshalNPostgresAccess2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccess(ctx context.Context, sel ast.SelectionSet, v postgres.PostgresAccess) graphql.Marshaler { + return ec._PostgresAccess(ctx, sel, &v) +} + +func (ec *executionContext) marshalNPostgresAccess2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccess(ctx context.Context, sel ast.SelectionSet, v *postgres.PostgresAccess) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._PostgresAccess(ctx, sel, v) +} + +func (ec *executionContext) marshalNPostgresAccessConnection2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessConnection(ctx context.Context, sel ast.SelectionSet, v postgres.PostgresAccessConnection) graphql.Marshaler { + return ec._PostgresAccessConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNPostgresAccessConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessConnection(ctx context.Context, sel ast.SelectionSet, v *postgres.PostgresAccessConnection) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._PostgresAccessConnection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNPostgresAccessConnectionInput2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessConnectionInput(ctx context.Context, v any) (postgres.PostgresAccessConnectionInput, error) { + res, err := ec.unmarshalInputPostgresAccessConnectionInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNPostgresAccessConnectionTunnel2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessConnectionTunnel(ctx context.Context, sel ast.SelectionSet, v postgres.PostgresAccessConnectionTunnel) graphql.Marshaler { + return ec._PostgresAccessConnectionTunnel(ctx, sel, &v) +} + +func (ec *executionContext) unmarshalNPostgresAccessLevel2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessLevel(ctx context.Context, v any) (postgres.PostgresAccessLevel, error) { + var res postgres.PostgresAccessLevel + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNPostgresAccessLevel2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessLevel(ctx context.Context, sel ast.SelectionSet, v postgres.PostgresAccessLevel) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNPostgresAccessState2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessState(ctx context.Context, v any) (postgres.PostgresAccessState, error) { + var res postgres.PostgresAccessState + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNPostgresAccessState2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessState(ctx context.Context, sel ast.SelectionSet, v postgres.PostgresAccessState) graphql.Marshaler { + return v +} + func (ec *executionContext) marshalNPostgresGrantAccessActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresGrantAccessActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *postgres.PostgresGrantAccessActivityLogEntryData) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -2948,6 +4694,16 @@ func (ec *executionContext) marshalNPostgresInstanceStateFacetItem2ᚕgithubᚗc return ret } +func (ec *executionContext) marshalNPostgresPersonalAccessCreatedActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresPersonalAccessCreatedActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *postgres.PostgresPersonalAccessCreatedActivityLogEntryData) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._PostgresPersonalAccessCreatedActivityLogEntryData(ctx, sel, v) +} + func (ec *executionContext) marshalNTeamInventoryCountPostgresInstances2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐTeamInventoryCountPostgresInstances(ctx context.Context, sel ast.SelectionSet, v postgres.TeamInventoryCountPostgresInstances) graphql.Marshaler { return ec._TeamInventoryCountPostgresInstances(ctx, sel, &v) } @@ -2962,6 +4718,13 @@ func (ec *executionContext) marshalNTeamInventoryCountPostgresInstances2ᚖgithu return ec._TeamInventoryCountPostgresInstances(ctx, sel, v) } +func (ec *executionContext) marshalOPostgresAccessTunnel2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessTunnel(ctx context.Context, sel ast.SelectionSet, v *postgres.PostgresAccessTunnel) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._PostgresAccessTunnel(ctx, sel, v) +} + func (ec *executionContext) marshalOPostgresInstanceFacets2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresInstanceFacets(ctx context.Context, sel ast.SelectionSet, v *postgres.PostgresInstanceFacets) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/internal/graph/gengql/root_.generated.go b/internal/graph/gengql/root_.generated.go index ad96f7900..32ada8427 100644 --- a/internal/graph/gengql/root_.generated.go +++ b/internal/graph/gengql/root_.generated.go @@ -105,6 +105,7 @@ type ResolverRoot interface { OpenSearchConnection() OpenSearchConnectionResolver OpenSearchIssue() OpenSearchIssueResolver OpenSearchMaintenance() OpenSearchMaintenanceResolver + PostgresAccess() PostgresAccessResolver PostgresInstance() PostgresInstanceResolver PostgresInstanceAudit() PostgresInstanceAuditResolver PostgresInstanceConnection() PostgresInstanceConnectionResolver @@ -722,6 +723,11 @@ type ComplexityRoot struct { OpenSearch func(childComplexity int) int } + CreatePostgresAccessPayload struct { + ExpiresAt func(childComplexity int) int + Name func(childComplexity int) int + } + CreateSecretPayload struct { Secret func(childComplexity int) int } @@ -1589,6 +1595,7 @@ type ComplexityRoot struct { CreateKafkaCredentials func(childComplexity int, input kafkatopic.CreateKafkaCredentialsInput) int CreateOpenSearch func(childComplexity int, input opensearch.CreateOpenSearchInput) int CreateOpenSearchCredentials func(childComplexity int, input opensearch.CreateOpenSearchCredentialsInput) int + CreatePostgresAccess func(childComplexity int, input postgres.CreatePostgresAccessInput) int CreateSecret func(childComplexity int, input secret.CreateSecretInput) int CreateServiceAccount func(childComplexity int, input serviceaccount.CreateServiceAccountInput) int CreateServiceAccountToken func(childComplexity int, input serviceaccount.CreateServiceAccountTokenInput) int @@ -1852,6 +1859,37 @@ type ComplexityRoot struct { TotalCount func(childComplexity int) int } + PostgresAccess struct { + AccessLevel func(childComplexity int) int + ExpiresAt func(childComplexity int) int + ID func(childComplexity int) int + Message func(childComplexity int) int + Name func(childComplexity int) int + PostgresInstance func(childComplexity int) int + State func(childComplexity int) int + Team func(childComplexity int) int + TeamEnvironment func(childComplexity int) int + Tunnel func(childComplexity int) int + } + + PostgresAccessConnection struct { + CACertificate func(childComplexity int) int + Password func(childComplexity int) int + ServerName func(childComplexity int) int + Tunnel func(childComplexity int) int + } + + PostgresAccessConnectionTunnel struct { + Endpoint func(childComplexity int) int + GatewayPublicKey func(childComplexity int) int + } + + PostgresAccessTunnel struct { + Endpoint func(childComplexity int) int + GatewayPublicKey func(childComplexity int) int + Name func(childComplexity int) int + } + PostgresDeletedActivityLogEntry struct { Actor func(childComplexity int) int CreatedAt func(childComplexity int) int @@ -1937,6 +1975,35 @@ type ComplexityRoot struct { State func(childComplexity int) int } + PostgresPersonalAccessConnectionActivityLogEntry struct { + Actor func(childComplexity int) int + CreatedAt func(childComplexity int) int + EnvironmentName func(childComplexity int) int + ID func(childComplexity int) int + Message func(childComplexity int) int + ResourceName func(childComplexity int) int + ResourceType func(childComplexity int) int + TeamSlug func(childComplexity int) int + } + + PostgresPersonalAccessCreatedActivityLogEntry struct { + Actor func(childComplexity int) int + CreatedAt func(childComplexity int) int + Data func(childComplexity int) int + EnvironmentName func(childComplexity int) int + ID func(childComplexity int) int + Message func(childComplexity int) int + ResourceName func(childComplexity int) int + ResourceType func(childComplexity int) int + TeamSlug func(childComplexity int) int + } + + PostgresPersonalAccessCreatedActivityLogEntryData struct { + ExpiresAt func(childComplexity int) int + Reason func(childComplexity int) int + Username func(childComplexity int) int + } + Price struct { Value func(childComplexity int) int } @@ -1975,6 +2042,8 @@ type ComplexityRoot struct { ImageVulnerabilityHistory func(childComplexity int, from scalar.Date) int Me func(childComplexity int) int Node func(childComplexity int, id ident.Ident) int + PostgresAccess func(childComplexity int, name string, teamSlug slug.Slug, environmentName string) int + PostgresAccessConnection func(childComplexity int, input postgres.PostgresAccessConnectionInput) int Reconcilers func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int Roles func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *authz.RoleFilter) int Search func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter search.SearchFilter) int @@ -6172,6 +6241,20 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.CreateOpenSearchPayload.OpenSearch(childComplexity), true + case "CreatePostgresAccessPayload.expiresAt": + if e.ComplexityRoot.CreatePostgresAccessPayload.ExpiresAt == nil { + break + } + + return e.ComplexityRoot.CreatePostgresAccessPayload.ExpiresAt(childComplexity), true + + case "CreatePostgresAccessPayload.name": + if e.ComplexityRoot.CreatePostgresAccessPayload.Name == nil { + break + } + + return e.ComplexityRoot.CreatePostgresAccessPayload.Name(childComplexity), true + case "CreateSecretPayload.secret": if e.ComplexityRoot.CreateSecretPayload.Secret == nil { break @@ -9716,6 +9799,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Mutation.CreateOpenSearchCredentials(childComplexity, args["input"].(opensearch.CreateOpenSearchCredentialsInput)), true + case "Mutation.createPostgresAccess": + if e.ComplexityRoot.Mutation.CreatePostgresAccess == nil { + break + } + + args, err := ec.field_Mutation_createPostgresAccess_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.CreatePostgresAccess(childComplexity, args["input"].(postgres.CreatePostgresAccessInput)), true + case "Mutation.createSecret": if e.ComplexityRoot.Mutation.CreateSecret == nil { break @@ -11235,6 +11330,139 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.PageInfo.TotalCount(childComplexity), true + case "PostgresAccess.accessLevel": + if e.ComplexityRoot.PostgresAccess.AccessLevel == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.AccessLevel(childComplexity), true + + case "PostgresAccess.expiresAt": + if e.ComplexityRoot.PostgresAccess.ExpiresAt == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.ExpiresAt(childComplexity), true + + case "PostgresAccess.id": + if e.ComplexityRoot.PostgresAccess.ID == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.ID(childComplexity), true + + case "PostgresAccess.message": + if e.ComplexityRoot.PostgresAccess.Message == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.Message(childComplexity), true + + case "PostgresAccess.name": + if e.ComplexityRoot.PostgresAccess.Name == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.Name(childComplexity), true + + case "PostgresAccess.postgresInstance": + if e.ComplexityRoot.PostgresAccess.PostgresInstance == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.PostgresInstance(childComplexity), true + + case "PostgresAccess.state": + if e.ComplexityRoot.PostgresAccess.State == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.State(childComplexity), true + + case "PostgresAccess.team": + if e.ComplexityRoot.PostgresAccess.Team == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.Team(childComplexity), true + + case "PostgresAccess.teamEnvironment": + if e.ComplexityRoot.PostgresAccess.TeamEnvironment == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.TeamEnvironment(childComplexity), true + + case "PostgresAccess.tunnel": + if e.ComplexityRoot.PostgresAccess.Tunnel == nil { + break + } + + return e.ComplexityRoot.PostgresAccess.Tunnel(childComplexity), true + + case "PostgresAccessConnection.caCertificate": + if e.ComplexityRoot.PostgresAccessConnection.CACertificate == nil { + break + } + + return e.ComplexityRoot.PostgresAccessConnection.CACertificate(childComplexity), true + + case "PostgresAccessConnection.password": + if e.ComplexityRoot.PostgresAccessConnection.Password == nil { + break + } + + return e.ComplexityRoot.PostgresAccessConnection.Password(childComplexity), true + + case "PostgresAccessConnection.serverName": + if e.ComplexityRoot.PostgresAccessConnection.ServerName == nil { + break + } + + return e.ComplexityRoot.PostgresAccessConnection.ServerName(childComplexity), true + + case "PostgresAccessConnection.tunnel": + if e.ComplexityRoot.PostgresAccessConnection.Tunnel == nil { + break + } + + return e.ComplexityRoot.PostgresAccessConnection.Tunnel(childComplexity), true + + case "PostgresAccessConnectionTunnel.endpoint": + if e.ComplexityRoot.PostgresAccessConnectionTunnel.Endpoint == nil { + break + } + + return e.ComplexityRoot.PostgresAccessConnectionTunnel.Endpoint(childComplexity), true + + case "PostgresAccessConnectionTunnel.gatewayPublicKey": + if e.ComplexityRoot.PostgresAccessConnectionTunnel.GatewayPublicKey == nil { + break + } + + return e.ComplexityRoot.PostgresAccessConnectionTunnel.GatewayPublicKey(childComplexity), true + + case "PostgresAccessTunnel.endpoint": + if e.ComplexityRoot.PostgresAccessTunnel.Endpoint == nil { + break + } + + return e.ComplexityRoot.PostgresAccessTunnel.Endpoint(childComplexity), true + + case "PostgresAccessTunnel.gatewayPublicKey": + if e.ComplexityRoot.PostgresAccessTunnel.GatewayPublicKey == nil { + break + } + + return e.ComplexityRoot.PostgresAccessTunnel.GatewayPublicKey(childComplexity), true + + case "PostgresAccessTunnel.name": + if e.ComplexityRoot.PostgresAccessTunnel.Name == nil { + break + } + + return e.ComplexityRoot.PostgresAccessTunnel.Name(childComplexity), true + case "PostgresDeletedActivityLogEntry.actor": if e.ComplexityRoot.PostgresDeletedActivityLogEntry.Actor == nil { break @@ -11604,6 +11832,146 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.PostgresInstanceStateFacetItem.State(childComplexity), true + case "PostgresPersonalAccessConnectionActivityLogEntry.actor": + if e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.Actor == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.Actor(childComplexity), true + + case "PostgresPersonalAccessConnectionActivityLogEntry.createdAt": + if e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.CreatedAt == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.CreatedAt(childComplexity), true + + case "PostgresPersonalAccessConnectionActivityLogEntry.environmentName": + if e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.EnvironmentName == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.EnvironmentName(childComplexity), true + + case "PostgresPersonalAccessConnectionActivityLogEntry.id": + if e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.ID == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.ID(childComplexity), true + + case "PostgresPersonalAccessConnectionActivityLogEntry.message": + if e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.Message == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.Message(childComplexity), true + + case "PostgresPersonalAccessConnectionActivityLogEntry.resourceName": + if e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.ResourceName == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.ResourceName(childComplexity), true + + case "PostgresPersonalAccessConnectionActivityLogEntry.resourceType": + if e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.ResourceType == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.ResourceType(childComplexity), true + + case "PostgresPersonalAccessConnectionActivityLogEntry.teamSlug": + if e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.TeamSlug == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessConnectionActivityLogEntry.TeamSlug(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntry.actor": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.Actor == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.Actor(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntry.createdAt": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.CreatedAt == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.CreatedAt(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntry.data": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.Data == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.Data(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntry.environmentName": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.EnvironmentName == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.EnvironmentName(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntry.id": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.ID == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.ID(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntry.message": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.Message == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.Message(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntry.resourceName": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.ResourceName == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.ResourceName(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntry.resourceType": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.ResourceType == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.ResourceType(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntry.teamSlug": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.TeamSlug == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntry.TeamSlug(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntryData.expiresAt": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntryData.ExpiresAt == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntryData.ExpiresAt(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntryData.reason": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntryData.Reason == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntryData.Reason(childComplexity), true + + case "PostgresPersonalAccessCreatedActivityLogEntryData.username": + if e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntryData.Username == nil { + break + } + + return e.ComplexityRoot.PostgresPersonalAccessCreatedActivityLogEntryData.Username(childComplexity), true + case "Price.value": if e.ComplexityRoot.Price.Value == nil { break @@ -11845,6 +12213,30 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Query.Node(childComplexity, args["id"].(ident.Ident)), true + case "Query.postgresAccess": + if e.ComplexityRoot.Query.PostgresAccess == nil { + break + } + + args, err := ec.field_Query_postgresAccess_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.PostgresAccess(childComplexity, args["name"].(string), args["teamSlug"].(slug.Slug), args["environmentName"].(string)), true + + case "Query.postgresAccessConnection": + if e.ComplexityRoot.Query.PostgresAccessConnection == nil { + break + } + + args, err := ec.field_Query_postgresAccessConnection_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.PostgresAccessConnection(childComplexity, args["input"].(postgres.PostgresAccessConnectionInput)), true + case "Query.reconcilers": if e.ComplexityRoot.Query.Reconcilers == nil { break @@ -19890,6 +20282,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputCreateKafkaCredentialsInput, ec.unmarshalInputCreateOpenSearchCredentialsInput, ec.unmarshalInputCreateOpenSearchInput, + ec.unmarshalInputCreatePostgresAccessInput, ec.unmarshalInputCreateSecretInput, ec.unmarshalInputCreateServiceAccountInput, ec.unmarshalInputCreateServiceAccountTokenInput, @@ -19935,6 +20328,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputOpenSearchAccessOrder, ec.unmarshalInputOpenSearchFilter, ec.unmarshalInputOpenSearchOrder, + ec.unmarshalInputPostgresAccessConnectionInput, ec.unmarshalInputPostgresInstanceFilter, ec.unmarshalInputPostgresInstanceOrder, ec.unmarshalInputReconcilerConfigInput, @@ -26543,6 +26937,58 @@ type PostgresGrantAccessActivityLogEntryData { until: Time! } +"An audit-log entry for personal Postgres access created through the API broker." +type PostgresPersonalAccessCreatedActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + "The identity of the actor who created the personal access." + actor: String! + "Creation time of the entry." + createdAt: Time! + "Message that summarizes the entry." + message: String! + "Type of the affected resource." + resourceType: ActivityLogEntryResourceType! + "Name of the affected Postgres instance." + resourceName: String! + "The team slug that the entry belongs to." + teamSlug: Slug! + "The environment name that the entry belongs to." + environmentName: String + "Personal-access specific audit data." + data: PostgresPersonalAccessCreatedActivityLogEntryData! +} + +"Personal-access-specific audit data." +type PostgresPersonalAccessCreatedActivityLogEntryData { + "Identity that owns the new personal access." + username: String! + "Server-controlled expiry of the access." + expiresAt: Time! + "Caller-provided audit reason." + reason: String! +} + +"An audit-log entry for retrieval of personal Postgres connection materials." +type PostgresPersonalAccessConnectionActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + "Identity that retrieved the connection materials." + actor: String! + "Creation time of the entry." + createdAt: Time! + "Message that summarizes the entry." + message: String! + "Type of the affected resource." + resourceType: ActivityLogEntryResourceType! + "Name of the affected PostgresAccess resource." + resourceName: String! + "Team slug that the entry belongs to." + teamSlug: Slug! + "Environment name that the entry belongs to." + environmentName: String +} + type PostgresDeletedActivityLogEntry implements ActivityLogEntry & Node { "ID of the entry." id: ID! @@ -26575,18 +27021,70 @@ extend enum ActivityLogActivityType { """ POSTGRES_GRANT_ACCESS """ + A personal Postgres access was created through the API broker + """ + POSTGRES_PERSONAL_ACCESS_CREATED + """ + Personal Postgres connection materials were retrieved + """ + POSTGRES_PERSONAL_ACCESS_CONNECTION + """ A Postgres instance was deleted """ POSTGRES_DELETED } extend type Mutation { - "Grant temporary access to a Postgres cluster." + """ + Create time-limited personal access to a NAIS Postgres instance through the brokered PostgresAccess and WireGuard tunnel flow. + Use this for new NAIS Postgres personal access. When the access is ready, retrieve its connection materials with postgresAccessConnection. + """ + createPostgresAccess(input: CreatePostgresAccessInput!): CreatePostgresAccessPayload! + """ + Grant time-limited Kubernetes RBAC access to database pods for kubectl port-forward. + Use this existing flow for Cloud SQL access; it does not create a PostgresAccess, WireGuard tunnel, or database credentials. + """ grantPostgresAccess(input: GrantPostgresAccessInput!): GrantPostgresAccessPayload! "Delete an existing Postgres instance." deletePostgres(input: DeletePostgresInput!): DeletePostgresPayload! } +"Result of creating a personal Postgres access." +type CreatePostgresAccessPayload { + "Name of the newly created PostgresAccess resource." + name: String! + "Server-controlled expiry for this personal access." + expiresAt: Time! +} + +"Input for creating a time-limited personal Postgres access." +input CreatePostgresAccessInput { + "Name of the available Postgres instance to access." + postgresInstance: String! + "Team that owns the Postgres instance." + teamSlug: Slug! + "Environment containing the Postgres instance." + environmentName: String! + "Privileges requested for the personal database role." + accessLevel: PostgresAccessLevel! + "WireGuard public key generated by the client for this access." + clientWireGuardPublicKey: String! + "Reason for personal database access. Must be at least 10 characters." + reason: String! + "Requested access lifetime (for example '1h' or '4h'). Defaults to '1h' and cannot exceed '8h'." + ttl: String +} + +"Privilege level granted to a personal Postgres database role." +enum PostgresAccessLevel { + "Read data without modifying it." + READ + "Read and modify existing data." + READWRITE + "Read, modify, and create database objects where supported." + READWRITECREATE +} + type GrantPostgresAccessPayload { error: String } @@ -26622,6 +27120,99 @@ type TeamInventoryCountPostgresInstances { "Total number of Postgres instances." total: Int! } + +extend type Query { + "Get connection materials for a ready personal Postgres access owned by the caller." + postgresAccessConnection(input: PostgresAccessConnectionInput!): PostgresAccessConnection! + + "Get a personal PostgresAccess resource and its state. Available to authorized team members." + postgresAccess( + "Name of the PostgresAccess resource." + name: String! + + "Team slug that owns the Postgres instance." + teamSlug: Slug! + + "Environment name that the Postgres instance belongs to." + environmentName: String! + ): PostgresAccess! +} + +"A time-limited personal access request for a Postgres instance." +type PostgresAccess implements Node { + "Opaque ID for this PostgresAccess resource." + id: ID! + "Name of the PostgresAccess resource." + name: String! + "Team that owns the access." + team: Team! + "Environment for the access." + teamEnvironment: TeamEnvironment! + "Postgres instance this access is for." + postgresInstance: PostgresInstance! + "Requested access level." + accessLevel: PostgresAccessLevel! + "Server-controlled expiry for this personal access." + expiresAt: Time! + "High-level state of the access." + state: PostgresAccessState! + "Human-readable message for the current state." + message: String + "Tunnel connection details, once the controller has created them." + tunnel: PostgresAccessTunnel +} + +"High-level reconciliation state of a personal Postgres access." +enum PostgresAccessState { + "The controller has not finished provisioning the access." + PENDING + "The access and its connection materials are ready." + READY + "The controller cannot provision the requested access." + FAILED + "The server-controlled expiry time has passed." + EXPIRED +} + +"Tunnel details reported while provisioning a personal Postgres access." +type PostgresAccessTunnel { + "Name of the Tunnel resource owned by this access." + name: String! + "Gateway endpoint the client should connect to." + endpoint: String + "Gateway's WireGuard public key." + gatewayPublicKey: String +} + +"Input for retrieving connection materials for a ready personal access." +input PostgresAccessConnectionInput { + "Name of the PostgresAccess resource." + name: String! + "Team that owns the PostgresAccess resource." + teamSlug: Slug! + "Environment containing the PostgresAccess resource." + environmentName: String! +} + +"Sensitive connection materials for a ready personal Postgres access." +type PostgresAccessConnection { + "Short-lived password for the caller's database role." + password: String! + "CA certificate required to verify the PostgreSQL server certificate." + caCertificate: String! + "PostgreSQL server name used for TLS verification." + serverName: String! + "WireGuard tunnel endpoint and server public key." + tunnel: PostgresAccessConnectionTunnel! +} + +"WireGuard connection parameters for a personal Postgres access." +type PostgresAccessConnectionTunnel { + "Public UDP endpoint of the Tunnel forwarder." + endpoint: String! + "WireGuard public key of the Tunnel gateway." + gatewayPublicKey: String! +} `, BuiltIn: false}, {Name: "../schema/price.graphqls", Input: `extend type Query { """ @@ -34717,6 +35308,16 @@ func (ec *executionContext) childFields_CreateOpenSearchPayload(ctx context.Cont return nil, fmt.Errorf("no field named %q was found under type CreateOpenSearchPayload", field.Name) } +func (ec *executionContext) childFields_CreatePostgresAccessPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_CreatePostgresAccessPayload_name(ctx, field) + case "expiresAt": + return ec.fieldContext_CreatePostgresAccessPayload_expiresAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreatePostgresAccessPayload", field.Name) +} + func (ec *executionContext) childFields_CreateSecretPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "secret": @@ -36279,6 +36880,68 @@ func (ec *executionContext) childFields_PageInfo(ctx context.Context, field grap return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) } +func (ec *executionContext) childFields_PostgresAccess(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_PostgresAccess_id(ctx, field) + case "name": + return ec.fieldContext_PostgresAccess_name(ctx, field) + case "team": + return ec.fieldContext_PostgresAccess_team(ctx, field) + case "teamEnvironment": + return ec.fieldContext_PostgresAccess_teamEnvironment(ctx, field) + case "postgresInstance": + return ec.fieldContext_PostgresAccess_postgresInstance(ctx, field) + case "accessLevel": + return ec.fieldContext_PostgresAccess_accessLevel(ctx, field) + case "expiresAt": + return ec.fieldContext_PostgresAccess_expiresAt(ctx, field) + case "state": + return ec.fieldContext_PostgresAccess_state(ctx, field) + case "message": + return ec.fieldContext_PostgresAccess_message(ctx, field) + case "tunnel": + return ec.fieldContext_PostgresAccess_tunnel(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PostgresAccess", field.Name) +} + +func (ec *executionContext) childFields_PostgresAccessConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "password": + return ec.fieldContext_PostgresAccessConnection_password(ctx, field) + case "caCertificate": + return ec.fieldContext_PostgresAccessConnection_caCertificate(ctx, field) + case "serverName": + return ec.fieldContext_PostgresAccessConnection_serverName(ctx, field) + case "tunnel": + return ec.fieldContext_PostgresAccessConnection_tunnel(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PostgresAccessConnection", field.Name) +} + +func (ec *executionContext) childFields_PostgresAccessConnectionTunnel(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "endpoint": + return ec.fieldContext_PostgresAccessConnectionTunnel_endpoint(ctx, field) + case "gatewayPublicKey": + return ec.fieldContext_PostgresAccessConnectionTunnel_gatewayPublicKey(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PostgresAccessConnectionTunnel", field.Name) +} + +func (ec *executionContext) childFields_PostgresAccessTunnel(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_PostgresAccessTunnel_name(ctx, field) + case "endpoint": + return ec.fieldContext_PostgresAccessTunnel_endpoint(ctx, field) + case "gatewayPublicKey": + return ec.fieldContext_PostgresAccessTunnel_gatewayPublicKey(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PostgresAccessTunnel", field.Name) +} + func (ec *executionContext) childFields_PostgresGrantAccessActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "grantee": @@ -36403,6 +37066,18 @@ func (ec *executionContext) childFields_PostgresInstanceStateFacetItem(ctx conte return nil, fmt.Errorf("no field named %q was found under type PostgresInstanceStateFacetItem", field.Name) } +func (ec *executionContext) childFields_PostgresPersonalAccessCreatedActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "username": + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntryData_username(ctx, field) + case "expiresAt": + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntryData_expiresAt(ctx, field) + case "reason": + return ec.fieldContext_PostgresPersonalAccessCreatedActivityLogEntryData_reason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PostgresPersonalAccessCreatedActivityLogEntryData", field.Name) +} + func (ec *executionContext) childFields_Price(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "value": diff --git a/internal/graph/gengql/schema.generated.go b/internal/graph/gengql/schema.generated.go index b250f46cd..761ed9f9d 100644 --- a/internal/graph/gengql/schema.generated.go +++ b/internal/graph/gengql/schema.generated.go @@ -84,6 +84,7 @@ type MutationResolver interface { UpdateOpenSearch(ctx context.Context, input opensearch.UpdateOpenSearchInput) (*opensearch.UpdateOpenSearchPayload, error) DeleteOpenSearch(ctx context.Context, input opensearch.DeleteOpenSearchInput) (*opensearch.DeleteOpenSearchPayload, error) CreateOpenSearchCredentials(ctx context.Context, input opensearch.CreateOpenSearchCredentialsInput) (*opensearch.CreateOpenSearchCredentialsPayload, error) + CreatePostgresAccess(ctx context.Context, input postgres.CreatePostgresAccessInput) (*postgres.CreatePostgresAccessPayload, error) GrantPostgresAccess(ctx context.Context, input postgres.GrantPostgresAccessInput) (*postgres.GrantPostgresAccessPayload, error) DeletePostgres(ctx context.Context, input postgres.DeletePostgresInput) (*postgres.DeletePostgresPayload, error) EnableReconciler(ctx context.Context, input reconciler.EnableReconcilerInput) (*reconciler.Reconciler, error) @@ -140,6 +141,8 @@ type QueryResolver interface { Environments(ctx context.Context, orderBy *environment.EnvironmentOrder) (*pagination.Connection[*environment.Environment], error) Environment(ctx context.Context, name string) (*environment.Environment, error) Features(ctx context.Context) (*feature.Features, error) + PostgresAccessConnection(ctx context.Context, input postgres.PostgresAccessConnectionInput) (*postgres.PostgresAccessConnection, error) + PostgresAccess(ctx context.Context, name string, teamSlug slug.Slug, environmentName string) (*postgres.PostgresAccess, error) CurrentUnitPrices(ctx context.Context) (*price.CurrentUnitPrices, error) Reconcilers(ctx context.Context, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) (*pagination.Connection[*reconciler.Reconciler], error) Search(ctx context.Context, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter search.SearchFilter) (*pagination.Connection[search.SearchNode], error) @@ -364,6 +367,20 @@ func (ec *executionContext) field_Mutation_createOpenSearch_args(ctx context.Con return args, nil } +func (ec *executionContext) field_Mutation_createPostgresAccess_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (postgres.CreatePostgresAccessInput, error) { + return ec.unmarshalNCreatePostgresAccessInput2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐCreatePostgresAccessInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_createSecret_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1344,6 +1361,50 @@ func (ec *executionContext) field_Query_node_args(ctx context.Context, rawArgs m return args, nil } +func (ec *executionContext) field_Query_postgresAccessConnection_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (postgres.PostgresAccessConnectionInput, error) { + return ec.unmarshalNPostgresAccessConnectionInput2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessConnectionInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_postgresAccess_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "name", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["name"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "teamSlug", + func(ctx context.Context, v any) (slug.Slug, error) { + return ec.unmarshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) + }) + if err != nil { + return nil, err + } + args["teamSlug"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "environmentName", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["environmentName"] = arg2 + return args, nil +} + func (ec *executionContext) field_Query_reconcilers_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -2636,6 +2697,50 @@ func (ec *executionContext) fieldContext_Mutation_createOpenSearchCredentials(ct return fc, nil } +func (ec *executionContext) _Mutation_createPostgresAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_createPostgresAccess(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().CreatePostgresAccess(ctx, fc.Args["input"].(postgres.CreatePostgresAccessInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *postgres.CreatePostgresAccessPayload) graphql.Marshaler { + return ec.marshalNCreatePostgresAccessPayload2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐCreatePostgresAccessPayload(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Mutation_createPostgresAccess(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_CreatePostgresAccessPayload(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createPostgresAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Mutation_grantPostgresAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -5161,6 +5266,94 @@ func (ec *executionContext) fieldContext_Query_features(_ context.Context, field return fc, nil } +func (ec *executionContext) _Query_postgresAccessConnection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_postgresAccessConnection(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().PostgresAccessConnection(ctx, fc.Args["input"].(postgres.PostgresAccessConnectionInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresAccessConnection) graphql.Marshaler { + return ec.marshalNPostgresAccessConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccessConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_postgresAccessConnection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresAccessConnection(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_postgresAccessConnection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_postgresAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_postgresAccess(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().PostgresAccess(ctx, fc.Args["name"].(string), fc.Args["teamSlug"].(slug.Slug), fc.Args["environmentName"].(string)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *postgres.PostgresAccess) graphql.Marshaler { + return ec.marshalNPostgresAccess2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋpostgresᚐPostgresAccess(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_postgresAccess(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PostgresAccess(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_postgresAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query_currentUnitPrices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -6525,6 +6718,20 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._PrometheusAlert(ctx, sel, obj) + case postgres.PostgresPersonalAccessCreatedActivityLogEntry: + return ec._PostgresPersonalAccessCreatedActivityLogEntry(ctx, sel, &obj) + case *postgres.PostgresPersonalAccessCreatedActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._PostgresPersonalAccessCreatedActivityLogEntry(ctx, sel, obj) + case postgres.PostgresPersonalAccessConnectionActivityLogEntry: + return ec._PostgresPersonalAccessConnectionActivityLogEntry(ctx, sel, &obj) + case *postgres.PostgresPersonalAccessConnectionActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._PostgresPersonalAccessConnectionActivityLogEntry(ctx, sel, obj) case postgres.PostgresInstance: return ec._PostgresInstance(ctx, sel, &obj) case *postgres.PostgresInstance: @@ -6913,6 +7120,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._ReconcilerError(ctx, sel, obj) + case postgres.PostgresAccess: + return ec._PostgresAccess(ctx, sel, &obj) + case *postgres.PostgresAccess: + if obj == nil { + return graphql.Null + } + return ec._PostgresAccess(ctx, sel, obj) case persistence.Persistence: if obj == nil { return graphql.Null @@ -7234,6 +7448,13 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "createPostgresAccess": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createPostgresAccess(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "grantPostgresAccess": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_grantPostgresAccess(ctx, field) @@ -7827,6 +8048,50 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "postgresAccessConnection": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_postgresAccessConnection(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "postgresAccess": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_postgresAccess(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "currentUnitPrices": field := field diff --git a/internal/graph/postgres.resolvers.go b/internal/graph/postgres.resolvers.go index ae99730ab..fd932fa53 100644 --- a/internal/graph/postgres.resolvers.go +++ b/internal/graph/postgres.resolvers.go @@ -7,6 +7,7 @@ import ( "github.com/nais/api/internal/graph/gengql" "github.com/nais/api/internal/graph/pagination" "github.com/nais/api/internal/persistence/postgres" + "github.com/nais/api/internal/slug" "github.com/nais/api/internal/team" "github.com/nais/api/internal/workload" "github.com/nais/api/internal/workload/application" @@ -49,12 +50,20 @@ func (r *jobResolver) PostgresInstances(ctx context.Context, obj *job.Job, order return pagination.NewFacetableConnection(pagination.NewConnectionWithoutPagination(instances), instances, (*postgres.PostgresInstanceFilter)(nil)), nil } +func (r *mutationResolver) CreatePostgresAccess(ctx context.Context, input postgres.CreatePostgresAccessInput) (*postgres.CreatePostgresAccessPayload, error) { + if err := authz.CanGrantPostgresAccess(ctx, input.TeamSlug); err != nil { + return nil, err + } + + return postgres.CreatePostgresAccess(ctx, input) +} + func (r *mutationResolver) GrantPostgresAccess(ctx context.Context, input postgres.GrantPostgresAccessInput) (*postgres.GrantPostgresAccessPayload, error) { if err := authz.CanGrantPostgresAccess(ctx, input.TeamSlug); err != nil { return nil, err } - if err := postgres.GrantZalandoPostgresAccess(ctx, input); err != nil { + if err := postgres.GrantPostgresAccess(ctx, input); err != nil { return nil, err } @@ -70,6 +79,18 @@ func (r *mutationResolver) DeletePostgres(ctx context.Context, input postgres.De return postgres.Delete(ctx, input) } +func (r *postgresAccessResolver) Team(ctx context.Context, obj *postgres.PostgresAccess) (*team.Team, error) { + return team.Get(ctx, obj.TeamSlug) +} + +func (r *postgresAccessResolver) TeamEnvironment(ctx context.Context, obj *postgres.PostgresAccess) (*team.TeamEnvironment, error) { + return team.GetTeamEnvironment(ctx, obj.TeamSlug, obj.EnvironmentName) +} + +func (r *postgresAccessResolver) PostgresInstance(ctx context.Context, obj *postgres.PostgresAccess) (*postgres.PostgresInstance, error) { + return postgres.GetPostgres(ctx, obj.TeamSlug, obj.EnvironmentName, obj.PostgresInstanceName) +} + func (r *postgresInstanceResolver) Team(ctx context.Context, obj *postgres.PostgresInstance) (*team.Team, error) { return team.Get(ctx, obj.TeamSlug) } @@ -100,6 +121,14 @@ func (r *postgresInstanceConnectionResolver) Facets(ctx context.Context, obj *pa }, nil } +func (r *queryResolver) PostgresAccessConnection(ctx context.Context, input postgres.PostgresAccessConnectionInput) (*postgres.PostgresAccessConnection, error) { + return postgres.GetPostgresAccessConnection(ctx, input) +} + +func (r *queryResolver) PostgresAccess(ctx context.Context, name string, teamSlug slug.Slug, environmentName string) (*postgres.PostgresAccess, error) { + return postgres.GetPostgresAccess(ctx, name, teamSlug, environmentName) +} + func (r *teamResolver) PostgresInstances(ctx context.Context, obj *team.Team, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *postgres.PostgresInstanceOrder, filter *postgres.PostgresInstanceFilter) (*pagination.FacetableConnection[*postgres.PostgresInstance, *postgres.PostgresInstanceFilter], error) { page, err := pagination.ParsePage(first, after, last, before) if err != nil { @@ -110,7 +139,7 @@ func (r *teamResolver) PostgresInstances(ctx context.Context, obj *team.Team, fi } func (r *teamEnvironmentResolver) PostgresInstance(ctx context.Context, obj *team.TeamEnvironment, name string) (*postgres.PostgresInstance, error) { - return postgres.GetZalandoPostgres(ctx, obj.TeamSlug, obj.EnvironmentName, name) + return postgres.GetPostgres(ctx, obj.TeamSlug, obj.EnvironmentName, name) } func (r *teamInventoryCountsResolver) PostgresInstances(ctx context.Context, obj *team.TeamInventoryCounts) (*postgres.TeamInventoryCountPostgresInstances, error) { @@ -119,6 +148,8 @@ func (r *teamInventoryCountsResolver) PostgresInstances(ctx context.Context, obj }, nil } +func (r *Resolver) PostgresAccess() gengql.PostgresAccessResolver { return &postgresAccessResolver{r} } + func (r *Resolver) PostgresInstance() gengql.PostgresInstanceResolver { return &postgresInstanceResolver{r} } @@ -132,6 +163,7 @@ func (r *Resolver) PostgresInstanceConnection() gengql.PostgresInstanceConnectio } type ( + postgresAccessResolver struct{ *Resolver } postgresInstanceResolver struct{ *Resolver } postgresInstanceAuditResolver struct{ *Resolver } postgresInstanceConnectionResolver struct{ *Resolver } diff --git a/internal/graph/schema/postgres.graphqls b/internal/graph/schema/postgres.graphqls index 1e9c5ceec..2efef5694 100644 --- a/internal/graph/schema/postgres.graphqls +++ b/internal/graph/schema/postgres.graphqls @@ -239,6 +239,58 @@ type PostgresGrantAccessActivityLogEntryData { until: Time! } +"An audit-log entry for personal Postgres access created through the API broker." +type PostgresPersonalAccessCreatedActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + "The identity of the actor who created the personal access." + actor: String! + "Creation time of the entry." + createdAt: Time! + "Message that summarizes the entry." + message: String! + "Type of the affected resource." + resourceType: ActivityLogEntryResourceType! + "Name of the affected Postgres instance." + resourceName: String! + "The team slug that the entry belongs to." + teamSlug: Slug! + "The environment name that the entry belongs to." + environmentName: String + "Personal-access specific audit data." + data: PostgresPersonalAccessCreatedActivityLogEntryData! +} + +"Personal-access-specific audit data." +type PostgresPersonalAccessCreatedActivityLogEntryData { + "Identity that owns the new personal access." + username: String! + "Server-controlled expiry of the access." + expiresAt: Time! + "Caller-provided audit reason." + reason: String! +} + +"An audit-log entry for retrieval of personal Postgres connection materials." +type PostgresPersonalAccessConnectionActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + "Identity that retrieved the connection materials." + actor: String! + "Creation time of the entry." + createdAt: Time! + "Message that summarizes the entry." + message: String! + "Type of the affected resource." + resourceType: ActivityLogEntryResourceType! + "Name of the affected PostgresAccess resource." + resourceName: String! + "Team slug that the entry belongs to." + teamSlug: Slug! + "Environment name that the entry belongs to." + environmentName: String +} + type PostgresDeletedActivityLogEntry implements ActivityLogEntry & Node { "ID of the entry." id: ID! @@ -271,18 +323,70 @@ extend enum ActivityLogActivityType { """ POSTGRES_GRANT_ACCESS """ + A personal Postgres access was created through the API broker + """ + POSTGRES_PERSONAL_ACCESS_CREATED + """ + Personal Postgres connection materials were retrieved + """ + POSTGRES_PERSONAL_ACCESS_CONNECTION + """ A Postgres instance was deleted """ POSTGRES_DELETED } extend type Mutation { - "Grant temporary access to a Postgres cluster." + """ + Create time-limited personal access to a NAIS Postgres instance through the brokered PostgresAccess and WireGuard tunnel flow. + Use this for new NAIS Postgres personal access. When the access is ready, retrieve its connection materials with postgresAccessConnection. + """ + createPostgresAccess(input: CreatePostgresAccessInput!): CreatePostgresAccessPayload! + """ + Grant time-limited Kubernetes RBAC access to database pods for kubectl port-forward. + Use this existing flow for Cloud SQL access; it does not create a PostgresAccess, WireGuard tunnel, or database credentials. + """ grantPostgresAccess(input: GrantPostgresAccessInput!): GrantPostgresAccessPayload! "Delete an existing Postgres instance." deletePostgres(input: DeletePostgresInput!): DeletePostgresPayload! } +"Result of creating a personal Postgres access." +type CreatePostgresAccessPayload { + "Name of the newly created PostgresAccess resource." + name: String! + "Server-controlled expiry for this personal access." + expiresAt: Time! +} + +"Input for creating a time-limited personal Postgres access." +input CreatePostgresAccessInput { + "Name of the available Postgres instance to access." + postgresInstance: String! + "Team that owns the Postgres instance." + teamSlug: Slug! + "Environment containing the Postgres instance." + environmentName: String! + "Privileges requested for the personal database role." + accessLevel: PostgresAccessLevel! + "WireGuard public key generated by the client for this access." + clientWireGuardPublicKey: String! + "Reason for personal database access. Must be at least 10 characters." + reason: String! + "Requested access lifetime (for example '1h' or '4h'). Defaults to '1h' and cannot exceed '8h'." + ttl: String +} + +"Privilege level granted to a personal Postgres database role." +enum PostgresAccessLevel { + "Read data without modifying it." + READ + "Read and modify existing data." + READWRITE + "Read, modify, and create database objects where supported." + READWRITECREATE +} + type GrantPostgresAccessPayload { error: String } @@ -318,3 +422,96 @@ type TeamInventoryCountPostgresInstances { "Total number of Postgres instances." total: Int! } + +extend type Query { + "Get connection materials for a ready personal Postgres access owned by the caller." + postgresAccessConnection(input: PostgresAccessConnectionInput!): PostgresAccessConnection! + + "Get a personal PostgresAccess resource and its state. Available to authorized team members." + postgresAccess( + "Name of the PostgresAccess resource." + name: String! + + "Team slug that owns the Postgres instance." + teamSlug: Slug! + + "Environment name that the Postgres instance belongs to." + environmentName: String! + ): PostgresAccess! +} + +"A time-limited personal access request for a Postgres instance." +type PostgresAccess implements Node { + "Opaque ID for this PostgresAccess resource." + id: ID! + "Name of the PostgresAccess resource." + name: String! + "Team that owns the access." + team: Team! + "Environment for the access." + teamEnvironment: TeamEnvironment! + "Postgres instance this access is for." + postgresInstance: PostgresInstance! + "Requested access level." + accessLevel: PostgresAccessLevel! + "Server-controlled expiry for this personal access." + expiresAt: Time! + "High-level state of the access." + state: PostgresAccessState! + "Human-readable message for the current state." + message: String + "Tunnel connection details, once the controller has created them." + tunnel: PostgresAccessTunnel +} + +"High-level reconciliation state of a personal Postgres access." +enum PostgresAccessState { + "The controller has not finished provisioning the access." + PENDING + "The access and its connection materials are ready." + READY + "The controller cannot provision the requested access." + FAILED + "The server-controlled expiry time has passed." + EXPIRED +} + +"Tunnel details reported while provisioning a personal Postgres access." +type PostgresAccessTunnel { + "Name of the Tunnel resource owned by this access." + name: String! + "Gateway endpoint the client should connect to." + endpoint: String + "Gateway's WireGuard public key." + gatewayPublicKey: String +} + +"Input for retrieving connection materials for a ready personal access." +input PostgresAccessConnectionInput { + "Name of the PostgresAccess resource." + name: String! + "Team that owns the PostgresAccess resource." + teamSlug: Slug! + "Environment containing the PostgresAccess resource." + environmentName: String! +} + +"Sensitive connection materials for a ready personal Postgres access." +type PostgresAccessConnection { + "Short-lived password for the caller's database role." + password: String! + "CA certificate required to verify the PostgreSQL server certificate." + caCertificate: String! + "PostgreSQL server name used for TLS verification." + serverName: String! + "WireGuard tunnel endpoint and server public key." + tunnel: PostgresAccessConnectionTunnel! +} + +"WireGuard connection parameters for a personal Postgres access." +type PostgresAccessConnectionTunnel { + "Public UDP endpoint of the Tunnel forwarder." + endpoint: String! + "WireGuard public key of the Tunnel gateway." + gatewayPublicKey: String! +} diff --git a/internal/grpc/grpc.go b/internal/grpc/grpc.go index 132362244..566a61bf9 100644 --- a/internal/grpc/grpc.go +++ b/internal/grpc/grpc.go @@ -20,7 +20,7 @@ import ( "google.golang.org/grpc" ) -func Run(ctx context.Context, listenAddress string, pool *pgxpool.Pool, sqlDatabaseWatcher *watchers.SqlDatabaseWatcher, zalandoPostgresWatcher *watchers.ZalandoPostgresWatcher, log logrus.FieldLogger) error { +func Run(ctx context.Context, listenAddress string, pool *pgxpool.Pool, sqlDatabaseWatcher *watchers.SqlDatabaseWatcher, postgresWatcher *watchers.PostgresWatcher, log logrus.FieldLogger) error { log.Info("GRPC serving on ", listenAddress) lis, err := net.Listen("tcp", listenAddress) if err != nil { @@ -36,7 +36,7 @@ func Run(ctx context.Context, listenAddress string, pool *pgxpool.Pool, sqlDatab protoapi.RegisterUsersServer(s, grpcuser.NewServer(pool)) protoapi.RegisterReconcilersServer(s, grpcreconciler.NewServer(pool)) protoapi.RegisterDeploymentsServer(s, grpcdeployment.NewServer(pool)) - protoapi.RegisterDatabasesServer(s, grpcdatabase.NewServer(sqlDatabaseWatcher, zalandoPostgresWatcher)) + protoapi.RegisterDatabasesServer(s, grpcdatabase.NewServer(sqlDatabaseWatcher, postgresWatcher)) g, ctx := errgroup.WithContext(ctx) g.Go(func() error { return s.Serve(lis) }) diff --git a/internal/grpc/grpcdatabase/server.go b/internal/grpc/grpcdatabase/server.go index c70509d92..e7ac9de59 100644 --- a/internal/grpc/grpcdatabase/server.go +++ b/internal/grpc/grpcdatabase/server.go @@ -14,21 +14,21 @@ import ( ) type Server struct { - sqlDatabaseWatcher *watchers.SqlDatabaseWatcher - zalandoPostgresWatcher *watchers.ZalandoPostgresWatcher + sqlDatabaseWatcher *watchers.SqlDatabaseWatcher + postgresWatcher *watchers.PostgresWatcher protoapi.UnimplementedDatabasesServer } -func NewServer(sqlDatabaseWatcher *watchers.SqlDatabaseWatcher, zalandoPostgresWatcher *watchers.ZalandoPostgresWatcher) *Server { +func NewServer(sqlDatabaseWatcher *watchers.SqlDatabaseWatcher, postgresWatcher *watchers.PostgresWatcher) *Server { return &Server{ - sqlDatabaseWatcher: sqlDatabaseWatcher, - zalandoPostgresWatcher: zalandoPostgresWatcher, + sqlDatabaseWatcher: sqlDatabaseWatcher, + postgresWatcher: postgresWatcher, } } func (s *Server) List(_ context.Context, r *protoapi.ListDatabasesRequest) (*protoapi.ListDatabasesResponse, error) { sqlDatabases := watcher.Objects(s.sqlDatabaseWatcher.GetByNamespace(r.TeamSlug)) - postgresInstances := watcher.Objects(s.zalandoPostgresWatcher.GetByNamespace(r.TeamSlug)) + postgresInstances := watcher.Objects(s.postgresWatcher.GetByNamespace(r.TeamSlug)) all := make([]*protoapi.Database, 0, len(sqlDatabases)+len(postgresInstances)) for _, d := range sqlDatabases { diff --git a/internal/grpc/grpcdatabase/server_test.go b/internal/grpc/grpcdatabase/server_test.go index ffd895629..a1c6c2700 100644 --- a/internal/grpc/grpcdatabase/server_test.go +++ b/internal/grpc/grpcdatabase/server_test.go @@ -203,7 +203,7 @@ func newServer(t *testing.T, ctx context.Context) *grpcdatabase.Server { t.Cleanup(mgr.Stop) sqlDatabaseWatcher := sqlinstance.NewDatabaseWatcher(ctx, mgr) - zalandoPostgresWatcher := postgres.NewZalandoPostgresWatcher(ctx, mgr) + postgresWatcher := postgres.NewPostgresWatcher(ctx, mgr) ctxWait, cancel := context.WithTimeout(ctx, 5*time.Second) defer cancel() @@ -213,6 +213,6 @@ func newServer(t *testing.T, ctx context.Context) *grpcdatabase.Server { return grpcdatabase.NewServer( (*watchers.SqlDatabaseWatcher)(sqlDatabaseWatcher), - (*watchers.ZalandoPostgresWatcher)(zalandoPostgresWatcher), + (*watchers.PostgresWatcher)(postgresWatcher), ) } diff --git a/internal/kubernetes/watchers/watchers.go b/internal/kubernetes/watchers/watchers.go index e1655ee26..d93fcc555 100644 --- a/internal/kubernetes/watchers/watchers.go +++ b/internal/kubernetes/watchers/watchers.go @@ -29,51 +29,51 @@ import ( ) type ( - AppWatcher = watcher.Watcher[*nais_io_v1alpha1.Application] - JobWatcher = watcher.Watcher[*nais_io_v1.Naisjob] - RunWatcher = watcher.Watcher[*batchv1.Job] - BqWatcher = watcher.Watcher[*bigquery.BigQueryDataset] - ValkeyWatcher = watcher.Watcher[*valkey.Valkey] - OpenSearchWatcher = watcher.Watcher[*opensearch.OpenSearch] - NaisOpenSearchWatcher = watcher.Watcher[*opensearch.OpenSearch] - BucketWatcher = watcher.Watcher[*bucket.Bucket] - SqlDatabaseWatcher = watcher.Watcher[*sqlinstance.SQLDatabase] - SqlInstanceWatcher = watcher.Watcher[*sqlinstance.SQLInstance] - ZalandoPostgresWatcher = watcher.Watcher[*postgres.PostgresInstance] - KafkaTopicWatcher = watcher.Watcher[*kafkatopic.KafkaTopic] - PodWatcher = watcher.Watcher[*v1.Pod] - IngressWatcher = watcher.Watcher[*netv1.Ingress] - NamespaceWatcher = watcher.Watcher[*v1.Namespace] - UnleashWatcher = watcher.Watcher[*unleash.UnleashInstance] - SecretWatcher = watcher.Watcher[*secret.Secret] - ConfigWatcher = watcher.Watcher[*config.Config] - ReplicaSetWatcher = watcher.Watcher[*appsv1.ReplicaSet] - TunnelWatcher = watcher.Watcher[*tunnel.Tunnel] - NaisValkeyWatcher = watcher.Watcher[*valkey.Valkey] + AppWatcher = watcher.Watcher[*nais_io_v1alpha1.Application] + JobWatcher = watcher.Watcher[*nais_io_v1.Naisjob] + RunWatcher = watcher.Watcher[*batchv1.Job] + BqWatcher = watcher.Watcher[*bigquery.BigQueryDataset] + ValkeyWatcher = watcher.Watcher[*valkey.Valkey] + OpenSearchWatcher = watcher.Watcher[*opensearch.OpenSearch] + NaisOpenSearchWatcher = watcher.Watcher[*opensearch.OpenSearch] + BucketWatcher = watcher.Watcher[*bucket.Bucket] + SqlDatabaseWatcher = watcher.Watcher[*sqlinstance.SQLDatabase] + SqlInstanceWatcher = watcher.Watcher[*sqlinstance.SQLInstance] + PostgresWatcher = watcher.Watcher[*postgres.PostgresInstance] + KafkaTopicWatcher = watcher.Watcher[*kafkatopic.KafkaTopic] + PodWatcher = watcher.Watcher[*v1.Pod] + IngressWatcher = watcher.Watcher[*netv1.Ingress] + NamespaceWatcher = watcher.Watcher[*v1.Namespace] + UnleashWatcher = watcher.Watcher[*unleash.UnleashInstance] + SecretWatcher = watcher.Watcher[*secret.Secret] + ConfigWatcher = watcher.Watcher[*config.Config] + ReplicaSetWatcher = watcher.Watcher[*appsv1.ReplicaSet] + TunnelWatcher = watcher.Watcher[*tunnel.Tunnel] + NaisValkeyWatcher = watcher.Watcher[*valkey.Valkey] ) type Watchers struct { - AppWatcher *AppWatcher - JobWatcher *JobWatcher - RunWatcher *RunWatcher - BqWatcher *BqWatcher - ValkeyWatcher *ValkeyWatcher - OpenSearchWatcher *OpenSearchWatcher - NaisOpenSearchWatcher *NaisOpenSearchWatcher - BucketWatcher *BucketWatcher - SqlDatabaseWatcher *SqlDatabaseWatcher - SqlInstanceWatcher *SqlInstanceWatcher - ZalandoPostgresWatcher *ZalandoPostgresWatcher - KafkaTopicWatcher *KafkaTopicWatcher - PodWatcher *PodWatcher - IngressWatcher *IngressWatcher - NamespaceWatcher *NamespaceWatcher - UnleashWatcher *UnleashWatcher - SecretWatcher *SecretWatcher - ConfigWatcher *ConfigWatcher - ReplicaSetWatcher *ReplicaSetWatcher - TunnelWatcher *TunnelWatcher - NaisValkeyWatcher *NaisValkeyWatcher + AppWatcher *AppWatcher + JobWatcher *JobWatcher + RunWatcher *RunWatcher + BqWatcher *BqWatcher + ValkeyWatcher *ValkeyWatcher + OpenSearchWatcher *OpenSearchWatcher + NaisOpenSearchWatcher *NaisOpenSearchWatcher + BucketWatcher *BucketWatcher + SqlDatabaseWatcher *SqlDatabaseWatcher + SqlInstanceWatcher *SqlInstanceWatcher + PostgresWatcher *PostgresWatcher + KafkaTopicWatcher *KafkaTopicWatcher + PodWatcher *PodWatcher + IngressWatcher *IngressWatcher + NamespaceWatcher *NamespaceWatcher + UnleashWatcher *UnleashWatcher + SecretWatcher *SecretWatcher + ConfigWatcher *ConfigWatcher + ReplicaSetWatcher *ReplicaSetWatcher + TunnelWatcher *TunnelWatcher + NaisValkeyWatcher *NaisValkeyWatcher } func SetupWatchers( @@ -83,26 +83,26 @@ func SetupWatchers( unleashEnabled bool, ) *Watchers { ret := &Watchers{ - AppWatcher: application.NewWatcher(ctx, watcherMgr), - JobWatcher: job.NewWatcher(ctx, watcherMgr), - RunWatcher: job.NewRunWatcher(ctx, watcherMgr), - BqWatcher: bigquery.NewWatcher(ctx, watcherMgr), - ValkeyWatcher: valkey.NewWatcher(ctx, watcherMgr), - OpenSearchWatcher: opensearch.NewWatcher(ctx, watcherMgr), - NaisOpenSearchWatcher: opensearch.NewNaisOpenSearchWatcher(ctx, watcherMgr), - BucketWatcher: bucket.NewWatcher(ctx, watcherMgr), - SqlDatabaseWatcher: sqlinstance.NewDatabaseWatcher(ctx, watcherMgr), - SqlInstanceWatcher: sqlinstance.NewInstanceWatcher(ctx, watcherMgr), - ZalandoPostgresWatcher: postgres.NewZalandoPostgresWatcher(ctx, watcherMgr), - KafkaTopicWatcher: kafkatopic.NewWatcher(ctx, watcherMgr), - PodWatcher: workload.NewWatcher(ctx, watcherMgr), - IngressWatcher: application.NewIngressWatcher(ctx, watcherMgr), - NamespaceWatcher: team.NewNamespaceWatcher(ctx, watcherMgr), - SecretWatcher: secret.NewWatcher(ctx, watcherMgr), - ConfigWatcher: config.NewWatcher(ctx, watcherMgr), - ReplicaSetWatcher: instancegroup.NewWatcher(ctx, watcherMgr), - TunnelWatcher: tunnel.NewWatcher(ctx, watcherMgr), - NaisValkeyWatcher: valkey.NewNaisValkeyWatcher(ctx, watcherMgr), + AppWatcher: application.NewWatcher(ctx, watcherMgr), + JobWatcher: job.NewWatcher(ctx, watcherMgr), + RunWatcher: job.NewRunWatcher(ctx, watcherMgr), + BqWatcher: bigquery.NewWatcher(ctx, watcherMgr), + ValkeyWatcher: valkey.NewWatcher(ctx, watcherMgr), + OpenSearchWatcher: opensearch.NewWatcher(ctx, watcherMgr), + NaisOpenSearchWatcher: opensearch.NewNaisOpenSearchWatcher(ctx, watcherMgr), + BucketWatcher: bucket.NewWatcher(ctx, watcherMgr), + SqlDatabaseWatcher: sqlinstance.NewDatabaseWatcher(ctx, watcherMgr), + SqlInstanceWatcher: sqlinstance.NewInstanceWatcher(ctx, watcherMgr), + PostgresWatcher: postgres.NewPostgresWatcher(ctx, watcherMgr), + KafkaTopicWatcher: kafkatopic.NewWatcher(ctx, watcherMgr), + PodWatcher: workload.NewWatcher(ctx, watcherMgr), + IngressWatcher: application.NewIngressWatcher(ctx, watcherMgr), + NamespaceWatcher: team.NewNamespaceWatcher(ctx, watcherMgr), + SecretWatcher: secret.NewWatcher(ctx, watcherMgr), + ConfigWatcher: config.NewWatcher(ctx, watcherMgr), + ReplicaSetWatcher: instancegroup.NewWatcher(ctx, watcherMgr), + TunnelWatcher: tunnel.NewWatcher(ctx, watcherMgr), + NaisValkeyWatcher: valkey.NewNaisValkeyWatcher(ctx, watcherMgr), } if unleashEnabled { ret.UnleashWatcher = unleash.NewWatcher(ctx, mgmtWatcherMgr) diff --git a/internal/persistence/postgres/activitylog.go b/internal/persistence/postgres/activitylog.go index 44371b3b6..0d4b9e21c 100644 --- a/internal/persistence/postgres/activitylog.go +++ b/internal/persistence/postgres/activitylog.go @@ -8,7 +8,9 @@ import ( ) const ( - activityLogEntryActionGrantAccess activitylog.ActivityLogEntryAction = "GRANT_ACCESS" + activityLogEntryActionGrantAccess activitylog.ActivityLogEntryAction = "GRANT_ACCESS" + activityLogEntryActionCreatePersonalAccess activitylog.ActivityLogEntryAction = "CREATE_PERSONAL_ACCESS" + activityLogEntryActionGetPersonalAccessConnection activitylog.ActivityLogEntryAction = "GET_PERSONAL_ACCESS_CONNECTION" activityLogEntryResourceTypePostgres activitylog.ActivityLogEntryResourceType = "POSTGRES" ) @@ -35,12 +37,27 @@ func init() { GenericActivityLogEntry: entry.WithMessage(fmt.Sprintf("Granted access to %s until %s", data.Grantee, data.Until)), Data: data, }, nil + case activityLogEntryActionCreatePersonalAccess: + data, err := activitylog.UnmarshalData[PostgresPersonalAccessCreatedActivityLogEntryData](entry) + if err != nil { + return nil, fmt.Errorf("transforming postgres personal access activity log entry data: %w", err) + } + return PostgresPersonalAccessCreatedActivityLogEntry{ + GenericActivityLogEntry: entry.WithMessage(fmt.Sprintf("Created personal Postgres access for %s until %s", data.Username, data.ExpiresAt)), + Data: data, + }, nil + case activityLogEntryActionGetPersonalAccessConnection: + return PostgresPersonalAccessConnectionActivityLogEntry{ + GenericActivityLogEntry: entry.WithMessage("Retrieved personal Postgres connection materials"), + }, nil default: return nil, fmt.Errorf("unsupported postgres activity log entry action: %q", entry.Action) } }) activitylog.RegisterFilter("POSTGRES_GRANT_ACCESS", activityLogEntryActionGrantAccess, activityLogEntryResourceTypePostgres) + activitylog.RegisterFilter("POSTGRES_PERSONAL_ACCESS_CREATED", activityLogEntryActionCreatePersonalAccess, activityLogEntryResourceTypePostgres) + activitylog.RegisterFilter("POSTGRES_PERSONAL_ACCESS_CONNECTION", activityLogEntryActionGetPersonalAccessConnection, activityLogEntryResourceTypePostgres) activitylog.RegisterFilter("POSTGRES_DELETED", activitylog.ActivityLogEntryActionDeleted, activityLogEntryResourceTypePostgres) } @@ -58,3 +75,21 @@ type PostgresGrantAccessActivityLogEntryData struct { Grantee string `json:"grantee,string"` Until time.Time `json:"until"` } + +type PostgresPersonalAccessCreatedActivityLogEntry struct { + activitylog.GenericActivityLogEntry + + Data *PostgresPersonalAccessCreatedActivityLogEntryData `json:"data"` +} + +type PostgresPersonalAccessCreatedActivityLogEntryData struct { + Username string `json:"username"` + ExpiresAt time.Time `json:"expiresAt"` + Reason string `json:"reason"` +} + +type PostgresPersonalAccessConnectionActivityLogEntry struct { + activitylog.GenericActivityLogEntry +} + +type PostgresPersonalAccessConnectionActivityLogEntryData struct{} diff --git a/internal/persistence/postgres/dataloader.go b/internal/persistence/postgres/dataloader.go index 0282dcb72..fa711dcfd 100644 --- a/internal/persistence/postgres/dataloader.go +++ b/internal/persistence/postgres/dataloader.go @@ -14,28 +14,28 @@ const loadersKey ctxKey = iota func NewLoaderContext( ctx context.Context, - zalandoPostgresWatcher *watcher.Watcher[*PostgresInstance], + postgresWatcher *watcher.Watcher[*PostgresInstance], auditLogProjectID string, auditLogLocation string, ) context.Context { - return context.WithValue(ctx, loadersKey, newLoaders(zalandoPostgresWatcher, auditLogProjectID, auditLogLocation)) + return context.WithValue(ctx, loadersKey, newLoaders(postgresWatcher, auditLogProjectID, auditLogLocation)) } type loaders struct { - zalandoPostgresWatcher *watcher.Watcher[*PostgresInstance] - auditLogProjectID string - auditLogLocation string + postgresWatcher *watcher.Watcher[*PostgresInstance] + auditLogProjectID string + auditLogLocation string } func newLoaders( - zalandoPostgresWatcher *watcher.Watcher[*PostgresInstance], + postgresWatcher *watcher.Watcher[*PostgresInstance], auditLogProjectID string, auditLogLocation string, ) *loaders { return &loaders{ - zalandoPostgresWatcher: zalandoPostgresWatcher, - auditLogProjectID: auditLogProjectID, - auditLogLocation: auditLogLocation, + postgresWatcher: postgresWatcher, + auditLogProjectID: auditLogProjectID, + auditLogLocation: auditLogLocation, } } @@ -45,7 +45,7 @@ func GetAuditLogConfig(ctx context.Context) (projectID, location string) { return loaders.auditLogProjectID, loaders.auditLogLocation } -func NewZalandoPostgresWatcher(ctx context.Context, mgr *watcher.Manager) *watcher.Watcher[*PostgresInstance] { +func NewPostgresWatcher(ctx context.Context, mgr *watcher.Manager) *watcher.Watcher[*PostgresInstance] { w := watcher.Watch(mgr, &PostgresInstance{}, watcher.WithConverter(func(o *unstructured.Unstructured, environmentName string) (obj any, ok bool) { ret, err := toPostgres(o, environmentName) if err != nil { diff --git a/internal/persistence/postgres/models.go b/internal/persistence/postgres/models.go index 2a6ea10fc..0870fd8b5 100644 --- a/internal/persistence/postgres/models.go +++ b/internal/persistence/postgres/models.go @@ -220,7 +220,7 @@ func (i *GrantPostgresAccessInput) ValidationErrors(ctx context.Context) *valida verr.Add("duration", "Duration \"%s\" is out-of-bounds. Must be less than 4 hours.", i.Duration) } - _, err = GetZalandoPostgres(ctx, i.TeamSlug, i.EnvironmentName, i.ClusterName) + _, err = GetPostgres(ctx, i.TeamSlug, i.EnvironmentName, i.ClusterName) if err != nil { if errors.Is(err, &watcher.ErrorNotFound{}) { verr.Add("clusterName", "Could not find postgres cluster named \"%s\"", i.ClusterName) @@ -236,6 +236,111 @@ type GrantPostgresAccessPayload struct { Error *string `json:"error,omitempty"` } +// CreatePostgresAccessInput requests a new, time-limited personal database access. +// The authenticated actor and final expiry are server-controlled. +type CreatePostgresAccessInput struct { + PostgresInstance string `json:"postgresInstance"` + TeamSlug slug.Slug `json:"teamSlug"` + EnvironmentName string `json:"environmentName"` + AccessLevel PostgresAccessLevel `json:"accessLevel"` + ClientWireGuardPublicKey string `json:"clientWireGuardPublicKey"` + Reason string `json:"reason"` + TTL string `json:"ttl"` +} + +func (i *CreatePostgresAccessInput) Validate(ctx context.Context) error { + return i.ValidationErrors(ctx).NilIfEmpty() +} + +func (i *CreatePostgresAccessInput) ValidationErrors(ctx context.Context) *validate.ValidationErrors { + verr := validate.New() + i.PostgresInstance = strings.TrimSpace(i.PostgresInstance) + i.EnvironmentName = strings.TrimSpace(i.EnvironmentName) + i.ClientWireGuardPublicKey = strings.TrimSpace(i.ClientWireGuardPublicKey) + i.Reason = strings.TrimSpace(i.Reason) + i.TTL = strings.TrimSpace(i.TTL) + + if i.PostgresInstance == "" { + verr.Add("postgresInstance", "Postgres instance must not be empty.") + } + if i.EnvironmentName == "" { + verr.Add("environmentName", "Environment name must not be empty.") + } + if i.TeamSlug == "" { + verr.Add("teamSlug", "Team slug must not be empty.") + } + if !i.AccessLevel.IsValid() { + verr.Add("accessLevel", "Access level %q is not valid.", i.AccessLevel) + } + if i.ClientWireGuardPublicKey == "" { + verr.Add("clientWireGuardPublicKey", "Client WireGuard public key must not be empty.") + } + if len(i.Reason) < 10 { + verr.Add("reason", "Reason must be at least 10 characters.") + } + if _, err := i.accessTTL(); err != nil { + verr.Add("ttl", "%s", err) + } + + if i.PostgresInstance == "" || i.EnvironmentName == "" || i.TeamSlug == "" { + return verr + } + + instance, err := GetPostgres(ctx, i.TeamSlug, i.EnvironmentName, i.PostgresInstance) + if err != nil { + if errors.Is(err, &watcher.ErrorNotFound{}) { + verr.Add("postgresInstance", "Could not find postgres cluster named %q", i.PostgresInstance) + } else { + verr.Add("postgresInstance", "%s", err) + } + } else if instance.State != PostgresInstanceStateAvailable { + verr.Add("postgresInstance", "Postgres instance %q is not available.", i.PostgresInstance) + } + + return verr +} + +type CreatePostgresAccessPayload struct { + Name string `json:"name"` + ExpiresAt time.Time `json:"expiresAt"` +} + +type PostgresAccessLevel string + +const ( + PostgresAccessLevelRead PostgresAccessLevel = "READ" + PostgresAccessLevelReadWrite PostgresAccessLevel = "READWRITE" + PostgresAccessLevelReadWriteCreate PostgresAccessLevel = "READWRITECREATE" +) + +func (e PostgresAccessLevel) IsValid() bool { + switch e { + case PostgresAccessLevelRead, PostgresAccessLevelReadWrite, PostgresAccessLevelReadWriteCreate: + return true + } + return false +} + +func (e PostgresAccessLevel) String() string { return string(e) } + +func (e PostgresAccessLevel) CRDValue() string { return strings.ToLower(string(e)) } + +func (e *PostgresAccessLevel) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + *e = PostgresAccessLevel(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid PostgresAccessLevel", str) + } + return nil +} + +func (e PostgresAccessLevel) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + func (p *PostgresInstance) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind } @@ -396,3 +501,128 @@ func (e PostgresInstanceOrderField) MarshalJSON() ([]byte, error) { type TeamInventoryCountPostgresInstances struct { Total int `json:"total"` } + +// PostgresAccess exposes the API/CLI-facing state of a controller-owned personal +// database access. Credentials are read from the controller-owned Secret on +// demand; they are never cached by the watcher. +type PostgresAccess struct { + Name string `json:"name"` + TeamSlug slug.Slug `json:"-"` + EnvironmentName string `json:"-"` + PostgresInstanceName string `json:"postgresInstance"` + Username string `json:"username"` + AccessLevel PostgresAccessLevel `json:"accessLevel"` + ExpiresAt time.Time `json:"expiresAt"` + State PostgresAccessState `json:"state"` + Message *string `json:"message,omitempty"` + Tunnel *PostgresAccessTunnel `json:"tunnel,omitempty"` +} + +func (PostgresAccess) IsNode() {} + +func (p *PostgresAccess) ID() ident.Ident { + return newAccessIdent(p.TeamSlug, p.EnvironmentName, p.Name) +} + +type PostgresAccessState string + +const ( + PostgresAccessStatePending PostgresAccessState = "PENDING" + PostgresAccessStateReady PostgresAccessState = "READY" + PostgresAccessStateFailed PostgresAccessState = "FAILED" + PostgresAccessStateExpired PostgresAccessState = "EXPIRED" +) + +var AllPostgresAccessState = []PostgresAccessState{ + PostgresAccessStatePending, + PostgresAccessStateReady, + PostgresAccessStateFailed, + PostgresAccessStateExpired, +} + +func (e PostgresAccessState) IsValid() bool { + switch e { + case PostgresAccessStatePending, PostgresAccessStateReady, PostgresAccessStateFailed, PostgresAccessStateExpired: + return true + } + return false +} + +func (e PostgresAccessState) String() string { + return string(e) +} + +func (e *PostgresAccessState) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = PostgresAccessState(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid PostgresAccessState", str) + } + return nil +} + +func (e PostgresAccessState) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *PostgresAccessState) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e PostgresAccessState) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} + +type PostgresAccessTunnel struct { + Name string `json:"name"` + Endpoint *string `json:"endpoint,omitempty"` + GatewayPublicKey *string `json:"gatewayPublicKey,omitempty"` +} + +type PostgresAccessConnectionInput struct { + Name string `json:"name"` + TeamSlug slug.Slug `json:"teamSlug"` + EnvironmentName string `json:"environmentName"` +} + +func (i *PostgresAccessConnectionInput) Validate(ctx context.Context) error { + return i.ValidationErrors(ctx).NilIfEmpty() +} + +func (i *PostgresAccessConnectionInput) ValidationErrors(_ context.Context) *validate.ValidationErrors { + verr := validate.New() + i.Name = strings.TrimSpace(i.Name) + i.EnvironmentName = strings.TrimSpace(i.EnvironmentName) + if i.Name == "" { + verr.Add("name", "Name must not be empty.") + } + if i.TeamSlug == "" { + verr.Add("teamSlug", "Team slug must not be empty.") + } + if i.EnvironmentName == "" { + verr.Add("environmentName", "Environment name must not be empty.") + } + return verr +} + +type PostgresAccessConnection struct { + Password string `json:"password"` + CACertificate string `json:"caCertificate"` + ServerName string `json:"serverName"` + Tunnel PostgresAccessConnectionTunnel `json:"tunnel"` +} + +type PostgresAccessConnectionTunnel struct { + Endpoint string `json:"endpoint"` + GatewayPublicKey string `json:"gatewayPublicKey"` +} diff --git a/internal/persistence/postgres/node.go b/internal/persistence/postgres/node.go index 1c7a49ffb..9bf4b2df8 100644 --- a/internal/persistence/postgres/node.go +++ b/internal/persistence/postgres/node.go @@ -10,14 +10,16 @@ import ( type identType int const ( - identZalandoPostgres identType = iota + identPostgres identType = iota + identPostgresAccess ) func init() { - ident.RegisterIdentType(identZalandoPostgres, "PP", GetZalandoPostgresByIdent) + ident.RegisterIdentType(identPostgres, "PP", GetPostgresByIdent) + ident.RegisterIdentType(identPostgresAccess, "PA", GetPostgresAccessByIdent) } -func parseIdent(id ident.Ident) (teamSlug slug.Slug, environmentName, postgresInstanceName string, err error) { +func parsePostgresInstanceIdent(id ident.Ident) (teamSlug slug.Slug, environmentName, postgresInstanceName string, err error) { parts := id.Parts() if len(parts) != 3 { return "", "", "", fmt.Errorf("invalid ident") @@ -27,5 +29,18 @@ func parseIdent(id ident.Ident) (teamSlug slug.Slug, environmentName, postgresIn } func newIdent(teamSlug slug.Slug, environmentName, postgresInstanceName string) ident.Ident { - return ident.NewIdent(identZalandoPostgres, teamSlug.String(), environmentName, postgresInstanceName) + return ident.NewIdent(identPostgres, teamSlug.String(), environmentName, postgresInstanceName) +} + +func parseAccessIdent(id ident.Ident) (teamSlug slug.Slug, environmentName, name string, err error) { + parts := id.Parts() + if len(parts) != 3 { + return "", "", "", fmt.Errorf("invalid ident") + } + + return slug.Slug(parts[0]), parts[1], parts[2], nil +} + +func newAccessIdent(teamSlug slug.Slug, environmentName, name string) ident.Ident { + return ident.NewIdent(identPostgresAccess, teamSlug.String(), environmentName, name) } diff --git a/internal/persistence/postgres/queries.go b/internal/persistence/postgres/queries.go index a401c4376..287e9c6a2 100644 --- a/internal/persistence/postgres/queries.go +++ b/internal/persistence/postgres/queries.go @@ -8,10 +8,13 @@ import ( "net/url" "slices" "strconv" + "strings" "time" + "github.com/google/uuid" "github.com/nais/api/internal/activitylog" "github.com/nais/api/internal/auth/authz" + "github.com/nais/api/internal/graph/apierror" "github.com/nais/api/internal/graph/ident" "github.com/nais/api/internal/graph/model" "github.com/nais/api/internal/graph/pagination" @@ -22,9 +25,11 @@ import ( "github.com/nais/api/internal/workload" "github.com/nais/api/internal/workload/application" "github.com/nais/api/internal/workload/job" + corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/dynamic" ) @@ -34,7 +39,7 @@ func Delete(ctx context.Context, input DeletePostgresInput) (*DeletePostgresPayl return nil, err } - client, err := fromContext(ctx).zalandoPostgresWatcher.ImpersonatedClientWithNamespace(ctx, input.EnvironmentName, input.TeamSlug.String()) + client, err := fromContext(ctx).postgresWatcher.ImpersonatedClientWithNamespace(ctx, input.EnvironmentName, input.TeamSlug.String()) if err != nil { return nil, err } @@ -57,7 +62,7 @@ func Delete(ctx context.Context, input DeletePostgresInput) (*DeletePostgresPayl } } - if err := fromContext(ctx).zalandoPostgresWatcher.Delete(ctx, input.EnvironmentName, input.TeamSlug.String(), input.Name); err != nil { + if err := fromContext(ctx).postgresWatcher.Delete(ctx, input.EnvironmentName, input.TeamSlug.String(), input.Name); err != nil { return nil, err } @@ -80,7 +85,7 @@ func GetForWorkload(ctx context.Context, teamSlug slug.Slug, environmentName, cl return nil, nil } - return GetZalandoPostgres(ctx, teamSlug, environmentName, clusterName) + return GetPostgres(ctx, teamSlug, environmentName, clusterName) } func ListForTeam(ctx context.Context, teamSlug slug.Slug, page *pagination.Pagination, orderBy *PostgresInstanceOrder, filter *PostgresInstanceFilter) (*PostgresInstanceConnection, error) { @@ -97,25 +102,298 @@ func ListForTeam(ctx context.Context, teamSlug slug.Slug, page *pagination.Pagin } func ListAllForTeam(ctx context.Context, teamSlug slug.Slug, filter *PostgresInstanceFilter) []*PostgresInstance { - all := fromContext(ctx).zalandoPostgresWatcher.GetByNamespace(teamSlug.String()) + all := fromContext(ctx).postgresWatcher.GetByNamespace(teamSlug.String()) return watcher.Objects(all) } func CountForTeam(ctx context.Context, teamSlug slug.Slug) int { - return len(fromContext(ctx).zalandoPostgresWatcher.GetByNamespace(teamSlug.String())) + return len(fromContext(ctx).postgresWatcher.GetByNamespace(teamSlug.String())) } -func GetZalandoPostgresByIdent(ctx context.Context, id ident.Ident) (*PostgresInstance, error) { - teamSlug, environmentName, clusterName, err := parseIdent(id) +func GetPostgresByIdent(ctx context.Context, id ident.Ident) (*PostgresInstance, error) { + teamSlug, environmentName, clusterName, err := parsePostgresInstanceIdent(id) if err != nil { return nil, err } - return GetZalandoPostgres(ctx, teamSlug, environmentName, clusterName) + return GetPostgres(ctx, teamSlug, environmentName, clusterName) } -func GetZalandoPostgres(ctx context.Context, teamSlug slug.Slug, environmentName string, clusterName string) (*PostgresInstance, error) { - return fromContext(ctx).zalandoPostgresWatcher.Get(environmentName, teamSlug.String(), clusterName) +func GetPostgresAccessByIdent(ctx context.Context, id ident.Ident) (*PostgresAccess, error) { + teamSlug, environmentName, name, err := parseAccessIdent(id) + if err != nil { + return nil, err + } + + return GetPostgresAccess(ctx, name, teamSlug, environmentName) +} + +const ( + postgresAccessResource = "postgresaccesses" + postgresAccessGroup = "nais.io" +) + +// GetPostgresAccess returns a personal PostgresAccess status. Connection +// credentials are deliberately available only through GetPostgresAccessConnection. +func GetPostgresAccess(ctx context.Context, name string, teamSlug slug.Slug, environmentName string) (*PostgresAccess, error) { + if err := authz.CanGrantPostgresAccess(ctx, teamSlug); err != nil { + return nil, err + } + + u, err := getPostgresAccessResource(ctx, name, teamSlug, environmentName) + if err != nil { + return nil, err + } + + access, err := toPostgresAccess(u, teamSlug, environmentName) + if err != nil { + return nil, err + } + + return access, nil +} + +func GetPostgresAccessConnection(ctx context.Context, input PostgresAccessConnectionInput) (*PostgresAccessConnection, error) { + if err := input.Validate(ctx); err != nil { + return nil, err + } + if err := authz.CanGrantPostgresAccess(ctx, input.TeamSlug); err != nil { + return nil, err + } + + access, err := getPostgresAccessResource(ctx, input.Name, input.TeamSlug, input.EnvironmentName) + if err != nil { + return nil, err + } + + username, _, err := unstructured.NestedString(access.Object, "spec", "username") + if err != nil { + return nil, fmt.Errorf("reading PostgresAccess %q username: %w", input.Name, err) + } + actor := authz.ActorFromContext(ctx) + if actor == nil || username == "" || actor.User.Identity() != username { + return nil, authz.ErrUnauthorized + } + + connection, credentialSecretName, err := postgresAccessConnectionDetails(access, time.Now()) + if err != nil { + return nil, err + } + + secretClient, err := fromContext(ctx).postgresWatcher.SystemAuthenticatedClient(ctx, input.EnvironmentName, watcher.WithImpersonatedClientGVR(schema.GroupVersionResource{ + Version: "v1", + Resource: "secrets", + })) + if err != nil { + return nil, fmt.Errorf("creating credential Secret client: %w", err) + } + secret, err := secretClient.Namespace(input.TeamSlug.String()).Get(ctx, credentialSecretName, metav1.GetOptions{}) + if err != nil { + if k8serrors.IsNotFound(err) { + return nil, apierror.Errorf("credentials for PostgresAccess %q are not available", input.Name) + } + return nil, fmt.Errorf("getting credential Secret for PostgresAccess %q: %w", input.Name, err) + } + + password, caCertificate, err := postgresAccessConnectionSecret(secret) + if err != nil { + return nil, err + } + connection.Password = password + connection.CACertificate = caCertificate + + if err := activitylog.Create(ctx, activitylog.CreateInput{ + Action: activityLogEntryActionGetPersonalAccessConnection, + Actor: actor.User, + ResourceType: activityLogEntryResourceTypePostgres, + ResourceName: input.Name, + EnvironmentName: new(input.EnvironmentName), + TeamSlug: new(input.TeamSlug), + Data: PostgresPersonalAccessConnectionActivityLogEntryData{}, + }); err != nil { + return nil, err + } + + return connection, nil +} + +func getPostgresAccessResource(ctx context.Context, name string, teamSlug slug.Slug, environmentName string) (*unstructured.Unstructured, error) { + accessClient, err := fromContext(ctx).postgresWatcher.SystemAuthenticatedClient(ctx, environmentName, watcher.WithImpersonatedClientGVR(schema.GroupVersionResource{ + Group: postgresAccessGroup, + Version: "v1", + Resource: postgresAccessResource, + })) + if err != nil { + return nil, fmt.Errorf("creating postgresaccess client: %w", err) + } + u, err := accessClient.Namespace(teamSlug.String()).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + if k8serrors.IsNotFound(err) { + return nil, apierror.Errorf("PostgresAccess %q not found", name) + } + return nil, fmt.Errorf("getting PostgresAccess %q: %w", name, err) + } + return u, nil +} + +func postgresAccessConnectionDetails(access *unstructured.Unstructured, now time.Time) (*PostgresAccessConnection, string, error) { + expiresAt, _, err := unstructured.NestedString(access.Object, "spec", "expiresAt") + if err != nil { + return nil, "", fmt.Errorf("reading PostgresAccess %q expiry: %w", access.GetName(), err) + } + expires, err := time.Parse(time.RFC3339, expiresAt) + if err != nil { + return nil, "", apierror.Errorf("PostgresAccess %q has an invalid expiry", access.GetName()) + } + if !expires.After(now) { + return nil, "", apierror.Errorf("PostgresAccess %q has expired", access.GetName()) + } + if !postgresAccessIsReady(access.Object) { + return nil, "", apierror.Errorf("PostgresAccess %q is not ready", access.GetName()) + } + + credentialSecretName, _, err := unstructured.NestedString(access.Object, "status", "credentialSecretName") + if err != nil || credentialSecretName == "" { + return nil, "", apierror.Errorf("PostgresAccess %q is not ready", access.GetName()) + } + serverName, _, err := unstructured.NestedString(access.Object, "status", "serverName") + if err != nil || serverName == "" { + return nil, "", apierror.Errorf("PostgresAccess %q is not ready", access.GetName()) + } + endpoint, _, err := unstructured.NestedString(access.Object, "status", "tunnel", "endpoint") + if err != nil || endpoint == "" { + return nil, "", apierror.Errorf("PostgresAccess %q is not ready", access.GetName()) + } + gatewayPublicKey, _, err := unstructured.NestedString(access.Object, "status", "tunnel", "gatewayPublicKey") + if err != nil || gatewayPublicKey == "" { + return nil, "", apierror.Errorf("PostgresAccess %q is not ready", access.GetName()) + } + + return &PostgresAccessConnection{ + ServerName: serverName, + Tunnel: PostgresAccessConnectionTunnel{ + Endpoint: endpoint, GatewayPublicKey: gatewayPublicKey, + }, + }, credentialSecretName, nil +} + +func postgresAccessIsReady(obj map[string]any) bool { + conditions, found, err := unstructured.NestedSlice(obj, "status", "conditions") + if err != nil || !found { + return false + } + for _, c := range conditions { + condition, ok := c.(map[string]any) + if !ok { + continue + } + if condition["type"] == "Ready" && condition["status"] == string(metav1.ConditionTrue) { + return true + } + } + return false +} + +func postgresAccessConnectionSecret(secret *unstructured.Unstructured) (password, caCertificate string, err error) { + var typed corev1.Secret + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(secret.Object, &typed); err != nil { + return "", "", fmt.Errorf("converting credential Secret %q: %w", secret.GetName(), err) + } + password = string(typed.Data[corev1.BasicAuthPasswordKey]) + caCertificate = string(typed.Data["ca.crt"]) + if password == "" || caCertificate == "" { + return "", "", apierror.Errorf("credentials for PostgresAccess are incomplete") + } + return password, caCertificate, nil +} + +func toPostgresAccess(u *unstructured.Unstructured, teamSlug slug.Slug, environmentName string) (*PostgresAccess, error) { + name := u.GetName() + postgresInstance, _, _ := unstructured.NestedString(u.Object, "spec", "postgresInstance") + username, _, _ := unstructured.NestedString(u.Object, "spec", "username") + levelStr, _, _ := unstructured.NestedString(u.Object, "spec", "accessLevel") + expiresStr, _, _ := unstructured.NestedString(u.Object, "spec", "expiresAt") + + expiresAt, err := time.Parse(time.RFC3339, expiresStr) + if err != nil { + return nil, fmt.Errorf("parsing expiresAt for PostgresAccess %q: %w", name, err) + } + + level := PostgresAccessLevel(strings.ToUpper(levelStr)) + if !level.IsValid() { + return nil, fmt.Errorf("invalid accessLevel %q for PostgresAccess %q", levelStr, name) + } + + state, message := postgresAccessState(u.Object, expiresAt) + + var tunnel *PostgresAccessTunnel + if t, ok, _ := unstructured.NestedStringMap(u.Object, "status", "tunnel"); ok && t["name"] != "" { + tunnel = &PostgresAccessTunnel{ + Name: t["name"], + Endpoint: strPtr(t["endpoint"]), + GatewayPublicKey: strPtr(t["gatewayPublicKey"]), + } + } + + return &PostgresAccess{ + Name: name, + TeamSlug: teamSlug, + EnvironmentName: environmentName, + PostgresInstanceName: postgresInstance, + Username: username, + AccessLevel: level, + ExpiresAt: expiresAt, + State: state, + Message: strPtr(message), + Tunnel: tunnel, + }, nil +} + +func strPtr(s string) *string { + if s == "" { + return nil + } + return &s +} + +func postgresAccessState(obj map[string]any, expiresAt time.Time) (PostgresAccessState, string) { + if !expiresAt.IsZero() && expiresAt.Before(time.Now()) { + return PostgresAccessStateExpired, "access has expired" + } + + conditions, found, err := unstructured.NestedSlice(obj, "status", "conditions") + if err != nil || !found { + return PostgresAccessStatePending, "waiting for controller" + } + + for _, c := range conditions { + condition, ok := c.(map[string]any) + if !ok { + continue + } + condType, _ := condition["type"].(string) + if condType != "Ready" { + continue + } + + status, _ := condition["status"].(string) + reason, _ := condition["reason"].(string) + message, _ := condition["message"].(string) + + if status == string(metav1.ConditionTrue) { + return PostgresAccessStateReady, message + } + if reason == "UnsupportedAccessLevel" { + return PostgresAccessStateFailed, message + } + return PostgresAccessStatePending, message + } + + return PostgresAccessStatePending, "waiting for controller" +} + +func GetPostgres(ctx context.Context, teamSlug slug.Slug, environmentName string, clusterName string) (*PostgresInstance, error) { + return fromContext(ctx).postgresWatcher.Get(environmentName, teamSlug.String(), clusterName) } func GetAuditURL(ctx context.Context, audit *PostgresInstanceAudit) (*string, error) { @@ -148,7 +426,95 @@ func GetAuditURL(ctx context.Context, audit *PostgresInstanceAudit) (*string, er return &logURL, nil } -func GrantZalandoPostgresAccess(ctx context.Context, input GrantPostgresAccessInput) error { +const ( + postgresAccessAPIVersion = "nais.io/v1" + defaultPostgresAccessTTL = time.Hour + maxPostgresAccessTTL = 8 * time.Hour +) + +func CreatePostgresAccess(ctx context.Context, input CreatePostgresAccessInput) (*CreatePostgresAccessPayload, error) { + if err := input.Validate(ctx); err != nil { + return nil, err + } + accessTTL, err := input.accessTTL() + if err != nil { + return nil, err + } + + gvr := schema.GroupVersionResource{ + Group: "nais.io", + Version: "v1", + Resource: "postgresaccesses", + } + client, err := fromContext(ctx).postgresWatcher.SystemAuthenticatedClient(ctx, input.EnvironmentName, watcher.WithImpersonatedClientGVR(gvr)) + if err != nil { + return nil, err + } + + expiresAt := time.Now().Add(accessTTL) + name := fmt.Sprintf("postgres-access-%s", uuid.NewString()[:8]) + res := newPostgresAccessResource(input, authz.ActorFromContext(ctx).User.Identity(), name, expiresAt) + + if _, err := client.Namespace(input.TeamSlug.String()).Create(ctx, res, metav1.CreateOptions{}); err != nil { + return nil, err + } + + if err := activitylog.Create(ctx, activitylog.CreateInput{ + Action: activityLogEntryActionCreatePersonalAccess, + Actor: authz.ActorFromContext(ctx).User, + ResourceType: activityLogEntryResourceTypePostgres, + ResourceName: input.PostgresInstance, + EnvironmentName: new(input.EnvironmentName), + TeamSlug: new(input.TeamSlug), + Data: PostgresPersonalAccessCreatedActivityLogEntryData{ + Username: authz.ActorFromContext(ctx).User.Identity(), + ExpiresAt: expiresAt, + Reason: input.Reason, + }, + }); err != nil { + return nil, err + } + + return &CreatePostgresAccessPayload{Name: name, ExpiresAt: expiresAt}, nil +} + +func (i CreatePostgresAccessInput) accessTTL() (time.Duration, error) { + if i.TTL == "" { + return defaultPostgresAccessTTL, nil + } + + ttl, err := time.ParseDuration(i.TTL) + if err != nil { + return 0, fmt.Errorf("TTL must be a Go duration, for example %q", "4h") + } + if ttl <= 0 { + return 0, fmt.Errorf("TTL must be positive") + } + if ttl > maxPostgresAccessTTL { + return 0, fmt.Errorf("TTL cannot exceed %s", maxPostgresAccessTTL) + } + return ttl, nil +} + +func newPostgresAccessResource(input CreatePostgresAccessInput, username, name string, expiresAt time.Time) *unstructured.Unstructured { + res := &unstructured.Unstructured{} + res.SetAPIVersion(postgresAccessAPIVersion) + res.SetKind("PostgresAccess") + res.SetName(name) + res.SetNamespace(input.TeamSlug.String()) + res.SetAnnotations(kubernetes.WithCommonAnnotations(nil, username)) + kubernetes.SetManagedByConsoleLabel(res) + res.Object["spec"] = map[string]any{ + "postgresInstance": input.PostgresInstance, + "username": username, + "accessLevel": input.AccessLevel.CRDValue(), + "expiresAt": expiresAt.Format(time.RFC3339), + "clientWireGuardPublicKey": input.ClientWireGuardPublicKey, + } + return res +} + +func GrantPostgresAccess(ctx context.Context, input GrantPostgresAccessInput) error { err := input.Validate(ctx) if err != nil { return err @@ -201,7 +567,7 @@ func createRoleBinding(ctx context.Context, input GrantPostgresAccessInput, name Version: "v1", Resource: "rolebindings", } - client, err := fromContext(ctx).zalandoPostgresWatcher.SystemAuthenticatedClient(ctx, input.EnvironmentName, watcher.WithImpersonatedClientGVR(gvr)) + client, err := fromContext(ctx).postgresWatcher.SystemAuthenticatedClient(ctx, input.EnvironmentName, watcher.WithImpersonatedClientGVR(gvr)) if err != nil { return err } @@ -239,7 +605,7 @@ func createRole(ctx context.Context, input GrantPostgresAccessInput, name string Resource: "roles", } - client, err := fromContext(ctx).zalandoPostgresWatcher.SystemAuthenticatedClient(ctx, input.EnvironmentName, watcher.WithImpersonatedClientGVR(gvr)) + client, err := fromContext(ctx).postgresWatcher.SystemAuthenticatedClient(ctx, input.EnvironmentName, watcher.WithImpersonatedClientGVR(gvr)) if err != nil { return err } diff --git a/internal/persistence/postgres/queries_test.go b/internal/persistence/postgres/queries_test.go new file mode 100644 index 000000000..524332b92 --- /dev/null +++ b/internal/persistence/postgres/queries_test.go @@ -0,0 +1,258 @@ +package postgres + +import ( + "reflect" + "strings" + "testing" + "time" + + "github.com/nais/api/internal/slug" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func TestNewPostgresAccessResource(t *testing.T) { + expiresAt := time.Date(2026, time.September, 17, 12, 0, 0, 0, time.UTC) + resource := newPostgresAccessResource(CreatePostgresAccessInput{ + PostgresInstance: "orders", + TeamSlug: slug.Slug("team-a"), + EnvironmentName: "dev", + AccessLevel: PostgresAccessLevelReadWrite, + ClientWireGuardPublicKey: "client-public-key", + }, "user@example.com", "postgres-access-12345678", expiresAt) + + if got, want := resource.GetAPIVersion(), "nais.io/v1"; got != want { + t.Errorf("apiVersion = %q, want %q", got, want) + } + if got, want := resource.GetKind(), "PostgresAccess"; got != want { + t.Errorf("kind = %q, want %q", got, want) + } + if got, want := resource.GetName(), "postgres-access-12345678"; got != want { + t.Errorf("name = %q, want %q", got, want) + } + if got, want := resource.GetNamespace(), "team-a"; got != want { + t.Errorf("namespace = %q, want %q", got, want) + } + + spec, found, err := unstructured.NestedMap(resource.Object, "spec") + if err != nil || !found { + t.Fatalf("spec = (%v, %t, %v), want a spec", spec, found, err) + } + wantSpec := map[string]any{ + "postgresInstance": "orders", + "username": "user@example.com", + "accessLevel": "readwrite", + "expiresAt": "2026-09-17T12:00:00Z", + "clientWireGuardPublicKey": "client-public-key", + } + if !reflect.DeepEqual(wantSpec, spec) { + t.Errorf("spec = %#v, want %#v", spec, wantSpec) + } +} + +func TestCreatePostgresAccessTTL(t *testing.T) { + tests := []struct { + name string + ttl string + want time.Duration + wantErr string + }{ + {name: "default", want: time.Hour}, + {name: "requested", ttl: "4h", want: 4 * time.Hour}, + {name: "maximum", ttl: "8h", want: 8 * time.Hour}, + {name: "invalid", ttl: "tomorrow", wantErr: "TTL must be a Go duration"}, + {name: "zero", ttl: "0s", wantErr: "TTL must be positive"}, + {name: "too long", ttl: "8h1m", wantErr: "TTL cannot exceed 8h0m0s"}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := (CreatePostgresAccessInput{TTL: tt.ttl}).accessTTL() + if tt.wantErr != "" { + if err == nil || !strings.Contains(err.Error(), tt.wantErr) { + t.Errorf("accessTTL() error = %v, want containing %q", err, tt.wantErr) + } + return + } + if err != nil { + t.Fatalf("accessTTL() error = %v", err) + } + if got != tt.want { + t.Errorf("accessTTL() = %s, want %s", got, tt.want) + } + }) + } +} + +func TestPostgresAccessState(t *testing.T) { + future := time.Now().Add(time.Hour) + past := time.Now().Add(-time.Hour) + + tests := []struct { + name string + expiresAt time.Time + status map[string]any + wantState PostgresAccessState + wantMsg string + }{ + { + name: "expired", + expiresAt: past, + wantState: PostgresAccessStateExpired, + wantMsg: "access has expired", + }, + { + name: "pending without status", + expiresAt: future, + wantState: PostgresAccessStatePending, + wantMsg: "waiting for controller", + }, + { + name: "ready", + expiresAt: future, + status: map[string]any{ + "conditions": []any{ + map[string]any{ + "type": "Ready", + "status": "True", + "message": "Database role and tunnel are ready", + }, + }, + }, + wantState: PostgresAccessStateReady, + wantMsg: "Database role and tunnel are ready", + }, + { + name: "failed unsupported access level", + expiresAt: future, + status: map[string]any{ + "conditions": []any{ + map[string]any{ + "type": "Ready", + "status": "False", + "reason": "UnsupportedAccessLevel", + "message": "readwritecreate requires an instance initialized with the app_readwritecreate group role", + }, + }, + }, + wantState: PostgresAccessStateFailed, + wantMsg: "readwritecreate requires an instance initialized with the app_readwritecreate group role", + }, + { + name: "pending waiting on tunnel", + expiresAt: future, + status: map[string]any{ + "conditions": []any{ + map[string]any{ + "type": "Ready", + "status": "False", + "message": "waiting for tunnel", + }, + }, + }, + wantState: PostgresAccessStatePending, + wantMsg: "waiting for tunnel", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + obj := map[string]any{} + if tt.status != nil { + obj["status"] = tt.status + } + gotState, gotMsg := postgresAccessState(obj, tt.expiresAt) + if gotState != tt.wantState { + t.Errorf("state = %q, want %q", gotState, tt.wantState) + } + if gotMsg != tt.wantMsg { + t.Errorf("message = %q, want %q", gotMsg, tt.wantMsg) + } + }) + } +} + +func TestPostgresAccessConnectionDetails(t *testing.T) { + now := time.Date(2026, time.September, 17, 12, 0, 0, 0, time.UTC) + ready := func() *unstructured.Unstructured { + return &unstructured.Unstructured{Object: map[string]any{ + "metadata": map[string]any{"name": "access"}, + "spec": map[string]any{"expiresAt": "2026-09-17T13:00:00Z"}, + "status": map[string]any{ + "credentialSecretName": "access-credentials", + "serverName": "postgres.example", + "conditions": []any{map[string]any{"type": "Ready", "status": "True"}}, + "tunnel": map[string]any{"endpoint": "endpoint:1234", "gatewayPublicKey": "gateway-key"}, + }, + }} + } + + tests := []struct { + name string + edit func(*unstructured.Unstructured) + want string + }{ + {name: "ready"}, + {name: "expired", edit: func(u *unstructured.Unstructured) { + _ = unstructured.SetNestedField(u.Object, "2026-09-17T12:00:00Z", "spec", "expiresAt") + }, want: "expired"}, + {name: "not ready", edit: func(u *unstructured.Unstructured) { + _ = unstructured.SetNestedField(u.Object, []any{map[string]any{"type": "Ready", "status": "False"}}, "status", "conditions") + }, want: "not ready"}, + {name: "missing secret name", edit: func(u *unstructured.Unstructured) { + unstructured.RemoveNestedField(u.Object, "status", "credentialSecretName") + }, want: "not ready"}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := ready() + if tt.edit != nil { + tt.edit(u) + } + got, secretName, err := postgresAccessConnectionDetails(u, now) + if tt.want != "" { + if err == nil || !strings.Contains(err.Error(), tt.want) { + t.Fatalf("error = %v, want %q", err, tt.want) + } + return + } + if err != nil { + t.Fatalf("postgresAccessConnectionDetails: %v", err) + } + if secretName != "access-credentials" { + t.Errorf("secret name = %q", secretName) + } + if got.ServerName != "postgres.example" || got.Tunnel.Endpoint != "endpoint:1234" || got.Tunnel.GatewayPublicKey != "gateway-key" { + t.Errorf("connection = %#v", got) + } + }) + } +} + +func TestPostgresAccessConnectionSecret(t *testing.T) { + secret := &corev1.Secret{Data: map[string][]byte{ + corev1.BasicAuthPasswordKey: []byte("supersecret"), + "ca.crt": []byte("test-ca-certificate"), + }} + u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(secret) + if err != nil { + t.Fatalf("ToUnstructured: %v", err) + } + password, ca, err := postgresAccessConnectionSecret(&unstructured.Unstructured{Object: u}) + if err != nil { + t.Fatalf("postgresAccessConnectionSecret: %v", err) + } + if password != "supersecret" || ca != "test-ca-certificate" { + t.Errorf("got password=%q ca=%q", password, ca) + } + + delete(secret.Data, "ca.crt") + u, err = runtime.DefaultUnstructuredConverter.ToUnstructured(secret) + if err != nil { + t.Fatalf("ToUnstructured: %v", err) + } + if _, _, err := postgresAccessConnectionSecret(&unstructured.Unstructured{Object: u}); err == nil { + t.Fatal("missing ca.crt did not fail") + } +} diff --git a/internal/persistence/postgres/search.go b/internal/persistence/postgres/search.go index fe5128deb..14c2826d0 100644 --- a/internal/persistence/postgres/search.go +++ b/internal/persistence/postgres/search.go @@ -9,13 +9,13 @@ import ( "github.com/nais/api/internal/slug" ) -func AddSearchZalandoPostgres(client search.Client, watcher *watcher.Watcher[*PostgresInstance]) { +func AddSearchPostgres(client search.Client, watcher *watcher.Watcher[*PostgresInstance]) { createIdent := func(env string, obj *PostgresInstance) ident.Ident { return newIdent(slug.Slug(obj.GetNamespace()), env, obj.GetName()) } gbi := func(ctx context.Context, id ident.Ident) (search.SearchNode, error) { - return GetZalandoPostgresByIdent(ctx, id) + return GetPostgresByIdent(ctx, id) } client.AddClient("POSTGRES", search.NewK8sSearch("POSTGRES", watcher, gbi, createIdent))