From 9915f422e5a4d62d3ce0f8af46e972984f705e1a Mon Sep 17 00:00:00 2001 From: Christer Edvartsen Date: Mon, 24 Aug 2026 15:10:31 +0200 Subject: [PATCH 1/7] refactor: cleanup of aiven credential types --- integration_tests/aiven_credentials.lua | 18 +- internal/activitylog/model.go | 11 +- internal/cmd/api/http.go | 2 +- .../graph/gengql/activitylog.generated.go | 22 +- .../gengql/aiven_credentials.generated.go | 450 ----------------- internal/graph/gengql/opensearch.generated.go | 402 ++++++++++++++- internal/graph/gengql/root_.generated.go | 461 ++++++++++++------ internal/graph/gengql/schema.generated.go | 22 +- internal/graph/gengql/valkey.generated.go | 402 ++++++++++++++- .../graph/schema/aiven_credentials.graphqls | 48 -- internal/graph/schema/opensearch.graphqls | 50 +- internal/graph/schema/valkey.graphqls | 50 +- .../aivencredentials/activitylog.go | 47 -- .../persistence/aivencredentials/models.go | 1 - .../persistence/aivencredentials/queries.go | 19 - .../persistence/opensearch/activitylog.go | 32 +- internal/persistence/opensearch/dataloader.go | 2 + internal/persistence/opensearch/models.go | 12 +- internal/persistence/opensearch/queries.go | 18 +- internal/persistence/valkey/activitylog.go | 31 +- internal/persistence/valkey/dataloader.go | 9 +- internal/persistence/valkey/models.go | 12 +- internal/persistence/valkey/queries.go | 18 +- 23 files changed, 1364 insertions(+), 775 deletions(-) delete mode 100644 internal/graph/gengql/aiven_credentials.generated.go delete mode 100644 internal/graph/schema/aiven_credentials.graphqls delete mode 100644 internal/persistence/aivencredentials/activitylog.go diff --git a/integration_tests/aiven_credentials.lua b/integration_tests/aiven_credentials.lua index 13c75a899..176f2484b 100644 --- a/integration_tests/aiven_credentials.lua +++ b/integration_tests/aiven_credentials.lua @@ -389,7 +389,7 @@ Test.gql("Activity log returns credentials entries without panic", function(t) t.query(string.format([[ { team(slug: "%s") { - activityLog(first: 10, filter: { activityTypes: [CREDENTIALS_CREATED] }) { + activityLog(first: 10, filter: { activityTypes: [VALKEY_CREDENTIALS_CREATED, OPENSEARCH_CREDENTIALS_CREATED] }) { nodes { __typename message @@ -397,7 +397,13 @@ Test.gql("Activity log returns credentials entries without panic", function(t) resourceType resourceName environmentName - ... on CredentialsActivityLogEntry { + ... on ValkeyCredentialsActivityLogEntry { + data { + permission + ttl + } + } + ... on OpenSearchCredentialsActivityLogEntry { data { permission ttl @@ -415,8 +421,8 @@ Test.gql("Activity log returns credentials entries without panic", function(t) activityLog = { nodes = { { - __typename = "CredentialsActivityLogEntry", - message = "Created VALKEY credentials for my-valkey (TTL: 7d)", + __typename = "ValkeyCredentialsActivityLogEntry", + message = "Created credentials for \"my-valkey\" (TTL: 7d)", actor = user:email(), resourceType = "VALKEY", resourceName = "my-valkey", @@ -427,8 +433,8 @@ Test.gql("Activity log returns credentials entries without panic", function(t) }, }, { - __typename = "CredentialsActivityLogEntry", - message = "Created OPENSEARCH credentials for my-instance with READ permission (TTL: 1d)", + __typename = "OpenSearchCredentialsActivityLogEntry", + message = "Created credentials for \"my-instance\" with \"read\" permission (TTL: 1d)", actor = user:email(), resourceType = "OPENSEARCH", resourceName = "my-instance", diff --git a/internal/activitylog/model.go b/internal/activitylog/model.go index 19c466dda..f60674a4a 100644 --- a/internal/activitylog/model.go +++ b/internal/activitylog/model.go @@ -20,11 +20,12 @@ type ( ) const ( - ActivityLogEntryActionAdded ActivityLogEntryAction = "ADDED" - ActivityLogEntryActionCreated ActivityLogEntryAction = "CREATED" - ActivityLogEntryActionDeleted ActivityLogEntryAction = "DELETED" - ActivityLogEntryActionRemoved ActivityLogEntryAction = "REMOVED" - ActivityLogEntryActionUpdated ActivityLogEntryAction = "UPDATED" + ActivityLogEntryActionAdded ActivityLogEntryAction = "ADDED" + ActivityLogEntryActionCreated ActivityLogEntryAction = "CREATED" + ActivityLogEntryActionDeleted ActivityLogEntryAction = "DELETED" + ActivityLogEntryActionRemoved ActivityLogEntryAction = "REMOVED" + ActivityLogEntryActionUpdated ActivityLogEntryAction = "UPDATED" + ActivityLogEntryActionCredentialsCreated ActivityLogEntryAction = "CREDENTIALS_CREATED" ) type ActivityLogEntry interface { diff --git a/internal/cmd/api/http.go b/internal/cmd/api/http.go index 9d4c19372..b17466200 100644 --- a/internal/cmd/api/http.go +++ b/internal/cmd/api/http.go @@ -350,7 +350,7 @@ func ConfigureGraph( ctx = instancegroup.NewLoaderContext(ctx, watchers.ReplicaSetWatcher, watchers.PodWatcher, watchers.AppWatcher, dynamicClients, log) ctx = aiven.NewLoaderContext(ctx, aivenProjects) ctx = opensearch.NewLoaderContext(ctx, tenantName, watchers.OpenSearchWatcher, aivenClient, log) - ctx = valkey.NewLoaderContext(ctx, tenantName, watchers.ValkeyWatcher, aivenClient) + ctx = valkey.NewLoaderContext(ctx, tenantName, watchers.ValkeyWatcher, aivenClient, log) ctx = price.NewLoaderContext(ctx, priceRetriever, log) ctx = utilization.NewLoaderContext(ctx, prometheusClient, log) ctx = alerts.NewLoaderContext(ctx, prometheusClient, log) diff --git a/internal/graph/gengql/activitylog.generated.go b/internal/graph/gengql/activitylog.generated.go index 6f39ef33e..aca69ec88 100644 --- a/internal/graph/gengql/activitylog.generated.go +++ b/internal/graph/gengql/activitylog.generated.go @@ -17,7 +17,6 @@ import ( "github.com/nais/api/internal/graph/model" "github.com/nais/api/internal/graph/pagination" "github.com/nais/api/internal/kubernetes/event/pubsublog" - "github.com/nais/api/internal/persistence/aivencredentials" "github.com/nais/api/internal/persistence/opensearch" "github.com/nais/api/internal/persistence/postgres" "github.com/nais/api/internal/persistence/valkey" @@ -516,6 +515,13 @@ func (ec *executionContext) _ActivityLogEntry(ctx context.Context, sel ast.Selec return graphql.Null } return ec._ValkeyDeletedActivityLogEntry(ctx, sel, obj) + case valkey.ValkeyCredentialsActivityLogEntry: + return ec._ValkeyCredentialsActivityLogEntry(ctx, sel, &obj) + case *valkey.ValkeyCredentialsActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._ValkeyCredentialsActivityLogEntry(ctx, sel, obj) case valkey.ValkeyCreatedActivityLogEntry: return ec._ValkeyCreatedActivityLogEntry(ctx, sel, &obj) case *valkey.ValkeyCreatedActivityLogEntry: @@ -810,6 +816,13 @@ func (ec *executionContext) _ActivityLogEntry(ctx context.Context, sel ast.Selec return graphql.Null } return ec._OpenSearchDeletedActivityLogEntry(ctx, sel, obj) + case opensearch.OpenSearchCredentialsActivityLogEntry: + return ec._OpenSearchCredentialsActivityLogEntry(ctx, sel, &obj) + case *opensearch.OpenSearchCredentialsActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._OpenSearchCredentialsActivityLogEntry(ctx, sel, obj) case opensearch.OpenSearchCreatedActivityLogEntry: return ec._OpenSearchCreatedActivityLogEntry(ctx, sel, &obj) case *opensearch.OpenSearchCreatedActivityLogEntry: @@ -866,13 +879,6 @@ func (ec *executionContext) _ActivityLogEntry(ctx context.Context, sel ast.Selec return graphql.Null } return ec._DeploymentActivityLogEntry(ctx, sel, obj) - case aivencredentials.CredentialsActivityLogEntry: - return ec._CredentialsActivityLogEntry(ctx, sel, &obj) - case *aivencredentials.CredentialsActivityLogEntry: - if obj == nil { - return graphql.Null - } - return ec._CredentialsActivityLogEntry(ctx, sel, obj) case config.ConfigUpdatedActivityLogEntry: return ec._ConfigUpdatedActivityLogEntry(ctx, sel, &obj) case *config.ConfigUpdatedActivityLogEntry: diff --git a/internal/graph/gengql/aiven_credentials.generated.go b/internal/graph/gengql/aiven_credentials.generated.go deleted file mode 100644 index b66434597..000000000 --- a/internal/graph/gengql/aiven_credentials.generated.go +++ /dev/null @@ -1,450 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package gengql - -import ( - "context" - "errors" - "math" - "strconv" - "sync/atomic" - "time" - - "github.com/99designs/gqlgen/graphql" - "github.com/nais/api/internal/activitylog" - "github.com/nais/api/internal/graph/ident" - "github.com/nais/api/internal/persistence/aivencredentials" - "github.com/nais/api/internal/slug" - "github.com/vektah/gqlparser/v2/ast" -) - -// region ************************** generated!.gotpl ************************** - -// endregion ************************** generated!.gotpl ************************** - -// region ***************************** args.gotpl ***************************** - -// endregion ***************************** args.gotpl ***************************** - -// region ************************** directives.gotpl ************************** - -// endregion ************************** directives.gotpl ************************** - -// region **************************** field.gotpl ***************************** - -func (ec *executionContext) _CredentialsActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntry) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntry_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_CredentialsActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) -} - -func (ec *executionContext) _CredentialsActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntry) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntry_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_CredentialsActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) -} - -func (ec *executionContext) _CredentialsActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntry) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntry_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_CredentialsActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) -} - -func (ec *executionContext) _CredentialsActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntry) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntry_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_CredentialsActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) -} - -func (ec *executionContext) _CredentialsActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntry) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntry_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_CredentialsActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) -} - -func (ec *executionContext) _CredentialsActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntry) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntry_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_CredentialsActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) -} - -func (ec *executionContext) _CredentialsActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntry) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntry_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_CredentialsActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) -} - -func (ec *executionContext) _CredentialsActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntry) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntry_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_CredentialsActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) -} - -func (ec *executionContext) _CredentialsActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntry) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntry_data(ctx, field) - }, - func(ctx context.Context) (any, error) { - return obj.Data, nil - }, - nil, - func(ctx context.Context, selections ast.SelectionSet, v *aivencredentials.CredentialsActivityLogEntryData) graphql.Marshaler { - return ec.marshalNCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialsActivityLogEntryData(ctx, selections, v) - }, - true, - true, - ) -} -func (ec *executionContext) fieldContext_CredentialsActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "CredentialsActivityLogEntry", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_CredentialsActivityLogEntryData(ctx, field) - }, - } - return fc, nil -} - -func (ec *executionContext) _CredentialsActivityLogEntryData_permission(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntryData) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntryData_permission(ctx, field) - }, - func(ctx context.Context) (any, error) { - return obj.Permission, nil - }, - nil, - func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { - return ec.marshalOString2string(ctx, selections, v) - }, - true, - false, - ) -} -func (ec *executionContext) fieldContext_CredentialsActivityLogEntryData_permission(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) -} - -func (ec *executionContext) _CredentialsActivityLogEntryData_ttl(ctx context.Context, field graphql.CollectedField, obj *aivencredentials.CredentialsActivityLogEntryData) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_CredentialsActivityLogEntryData_ttl(ctx, field) - }, - func(ctx context.Context) (any, error) { - return obj.TTL, 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_CredentialsActivityLogEntryData_ttl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("CredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) -} - -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - -// endregion **************************** input.gotpl ***************************** - -// region ************************** interface.gotpl *************************** - -// endregion ************************** interface.gotpl *************************** - -// region **************************** object.gotpl **************************** - -var credentialsActivityLogEntryImplementors = []string{"CredentialsActivityLogEntry", "ActivityLogEntry", "Node"} - -func (ec *executionContext) _CredentialsActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *aivencredentials.CredentialsActivityLogEntry) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, credentialsActivityLogEntryImplementors) - - 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("CredentialsActivityLogEntry") - case "id": - out.Values[i] = ec._CredentialsActivityLogEntry_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "actor": - out.Values[i] = ec._CredentialsActivityLogEntry_actor(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "createdAt": - out.Values[i] = ec._CredentialsActivityLogEntry_createdAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "message": - out.Values[i] = ec._CredentialsActivityLogEntry_message(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "resourceType": - out.Values[i] = ec._CredentialsActivityLogEntry_resourceType(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "resourceName": - out.Values[i] = ec._CredentialsActivityLogEntry_resourceName(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "teamSlug": - out.Values[i] = ec._CredentialsActivityLogEntry_teamSlug(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "environmentName": - out.Values[i] = ec._CredentialsActivityLogEntry_environmentName(ctx, field, obj) - case "data": - out.Values[i] = ec._CredentialsActivityLogEntry_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 credentialsActivityLogEntryDataImplementors = []string{"CredentialsActivityLogEntryData"} - -func (ec *executionContext) _CredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *aivencredentials.CredentialsActivityLogEntryData) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, credentialsActivityLogEntryDataImplementors) - - 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("CredentialsActivityLogEntryData") - case "permission": - out.Values[i] = ec._CredentialsActivityLogEntryData_permission(ctx, field, obj) - case "ttl": - out.Values[i] = ec._CredentialsActivityLogEntryData_ttl(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 -} - -// endregion **************************** object.gotpl **************************** - -// region ***************************** type.gotpl ***************************** - -func (ec *executionContext) unmarshalNCredentialPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx context.Context, v any) (aivencredentials.CredentialPermission, error) { - var res aivencredentials.CredentialPermission - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNCredentialPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx context.Context, sel ast.SelectionSet, v aivencredentials.CredentialPermission) graphql.Marshaler { - return v -} - -func (ec *executionContext) marshalNCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *aivencredentials.CredentialsActivityLogEntryData) 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._CredentialsActivityLogEntryData(ctx, sel, v) -} - -// endregion ***************************** type.gotpl ***************************** diff --git a/internal/graph/gengql/opensearch.generated.go b/internal/graph/gengql/opensearch.generated.go index 7e543eec0..8626a548e 100644 --- a/internal/graph/gengql/opensearch.generated.go +++ b/internal/graph/gengql/opensearch.generated.go @@ -17,6 +17,7 @@ import ( "github.com/nais/api/internal/graph/model" "github.com/nais/api/internal/graph/pagination" "github.com/nais/api/internal/issue" + "github.com/nais/api/internal/persistence/aivencredentials" "github.com/nais/api/internal/persistence/opensearch" "github.com/nais/api/internal/servicemaintenance" "github.com/nais/api/internal/slug" @@ -1443,6 +1444,268 @@ func (ec *executionContext) fieldContext_OpenSearchCredentials_uri(_ context.Con return graphql.NewScalarFieldContext("OpenSearchCredentials", field, false, false, errors.New("field of type String does not have child fields")) } +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_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_OpenSearchCredentialsActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_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_OpenSearchCredentialsActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_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_OpenSearchCredentialsActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_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_OpenSearchCredentialsActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_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_OpenSearchCredentialsActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_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_OpenSearchCredentialsActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_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_OpenSearchCredentialsActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_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_OpenSearchCredentialsActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_data(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Data, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *opensearch.OpenSearchCredentialsActivityLogEntryData) graphql.Marshaler { + return ec.marshalNOpenSearchCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋopensearchᚐOpenSearchCredentialsActivityLogEntryData(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "OpenSearchCredentialsActivityLogEntry", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_OpenSearchCredentialsActivityLogEntryData(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntryData_permission(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntryData) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntryData_permission(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Permission, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalOString2string(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntryData_permission(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntryData_ttl(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntryData) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_OpenSearchCredentialsActivityLogEntryData_ttl(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TTL, 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_OpenSearchCredentialsActivityLogEntryData_ttl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _OpenSearchDeletedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -2287,7 +2550,7 @@ func (ec *executionContext) unmarshalInputCreateOpenSearchCredentialsInput(ctx c it.InstanceName = data case "permission": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permission")) - data, err := ec.unmarshalNCredentialPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx, v) + data, err := ec.unmarshalNOpenSearchPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx, v) if err != nil { return it, err } @@ -3552,6 +3815,123 @@ func (ec *executionContext) _OpenSearchCredentials(ctx context.Context, sel ast. return out } +var openSearchCredentialsActivityLogEntryImplementors = []string{"OpenSearchCredentialsActivityLogEntry", "ActivityLogEntry", "Node"} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *opensearch.OpenSearchCredentialsActivityLogEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, openSearchCredentialsActivityLogEntryImplementors) + + 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("OpenSearchCredentialsActivityLogEntry") + case "id": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "actor": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_actor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceType": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_resourceType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceName": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_resourceName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamSlug": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_teamSlug(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "environmentName": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_environmentName(ctx, field, obj) + case "data": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_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 openSearchCredentialsActivityLogEntryDataImplementors = []string{"OpenSearchCredentialsActivityLogEntryData"} + +func (ec *executionContext) _OpenSearchCredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *opensearch.OpenSearchCredentialsActivityLogEntryData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, openSearchCredentialsActivityLogEntryDataImplementors) + + 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("OpenSearchCredentialsActivityLogEntryData") + case "permission": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntryData_permission(ctx, field, obj) + case "ttl": + out.Values[i] = ec._OpenSearchCredentialsActivityLogEntryData_ttl(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 openSearchDeletedActivityLogEntryImplementors = []string{"OpenSearchDeletedActivityLogEntry", "ActivityLogEntry", "Node"} func (ec *executionContext) _OpenSearchDeletedActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *opensearch.OpenSearchDeletedActivityLogEntry) graphql.Marshaler { @@ -4315,6 +4695,16 @@ func (ec *executionContext) marshalNOpenSearchCredentials2ᚖgithubᚗcomᚋnais return ec._OpenSearchCredentials(ctx, sel, v) } +func (ec *executionContext) marshalNOpenSearchCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋopensearchᚐOpenSearchCredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *opensearch.OpenSearchCredentialsActivityLogEntryData) 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._OpenSearchCredentialsActivityLogEntryData(ctx, sel, v) +} + func (ec *executionContext) marshalNOpenSearchEdge2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdge(ctx context.Context, sel ast.SelectionSet, v pagination.Edge[*opensearch.OpenSearch]) graphql.Marshaler { return ec._OpenSearchEdge(ctx, sel, &v) } @@ -4365,6 +4755,16 @@ func (ec *executionContext) marshalNOpenSearchOrderField2githubᚗcomᚋnaisᚋa return v } +func (ec *executionContext) unmarshalNOpenSearchPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx context.Context, v any) (aivencredentials.CredentialPermission, error) { + var res aivencredentials.CredentialPermission + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNOpenSearchPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx context.Context, sel ast.SelectionSet, v aivencredentials.CredentialPermission) graphql.Marshaler { + return v +} + func (ec *executionContext) unmarshalNOpenSearchState2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋopensearchᚐOpenSearchState(ctx context.Context, v any) (opensearch.OpenSearchState, error) { var res opensearch.OpenSearchState err := res.UnmarshalGQL(v) diff --git a/internal/graph/gengql/root_.generated.go b/internal/graph/gengql/root_.generated.go index a8e1eff62..32d00563f 100644 --- a/internal/graph/gengql/root_.generated.go +++ b/internal/graph/gengql/root_.generated.go @@ -750,23 +750,6 @@ type ComplexityRoot struct { Valkey func(childComplexity int) int } - CredentialsActivityLogEntry 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 - } - - CredentialsActivityLogEntryData struct { - Permission func(childComplexity int) int - TTL func(childComplexity int) int - } - CurrentUnitPrices struct { CPU func(childComplexity int) int Memory func(childComplexity int) int @@ -1668,6 +1651,23 @@ type ComplexityRoot struct { Username func(childComplexity int) int } + OpenSearchCredentialsActivityLogEntry 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 + } + + OpenSearchCredentialsActivityLogEntryData struct { + Permission func(childComplexity int) int + TTL func(childComplexity int) int + } + OpenSearchDeletedActivityLogEntry struct { Actor func(childComplexity int) int CreatedAt func(childComplexity int) int @@ -3462,6 +3462,23 @@ type ComplexityRoot struct { Username func(childComplexity int) int } + ValkeyCredentialsActivityLogEntry 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 + } + + ValkeyCredentialsActivityLogEntryData struct { + Permission func(childComplexity int) int + TTL func(childComplexity int) int + } + ValkeyDeletedActivityLogEntry struct { Actor func(childComplexity int) int CreatedAt func(childComplexity int) int @@ -6092,83 +6109,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.CreateValkeyPayload.Valkey(childComplexity), true - case "CredentialsActivityLogEntry.actor": - if e.ComplexityRoot.CredentialsActivityLogEntry.Actor == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntry.Actor(childComplexity), true - - case "CredentialsActivityLogEntry.createdAt": - if e.ComplexityRoot.CredentialsActivityLogEntry.CreatedAt == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntry.CreatedAt(childComplexity), true - - case "CredentialsActivityLogEntry.data": - if e.ComplexityRoot.CredentialsActivityLogEntry.Data == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntry.Data(childComplexity), true - - case "CredentialsActivityLogEntry.environmentName": - if e.ComplexityRoot.CredentialsActivityLogEntry.EnvironmentName == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntry.EnvironmentName(childComplexity), true - - case "CredentialsActivityLogEntry.id": - if e.ComplexityRoot.CredentialsActivityLogEntry.ID == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntry.ID(childComplexity), true - - case "CredentialsActivityLogEntry.message": - if e.ComplexityRoot.CredentialsActivityLogEntry.Message == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntry.Message(childComplexity), true - - case "CredentialsActivityLogEntry.resourceName": - if e.ComplexityRoot.CredentialsActivityLogEntry.ResourceName == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntry.ResourceName(childComplexity), true - - case "CredentialsActivityLogEntry.resourceType": - if e.ComplexityRoot.CredentialsActivityLogEntry.ResourceType == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntry.ResourceType(childComplexity), true - - case "CredentialsActivityLogEntry.teamSlug": - if e.ComplexityRoot.CredentialsActivityLogEntry.TeamSlug == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntry.TeamSlug(childComplexity), true - - case "CredentialsActivityLogEntryData.permission": - if e.ComplexityRoot.CredentialsActivityLogEntryData.Permission == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntryData.Permission(childComplexity), true - - case "CredentialsActivityLogEntryData.ttl": - if e.ComplexityRoot.CredentialsActivityLogEntryData.TTL == nil { - break - } - - return e.ComplexityRoot.CredentialsActivityLogEntryData.TTL(childComplexity), true - case "CurrentUnitPrices.cpu": if e.ComplexityRoot.CurrentUnitPrices.CPU == nil { break @@ -10312,6 +10252,83 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.OpenSearchCredentials.Username(childComplexity), true + case "OpenSearchCredentialsActivityLogEntry.actor": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Actor == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Actor(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntry.createdAt": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.CreatedAt == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.CreatedAt(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntry.data": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Data == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Data(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntry.environmentName": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.EnvironmentName == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.EnvironmentName(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntry.id": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ID == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ID(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntry.message": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Message == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Message(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntry.resourceName": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ResourceName == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ResourceName(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntry.resourceType": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ResourceType == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ResourceType(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntry.teamSlug": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.TeamSlug == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.TeamSlug(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntryData.permission": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntryData.Permission == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntryData.Permission(childComplexity), true + + case "OpenSearchCredentialsActivityLogEntryData.ttl": + if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntryData.TTL == nil { + break + } + + return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntryData.TTL(childComplexity), true + case "OpenSearchDeletedActivityLogEntry.actor": if e.ComplexityRoot.OpenSearchDeletedActivityLogEntry.Actor == nil { break @@ -18218,6 +18235,83 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.ValkeyCredentials.Username(childComplexity), true + case "ValkeyCredentialsActivityLogEntry.actor": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Actor == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Actor(childComplexity), true + + case "ValkeyCredentialsActivityLogEntry.createdAt": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.CreatedAt == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.CreatedAt(childComplexity), true + + case "ValkeyCredentialsActivityLogEntry.data": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Data == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Data(childComplexity), true + + case "ValkeyCredentialsActivityLogEntry.environmentName": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.EnvironmentName == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.EnvironmentName(childComplexity), true + + case "ValkeyCredentialsActivityLogEntry.id": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ID == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ID(childComplexity), true + + case "ValkeyCredentialsActivityLogEntry.message": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Message == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Message(childComplexity), true + + case "ValkeyCredentialsActivityLogEntry.resourceName": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ResourceName == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ResourceName(childComplexity), true + + case "ValkeyCredentialsActivityLogEntry.resourceType": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ResourceType == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ResourceType(childComplexity), true + + case "ValkeyCredentialsActivityLogEntry.teamSlug": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.TeamSlug == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.TeamSlug(childComplexity), true + + case "ValkeyCredentialsActivityLogEntryData.permission": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntryData.Permission == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntryData.Permission(childComplexity), true + + case "ValkeyCredentialsActivityLogEntryData.ttl": + if e.ComplexityRoot.ValkeyCredentialsActivityLogEntryData.TTL == nil { + break + } + + return e.ComplexityRoot.ValkeyCredentialsActivityLogEntryData.TTL(childComplexity), true + case "ValkeyDeletedActivityLogEntry.actor": if e.ComplexityRoot.ValkeyDeletedActivityLogEntry.Actor == nil { break @@ -19824,55 +19918,6 @@ type ActivityLogEntryEdge { """ node: ActivityLogEntry! } -`, BuiltIn: false}, - {Name: "../schema/aiven_credentials.graphqls", Input: `"Permission level for OpenSearch and Valkey credentials." -enum CredentialPermission { - READ - WRITE - READWRITE - ADMIN -} - -type CredentialsActivityLogEntry implements ActivityLogEntry & Node { - "ID of the entry." - id: ID! - - "The identity of the actor who performed the action." - actor: String! - - "Creation time of the entry." - createdAt: Time! - - "Message that summarizes the entry." - message: String! - - "Type of the resource that was affected by the action." - resourceType: ActivityLogEntryResourceType! - - "Name of the resource that was affected by the action." - resourceName: String! - - "The team slug that the entry belongs to." - teamSlug: Slug! - - "The environment name that the entry belongs to." - environmentName: String - - "Data associated with the credential creation." - data: CredentialsActivityLogEntryData! -} - -type CredentialsActivityLogEntryData { - "The permission level, if applicable." - permission: String - "The TTL that was requested for the credentials." - ttl: String! -} - -extend enum ActivityLogActivityType { - "Filter for credential creation events." - CREDENTIALS_CREATED -} `, BuiltIn: false}, {Name: "../schema/alerts.graphqls", Input: `extend type TeamEnvironment { """ @@ -25025,6 +25070,13 @@ type OpenSearch implements Persistence & Node { ): IssueConnection! } +enum OpenSearchPermission { + READ + WRITE + READWRITE + ADMIN +} + enum OpenSearchState { POWEROFF REBALANCING @@ -25363,7 +25415,7 @@ input CreateOpenSearchCredentialsInput { "Name of the OpenSearch instance." instanceName: String! "Permission level for the credentials." - permission: CredentialPermission! + permission: OpenSearchPermission! "Time-to-live for the credentials (e.g. '1d', '7d'). Maximum 30 days." ttl: String! } @@ -25385,6 +25437,47 @@ type CreateOpenSearchCredentialsPayload { "The generated credentials." credentials: OpenSearchCredentials! } + +type OpenSearchCredentialsActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + + "The identity of the actor who performed the action." + actor: String! + + "Creation time of the entry." + createdAt: Time! + + "Message that summarizes the entry." + message: String! + + "Type of the resource that was affected by the action." + resourceType: ActivityLogEntryResourceType! + + "Name of the resource that was affected by the action." + resourceName: String! + + "The team slug that the entry belongs to." + teamSlug: Slug! + + "The environment name that the entry belongs to." + environmentName: String + + "Data associated with the credential creation." + data: OpenSearchCredentialsActivityLogEntryData! +} + +type OpenSearchCredentialsActivityLogEntryData { + "The permission level, if applicable." + permission: String + "The TTL that was requested for the credentials." + ttl: String! +} + +extend enum ActivityLogActivityType { + "Filter for credential creation events." + OPENSEARCH_CREDENTIALS_CREATED +} `, BuiltIn: false}, {Name: "../schema/persistence.graphqls", Input: `interface Persistence implements Node { id: ID! @@ -31163,6 +31256,13 @@ input ValkeyOrder { direction: OrderDirection! } +enum ValkeyPermission { + READ + WRITE + READWRITE + ADMIN +} + enum ValkeyAccessOrderField { ACCESS WORKLOAD @@ -31425,7 +31525,7 @@ input CreateValkeyCredentialsInput { "Name of the Valkey instance." instanceName: String! "Permission level for the credentials." - permission: CredentialPermission! + permission: ValkeyPermission! "Time-to-live for the credentials (e.g. '1d', '7d'). Maximum 30 days." ttl: String! } @@ -31447,6 +31547,47 @@ type CreateValkeyCredentialsPayload { "The generated credentials." credentials: ValkeyCredentials! } + +type ValkeyCredentialsActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + + "The identity of the actor who performed the action." + actor: String! + + "Creation time of the entry." + createdAt: Time! + + "Message that summarizes the entry." + message: String! + + "Type of the resource that was affected by the action." + resourceType: ActivityLogEntryResourceType! + + "Name of the resource that was affected by the action." + resourceName: String! + + "The team slug that the entry belongs to." + teamSlug: Slug! + + "The environment name that the entry belongs to." + environmentName: String + + "Data associated with the credential creation." + data: ValkeyCredentialsActivityLogEntryData! +} + +type ValkeyCredentialsActivityLogEntryData { + "The permission level, if applicable." + permission: String + "The TTL that was requested for the credentials." + ttl: String! +} + +extend enum ActivityLogActivityType { + "Filter for credential creation events." + VALKEY_CREDENTIALS_CREATED +} `, BuiltIn: false}, {Name: "../schema/vulnerability.graphqls", Input: `extend type Mutation { """ @@ -33667,16 +33808,6 @@ func (ec *executionContext) childFields_CreateValkeyPayload(ctx context.Context, return nil, fmt.Errorf("no field named %q was found under type CreateValkeyPayload", field.Name) } -func (ec *executionContext) childFields_CredentialsActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "permission": - return ec.fieldContext_CredentialsActivityLogEntryData_permission(ctx, field) - case "ttl": - return ec.fieldContext_CredentialsActivityLogEntryData_ttl(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type CredentialsActivityLogEntryData", field.Name) -} - func (ec *executionContext) childFields_CurrentUnitPrices(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "cpu": @@ -34939,6 +35070,16 @@ func (ec *executionContext) childFields_OpenSearchCredentials(ctx context.Contex return nil, fmt.Errorf("no field named %q was found under type OpenSearchCredentials", field.Name) } +func (ec *executionContext) childFields_OpenSearchCredentialsActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "permission": + return ec.fieldContext_OpenSearchCredentialsActivityLogEntryData_permission(ctx, field) + case "ttl": + return ec.fieldContext_OpenSearchCredentialsActivityLogEntryData_ttl(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type OpenSearchCredentialsActivityLogEntryData", field.Name) +} + func (ec *executionContext) childFields_OpenSearchEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "cursor": @@ -37283,6 +37424,16 @@ func (ec *executionContext) childFields_ValkeyCredentials(ctx context.Context, f return nil, fmt.Errorf("no field named %q was found under type ValkeyCredentials", field.Name) } +func (ec *executionContext) childFields_ValkeyCredentialsActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "permission": + return ec.fieldContext_ValkeyCredentialsActivityLogEntryData_permission(ctx, field) + case "ttl": + return ec.fieldContext_ValkeyCredentialsActivityLogEntryData_ttl(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ValkeyCredentialsActivityLogEntryData", field.Name) +} + func (ec *executionContext) childFields_ValkeyEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "cursor": diff --git a/internal/graph/gengql/schema.generated.go b/internal/graph/gengql/schema.generated.go index 021c55c7a..de8d7edc9 100644 --- a/internal/graph/gengql/schema.generated.go +++ b/internal/graph/gengql/schema.generated.go @@ -29,7 +29,6 @@ import ( "github.com/nais/api/internal/kubernetes/event/pubsublog" "github.com/nais/api/internal/loki" "github.com/nais/api/internal/persistence" - "github.com/nais/api/internal/persistence/aivencredentials" "github.com/nais/api/internal/persistence/bigquery" "github.com/nais/api/internal/persistence/bucket" "github.com/nais/api/internal/persistence/kafkatopic" @@ -6089,6 +6088,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._ValkeyDeletedActivityLogEntry(ctx, sel, obj) + case valkey.ValkeyCredentialsActivityLogEntry: + return ec._ValkeyCredentialsActivityLogEntry(ctx, sel, &obj) + case *valkey.ValkeyCredentialsActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._ValkeyCredentialsActivityLogEntry(ctx, sel, obj) case valkey.ValkeyCreatedActivityLogEntry: return ec._ValkeyCreatedActivityLogEntry(ctx, sel, &obj) case *valkey.ValkeyCreatedActivityLogEntry: @@ -6502,6 +6508,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._OpenSearchDeletedActivityLogEntry(ctx, sel, obj) + case opensearch.OpenSearchCredentialsActivityLogEntry: + return ec._OpenSearchCredentialsActivityLogEntry(ctx, sel, &obj) + case *opensearch.OpenSearchCredentialsActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._OpenSearchCredentialsActivityLogEntry(ctx, sel, obj) case opensearch.OpenSearchCreatedActivityLogEntry: return ec._OpenSearchCreatedActivityLogEntry(ctx, sel, &obj) case *opensearch.OpenSearchCreatedActivityLogEntry: @@ -6642,13 +6655,6 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._DeploymentActivityLogEntry(ctx, sel, obj) - case aivencredentials.CredentialsActivityLogEntry: - return ec._CredentialsActivityLogEntry(ctx, sel, &obj) - case *aivencredentials.CredentialsActivityLogEntry: - if obj == nil { - return graphql.Null - } - return ec._CredentialsActivityLogEntry(ctx, sel, obj) case workload.ContainerImage: return ec._ContainerImage(ctx, sel, &obj) case *workload.ContainerImage: diff --git a/internal/graph/gengql/valkey.generated.go b/internal/graph/gengql/valkey.generated.go index 748c092e1..292074e68 100644 --- a/internal/graph/gengql/valkey.generated.go +++ b/internal/graph/gengql/valkey.generated.go @@ -17,6 +17,7 @@ import ( "github.com/nais/api/internal/graph/model" "github.com/nais/api/internal/graph/pagination" "github.com/nais/api/internal/issue" + "github.com/nais/api/internal/persistence/aivencredentials" "github.com/nais/api/internal/persistence/valkey" "github.com/nais/api/internal/servicemaintenance" "github.com/nais/api/internal/slug" @@ -1511,6 +1512,268 @@ func (ec *executionContext) fieldContext_ValkeyCredentials_uri(_ context.Context return graphql.NewScalarFieldContext("ValkeyCredentials", field, false, false, errors.New("field of type String does not have child fields")) } +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntry_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_ValkeyCredentialsActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntry_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_ValkeyCredentialsActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntry_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_ValkeyCredentialsActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntry_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_ValkeyCredentialsActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntry_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_ValkeyCredentialsActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntry_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_ValkeyCredentialsActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntry_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_ValkeyCredentialsActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntry_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_ValkeyCredentialsActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntry_data(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Data, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *valkey.ValkeyCredentialsActivityLogEntryData) graphql.Marshaler { + return ec.marshalNValkeyCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋvalkeyᚐValkeyCredentialsActivityLogEntryData(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ValkeyCredentialsActivityLogEntry", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_ValkeyCredentialsActivityLogEntryData(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntryData_permission(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntryData) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntryData_permission(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Permission, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalOString2string(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntryData_permission(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntryData_ttl(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntryData) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_ValkeyCredentialsActivityLogEntryData_ttl(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TTL, 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_ValkeyCredentialsActivityLogEntryData_ttl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _ValkeyDeletedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyDeletedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -2254,7 +2517,7 @@ func (ec *executionContext) unmarshalInputCreateValkeyCredentialsInput(ctx conte it.InstanceName = data case "permission": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permission")) - data, err := ec.unmarshalNCredentialPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx, v) + data, err := ec.unmarshalNValkeyPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx, v) if err != nil { return it, err } @@ -3579,6 +3842,123 @@ func (ec *executionContext) _ValkeyCredentials(ctx context.Context, sel ast.Sele return out } +var valkeyCredentialsActivityLogEntryImplementors = []string{"ValkeyCredentialsActivityLogEntry", "ActivityLogEntry", "Node"} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *valkey.ValkeyCredentialsActivityLogEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, valkeyCredentialsActivityLogEntryImplementors) + + 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("ValkeyCredentialsActivityLogEntry") + case "id": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "actor": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_actor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceType": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_resourceType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceName": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_resourceName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamSlug": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_teamSlug(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "environmentName": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_environmentName(ctx, field, obj) + case "data": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_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 valkeyCredentialsActivityLogEntryDataImplementors = []string{"ValkeyCredentialsActivityLogEntryData"} + +func (ec *executionContext) _ValkeyCredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *valkey.ValkeyCredentialsActivityLogEntryData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, valkeyCredentialsActivityLogEntryDataImplementors) + + 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("ValkeyCredentialsActivityLogEntryData") + case "permission": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntryData_permission(ctx, field, obj) + case "ttl": + out.Values[i] = ec._ValkeyCredentialsActivityLogEntryData_ttl(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 valkeyDeletedActivityLogEntryImplementors = []string{"ValkeyDeletedActivityLogEntry", "ActivityLogEntry", "Node"} func (ec *executionContext) _ValkeyDeletedActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *valkey.ValkeyDeletedActivityLogEntry) graphql.Marshaler { @@ -4256,6 +4636,16 @@ func (ec *executionContext) marshalNValkeyCredentials2ᚖgithubᚗcomᚋnaisᚋa return ec._ValkeyCredentials(ctx, sel, v) } +func (ec *executionContext) marshalNValkeyCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋvalkeyᚐValkeyCredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *valkey.ValkeyCredentialsActivityLogEntryData) 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._ValkeyCredentialsActivityLogEntryData(ctx, sel, v) +} + func (ec *executionContext) marshalNValkeyEdge2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdge(ctx context.Context, sel ast.SelectionSet, v pagination.Edge[*valkey.Valkey]) graphql.Marshaler { return ec._ValkeyEdge(ctx, sel, &v) } @@ -4296,6 +4686,16 @@ func (ec *executionContext) marshalNValkeyOrderField2githubᚗcomᚋnaisᚋapi return v } +func (ec *executionContext) unmarshalNValkeyPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx context.Context, v any) (aivencredentials.CredentialPermission, error) { + var res aivencredentials.CredentialPermission + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNValkeyPermission2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋaivencredentialsᚐCredentialPermission(ctx context.Context, sel ast.SelectionSet, v aivencredentials.CredentialPermission) graphql.Marshaler { + return v +} + func (ec *executionContext) unmarshalNValkeyState2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋvalkeyᚐValkeyState(ctx context.Context, v any) (valkey.ValkeyState, error) { var res valkey.ValkeyState err := res.UnmarshalGQL(v) diff --git a/internal/graph/schema/aiven_credentials.graphqls b/internal/graph/schema/aiven_credentials.graphqls deleted file mode 100644 index a212202ea..000000000 --- a/internal/graph/schema/aiven_credentials.graphqls +++ /dev/null @@ -1,48 +0,0 @@ -"Permission level for OpenSearch and Valkey credentials." -enum CredentialPermission { - READ - WRITE - READWRITE - ADMIN -} - -type CredentialsActivityLogEntry implements ActivityLogEntry & Node { - "ID of the entry." - id: ID! - - "The identity of the actor who performed the action." - actor: String! - - "Creation time of the entry." - createdAt: Time! - - "Message that summarizes the entry." - message: String! - - "Type of the resource that was affected by the action." - resourceType: ActivityLogEntryResourceType! - - "Name of the resource that was affected by the action." - resourceName: String! - - "The team slug that the entry belongs to." - teamSlug: Slug! - - "The environment name that the entry belongs to." - environmentName: String - - "Data associated with the credential creation." - data: CredentialsActivityLogEntryData! -} - -type CredentialsActivityLogEntryData { - "The permission level, if applicable." - permission: String - "The TTL that was requested for the credentials." - ttl: String! -} - -extend enum ActivityLogActivityType { - "Filter for credential creation events." - CREDENTIALS_CREATED -} diff --git a/internal/graph/schema/opensearch.graphqls b/internal/graph/schema/opensearch.graphqls index f089c4c7d..d5099115a 100644 --- a/internal/graph/schema/opensearch.graphqls +++ b/internal/graph/schema/opensearch.graphqls @@ -105,6 +105,13 @@ type OpenSearch implements Persistence & Node { ): IssueConnection! } +enum OpenSearchPermission { + READ + WRITE + READWRITE + ADMIN +} + enum OpenSearchState { POWEROFF REBALANCING @@ -443,7 +450,7 @@ input CreateOpenSearchCredentialsInput { "Name of the OpenSearch instance." instanceName: String! "Permission level for the credentials." - permission: CredentialPermission! + permission: OpenSearchPermission! "Time-to-live for the credentials (e.g. '1d', '7d'). Maximum 30 days." ttl: String! } @@ -465,3 +472,44 @@ type CreateOpenSearchCredentialsPayload { "The generated credentials." credentials: OpenSearchCredentials! } + +type OpenSearchCredentialsActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + + "The identity of the actor who performed the action." + actor: String! + + "Creation time of the entry." + createdAt: Time! + + "Message that summarizes the entry." + message: String! + + "Type of the resource that was affected by the action." + resourceType: ActivityLogEntryResourceType! + + "Name of the resource that was affected by the action." + resourceName: String! + + "The team slug that the entry belongs to." + teamSlug: Slug! + + "The environment name that the entry belongs to." + environmentName: String + + "Data associated with the credential creation." + data: OpenSearchCredentialsActivityLogEntryData! +} + +type OpenSearchCredentialsActivityLogEntryData { + "The permission level, if applicable." + permission: String + "The TTL that was requested for the credentials." + ttl: String! +} + +extend enum ActivityLogActivityType { + "Filter for credential creation events." + OPENSEARCH_CREDENTIALS_CREATED +} diff --git a/internal/graph/schema/valkey.graphqls b/internal/graph/schema/valkey.graphqls index ab334172a..bc424f8d9 100644 --- a/internal/graph/schema/valkey.graphqls +++ b/internal/graph/schema/valkey.graphqls @@ -202,6 +202,13 @@ input ValkeyOrder { direction: OrderDirection! } +enum ValkeyPermission { + READ + WRITE + READWRITE + ADMIN +} + enum ValkeyAccessOrderField { ACCESS WORKLOAD @@ -464,7 +471,7 @@ input CreateValkeyCredentialsInput { "Name of the Valkey instance." instanceName: String! "Permission level for the credentials." - permission: CredentialPermission! + permission: ValkeyPermission! "Time-to-live for the credentials (e.g. '1d', '7d'). Maximum 30 days." ttl: String! } @@ -486,3 +493,44 @@ type CreateValkeyCredentialsPayload { "The generated credentials." credentials: ValkeyCredentials! } + +type ValkeyCredentialsActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + + "The identity of the actor who performed the action." + actor: String! + + "Creation time of the entry." + createdAt: Time! + + "Message that summarizes the entry." + message: String! + + "Type of the resource that was affected by the action." + resourceType: ActivityLogEntryResourceType! + + "Name of the resource that was affected by the action." + resourceName: String! + + "The team slug that the entry belongs to." + teamSlug: Slug! + + "The environment name that the entry belongs to." + environmentName: String + + "Data associated with the credential creation." + data: ValkeyCredentialsActivityLogEntryData! +} + +type ValkeyCredentialsActivityLogEntryData { + "The permission level, if applicable." + permission: String + "The TTL that was requested for the credentials." + ttl: String! +} + +extend enum ActivityLogActivityType { + "Filter for credential creation events." + VALKEY_CREDENTIALS_CREATED +} diff --git a/internal/persistence/aivencredentials/activitylog.go b/internal/persistence/aivencredentials/activitylog.go deleted file mode 100644 index 45beeba50..000000000 --- a/internal/persistence/aivencredentials/activitylog.go +++ /dev/null @@ -1,47 +0,0 @@ -package aivencredentials - -import ( - "fmt" - - "github.com/nais/api/internal/activitylog" -) - -const ( - ActivityLogActivityTypeCredentialsCreated activitylog.ActivityLogActivityType = "CREDENTIALS_CREATED" - ActivityLogEntryActionCredentialsCreated activitylog.ActivityLogEntryAction = "CREDENTIALS_CREATED" -) - -func GetActivityLogEntry(entry activitylog.GenericActivityLogEntry) (activitylog.ActivityLogEntry, error) { - if entry.TeamSlug == nil { - return nil, fmt.Errorf("missing team slug for credentials activity log entry") - } - if entry.EnvironmentName == nil { - return nil, fmt.Errorf("missing environment name for credentials activity log entry") - } - data, err := activitylog.UnmarshalData[CredentialsActivityLogEntryData](entry) - if err != nil { - return nil, fmt.Errorf("transforming credentials activity log entry data: %w", err) - } - - msg := fmt.Sprintf("Created %s credentials for %s", entry.ResourceType, entry.ResourceName) - if data.Permission != "" { - msg += fmt.Sprintf(" with %s permission", data.Permission) - } - msg += fmt.Sprintf(" (TTL: %s)", data.TTL) - - return CredentialsActivityLogEntry{ - GenericActivityLogEntry: entry.WithMessage(msg), - Data: data, - }, nil -} - -type CredentialsActivityLogEntry struct { - activitylog.GenericActivityLogEntry - - Data *CredentialsActivityLogEntryData `json:"data"` -} - -type CredentialsActivityLogEntryData struct { - Permission string `json:"permission,omitempty"` - TTL string `json:"ttl"` -} diff --git a/internal/persistence/aivencredentials/models.go b/internal/persistence/aivencredentials/models.go index 5b3e3e4d7..b226f2bd9 100644 --- a/internal/persistence/aivencredentials/models.go +++ b/internal/persistence/aivencredentials/models.go @@ -6,7 +6,6 @@ import ( "strconv" ) -// CredentialPermission represents the permission level for OpenSearch and Valkey credentials. type CredentialPermission string const ( diff --git a/internal/persistence/aivencredentials/queries.go b/internal/persistence/aivencredentials/queries.go index 8729aec1d..a8da59a89 100644 --- a/internal/persistence/aivencredentials/queries.go +++ b/internal/persistence/aivencredentials/queries.go @@ -258,22 +258,3 @@ func parseTTL(ttl string, maxTTL time.Duration) (time.Duration, error) { } return d, nil } - -// LogCredentialCreation logs that credentials were created to the activity log. -func LogCredentialCreation(ctx context.Context, resourceType activitylog.ActivityLogEntryResourceType, req CredentialRequest) { - err := activitylog.Create(ctx, activitylog.CreateInput{ - Action: ActivityLogEntryActionCredentialsCreated, - Actor: authz.ActorFromContext(ctx).User, - ResourceType: resourceType, - ResourceName: req.InstanceName, - EnvironmentName: &req.EnvironmentName, - TeamSlug: &req.TeamSlug, - Data: CredentialsActivityLogEntryData{ - Permission: req.Permission, - TTL: req.TTL, - }, - }) - if err != nil { - fromContext(ctx).log.WithError(err).Warn("failed to create activity log entry") - } -} diff --git a/internal/persistence/opensearch/activitylog.go b/internal/persistence/opensearch/activitylog.go index 0eb52c712..8b809c2fe 100644 --- a/internal/persistence/opensearch/activitylog.go +++ b/internal/persistence/opensearch/activitylog.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/nais/api/internal/activitylog" - "github.com/nais/api/internal/persistence/aivencredentials" servicemaintenanceal "github.com/nais/api/internal/servicemaintenance/activitylog" ) @@ -36,8 +35,22 @@ func init() { return servicemaintenanceal.ServiceMaintenanceActivityLogEntry{ GenericActivityLogEntry: entry.WithMessage("Started service maintenance"), }, nil - case aivencredentials.ActivityLogEntryActionCredentialsCreated: - return aivencredentials.GetActivityLogEntry(entry) + case activitylog.ActivityLogEntryActionCredentialsCreated: + data, err := activitylog.UnmarshalData[OpenSearchCredentialsActivityLogEntryData](entry) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal OpenSearch credentials creation activity log entry data: %w", err) + } + + msg := fmt.Sprintf("Created credentials for %q", entry.ResourceName) + if data.Permission != "" { + msg += fmt.Sprintf(" with %q permission", OpenSearchPermission(data.Permission).AivenAccess()) + } + msg += fmt.Sprintf(" (TTL: %s)", data.TTL) + + return OpenSearchCredentialsActivityLogEntry{ + GenericActivityLogEntry: entry.WithMessage(msg), + Data: data, + }, nil default: return nil, fmt.Errorf("unsupported opensearch activity log entry action: %q", entry.Action) } @@ -47,7 +60,7 @@ func init() { activitylog.RegisterFilter("OPENSEARCH_UPDATED", activitylog.ActivityLogEntryActionUpdated, ActivityLogEntryResourceTypeOpenSearch) activitylog.RegisterFilter("OPENSEARCH_DELETED", activitylog.ActivityLogEntryActionDeleted, ActivityLogEntryResourceTypeOpenSearch) activitylog.RegisterFilter("OPENSEARCH_MAINTENANCE_STARTED", servicemaintenanceal.ActivityLogEntryActionMaintenanceStarted, ActivityLogEntryResourceTypeOpenSearch) - activitylog.RegisterFilter(aivencredentials.ActivityLogActivityTypeCredentialsCreated, aivencredentials.ActivityLogEntryActionCredentialsCreated, ActivityLogEntryResourceTypeOpenSearch) + activitylog.RegisterFilter("OPENSEARCH_CREDENTIALS_CREATED", activitylog.ActivityLogEntryActionCredentialsCreated, ActivityLogEntryResourceTypeOpenSearch) } type OpenSearchCreatedActivityLogEntry struct { @@ -72,3 +85,14 @@ type OpenSearchUpdatedActivityLogEntryDataUpdatedField struct { type OpenSearchDeletedActivityLogEntry struct { activitylog.GenericActivityLogEntry } + +type OpenSearchCredentialsActivityLogEntry struct { + activitylog.GenericActivityLogEntry + + Data *OpenSearchCredentialsActivityLogEntryData `json:"data"` +} + +type OpenSearchCredentialsActivityLogEntryData struct { + Permission string `json:"permission,omitempty"` + TTL string `json:"ttl"` +} diff --git a/internal/persistence/opensearch/dataloader.go b/internal/persistence/opensearch/dataloader.go index 474d6deba..72a6ab567 100644 --- a/internal/persistence/opensearch/dataloader.go +++ b/internal/persistence/opensearch/dataloader.go @@ -52,6 +52,7 @@ type loaders struct { versionLoader *dataloadgen.Loader[*AivenDataLoaderKey, string] tenantName string aivenClient aiven.AivenClient + log logrus.FieldLogger } func newLoaders(tenantName string, watcher *watcher.Watcher[*OpenSearch], aivenClient aiven.AivenClient, logger logrus.FieldLogger) *loaders { @@ -67,6 +68,7 @@ func newLoaders(tenantName string, watcher *watcher.Watcher[*OpenSearch], aivenC tenantName: tenantName, versionLoader: dataloadgen.NewLoader(versionLoader.getVersions, loader.DefaultDataLoaderOptions...), aivenClient: aivenClient, + log: logger, } } diff --git a/internal/persistence/opensearch/models.go b/internal/persistence/opensearch/models.go index 48693e5ae..6ca38f8a3 100644 --- a/internal/persistence/opensearch/models.go +++ b/internal/persistence/opensearch/models.go @@ -33,6 +33,8 @@ type ( OpenSearchAccessEdge = pagination.Edge[*OpenSearchAccess] ) +type OpenSearchPermission = aivencredentials.CredentialPermission + type OpenSearchFilter struct { Name string `json:"name"` Environments []string `json:"environments"` @@ -675,9 +677,9 @@ type CreateOpenSearchCredentialsPayload struct { } type CreateOpenSearchCredentialsInput struct { - TeamSlug slug.Slug `json:"teamSlug"` - EnvironmentName string `json:"environmentName"` - InstanceName string `json:"instanceName"` - Permission aivencredentials.CredentialPermission `json:"permission"` - TTL string `json:"ttl"` + TeamSlug slug.Slug `json:"teamSlug"` + EnvironmentName string `json:"environmentName"` + InstanceName string `json:"instanceName"` + Permission OpenSearchPermission `json:"permission"` + TTL string `json:"ttl"` } diff --git a/internal/persistence/opensearch/queries.go b/internal/persistence/opensearch/queries.go index 4ea58893f..7a14f8c66 100644 --- a/internal/persistence/opensearch/queries.go +++ b/internal/persistence/opensearch/queries.go @@ -374,7 +374,23 @@ func CreateOpenSearchCredentials(ctx context.Context, input CreateOpenSearchCred if err != nil { return nil, err } - aivencredentials.LogCredentialCreation(ctx, ActivityLogEntryResourceTypeOpenSearch, req) + + err = activitylog.Create(ctx, activitylog.CreateInput{ + Action: activitylog.ActivityLogEntryActionCredentialsCreated, + Actor: authz.ActorFromContext(ctx).User, + ResourceType: ActivityLogEntryResourceTypeOpenSearch, + ResourceName: req.InstanceName, + EnvironmentName: &req.EnvironmentName, + TeamSlug: &req.TeamSlug, + Data: OpenSearchCredentialsActivityLogEntryData{ + Permission: req.Permission, + TTL: req.TTL, + }, + }) + if err != nil { + fromContext(ctx).log.WithError(err).Warn("failed to create activity log entry") + } + return &CreateOpenSearchCredentialsPayload{Credentials: result.(*OpenSearchCredentials)}, nil } diff --git a/internal/persistence/valkey/activitylog.go b/internal/persistence/valkey/activitylog.go index 2a944b10c..a8ee29141 100644 --- a/internal/persistence/valkey/activitylog.go +++ b/internal/persistence/valkey/activitylog.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/nais/api/internal/activitylog" - "github.com/nais/api/internal/persistence/aivencredentials" servicemaintenanceal "github.com/nais/api/internal/servicemaintenance/activitylog" ) @@ -37,8 +36,21 @@ func init() { return servicemaintenanceal.ServiceMaintenanceActivityLogEntry{ GenericActivityLogEntry: entry.WithMessage("Started service maintenance"), }, nil - case aivencredentials.ActivityLogEntryActionCredentialsCreated: - return aivencredentials.GetActivityLogEntry(entry) + case activitylog.ActivityLogEntryActionCredentialsCreated: + data, err := activitylog.UnmarshalData[ValkeyCredentialsActivityLogEntryData](entry) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal Valkey credentials creation activity log entry data: %w", err) + } + msg := fmt.Sprintf("Created credentials for %q", entry.ResourceName) + if data.Permission != "" { + msg += fmt.Sprintf(" with %q permission", ValkeyPermission(data.Permission).AivenAccess()) + } + msg += fmt.Sprintf(" (TTL: %s)", data.TTL) + + return ValkeyCredentialsActivityLogEntry{ + GenericActivityLogEntry: entry.WithMessage(msg), + Data: data, + }, nil default: return nil, fmt.Errorf("unsupported valkey activity log entry action: %q", entry.Action) } @@ -48,7 +60,7 @@ func init() { activitylog.RegisterFilter("VALKEY_UPDATED", activitylog.ActivityLogEntryActionUpdated, ActivityLogEntryResourceTypeValkey) activitylog.RegisterFilter("VALKEY_DELETED", activitylog.ActivityLogEntryActionDeleted, ActivityLogEntryResourceTypeValkey) activitylog.RegisterFilter("VALKEY_MAINTENANCE_STARTED", servicemaintenanceal.ActivityLogEntryActionMaintenanceStarted, ActivityLogEntryResourceTypeValkey) - activitylog.RegisterFilter(aivencredentials.ActivityLogActivityTypeCredentialsCreated, aivencredentials.ActivityLogEntryActionCredentialsCreated, ActivityLogEntryResourceTypeValkey) + activitylog.RegisterFilter("VALKEY_CREDENTIALS_CREATED", activitylog.ActivityLogEntryActionCredentialsCreated, ActivityLogEntryResourceTypeValkey) } type ValkeyCreatedActivityLogEntry struct { @@ -73,3 +85,14 @@ type ValkeyUpdatedActivityLogEntryDataUpdatedField struct { type ValkeyDeletedActivityLogEntry struct { activitylog.GenericActivityLogEntry } + +type ValkeyCredentialsActivityLogEntry struct { + activitylog.GenericActivityLogEntry + + Data *ValkeyCredentialsActivityLogEntryData `json:"data"` +} + +type ValkeyCredentialsActivityLogEntryData struct { + Permission string `json:"permission,omitempty"` + TTL string `json:"ttl"` +} diff --git a/internal/persistence/valkey/dataloader.go b/internal/persistence/valkey/dataloader.go index 81cc60a53..31f30a200 100644 --- a/internal/persistence/valkey/dataloader.go +++ b/internal/persistence/valkey/dataloader.go @@ -5,6 +5,7 @@ import ( "github.com/nais/api/internal/kubernetes/watcher" "github.com/nais/api/internal/thirdparty/aiven" + "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -13,8 +14,8 @@ type ctxKey int const loadersKey ctxKey = iota -func NewLoaderContext(ctx context.Context, tenantName string, valkeyWatcher *watcher.Watcher[*Valkey], aivenClient aiven.AivenClient) context.Context { - return context.WithValue(ctx, loadersKey, newLoaders(tenantName, valkeyWatcher, aivenClient)) +func NewLoaderContext(ctx context.Context, tenantName string, valkeyWatcher *watcher.Watcher[*Valkey], aivenClient aiven.AivenClient, logger logrus.FieldLogger) context.Context { + return context.WithValue(ctx, loadersKey, newLoaders(tenantName, valkeyWatcher, aivenClient, logger)) } func NewWatcher(ctx context.Context, mgr *watcher.Manager) *watcher.Watcher[*Valkey] { @@ -42,9 +43,10 @@ type loaders struct { tenantName string watcher *watcher.Watcher[*Valkey] aivenClient aiven.AivenClient + log logrus.FieldLogger } -func newLoaders(tenantName string, watcher *watcher.Watcher[*Valkey], aivenClient aiven.AivenClient) *loaders { +func newLoaders(tenantName string, watcher *watcher.Watcher[*Valkey], aivenClient aiven.AivenClient, logger logrus.FieldLogger) *loaders { client := &client{ watcher: watcher, } @@ -54,5 +56,6 @@ func newLoaders(tenantName string, watcher *watcher.Watcher[*Valkey], aivenClien tenantName: tenantName, watcher: watcher, aivenClient: aivenClient, + log: logger, } } diff --git a/internal/persistence/valkey/models.go b/internal/persistence/valkey/models.go index 5779bf9c7..2b18eb851 100644 --- a/internal/persistence/valkey/models.go +++ b/internal/persistence/valkey/models.go @@ -30,6 +30,8 @@ type ( ValkeyAccessEdge = pagination.Edge[*ValkeyAccess] ) +type ValkeyPermission = aivencredentials.CredentialPermission + type ValkeyFilter struct { Name string `json:"name"` Environments []string `json:"environments"` @@ -577,11 +579,11 @@ func (e ValkeyState) MarshalGQL(w io.Writer) { } type CreateValkeyCredentialsInput struct { - TeamSlug slug.Slug `json:"teamSlug"` - EnvironmentName string `json:"environmentName"` - InstanceName string `json:"instanceName"` - Permission aivencredentials.CredentialPermission `json:"permission"` - TTL string `json:"ttl"` + TeamSlug slug.Slug `json:"teamSlug"` + EnvironmentName string `json:"environmentName"` + InstanceName string `json:"instanceName"` + Permission ValkeyPermission `json:"permission"` + TTL string `json:"ttl"` } type ValkeyCredentials struct { diff --git a/internal/persistence/valkey/queries.go b/internal/persistence/valkey/queries.go index d46aa21f8..5b843c1b9 100644 --- a/internal/persistence/valkey/queries.go +++ b/internal/persistence/valkey/queries.go @@ -364,7 +364,23 @@ func CreateValkeyCredentials(ctx context.Context, input CreateValkeyCredentialsI if err != nil { return nil, err } - aivencredentials.LogCredentialCreation(ctx, ActivityLogEntryResourceTypeValkey, req) + + err = activitylog.Create(ctx, activitylog.CreateInput{ + Action: activitylog.ActivityLogEntryActionCredentialsCreated, + Actor: authz.ActorFromContext(ctx).User, + ResourceType: ActivityLogEntryResourceTypeValkey, + ResourceName: req.InstanceName, + EnvironmentName: &req.EnvironmentName, + TeamSlug: &req.TeamSlug, + Data: ValkeyCredentialsActivityLogEntryData{ + Permission: req.Permission, + TTL: req.TTL, + }, + }) + if err != nil { + fromContext(ctx).log.WithError(err).Warn("failed to create activity log entry") + } + return &CreateValkeyCredentialsPayload{Credentials: result.(*ValkeyCredentials)}, nil } From 86f1a77c67008df98b6a691ae341e0fa61f4d11c Mon Sep 17 00:00:00 2001 From: Thomas Krampl <85170275+thokra-nav@users.noreply.github.com> Date: Tue, 25 Aug 2026 09:02:43 +0200 Subject: [PATCH 2/7] Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- internal/graph/schema/opensearch.graphqls | 5 +++++ internal/graph/schema/valkey.graphqls | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/internal/graph/schema/opensearch.graphqls b/internal/graph/schema/opensearch.graphqls index d5099115a..d485f2a6f 100644 --- a/internal/graph/schema/opensearch.graphqls +++ b/internal/graph/schema/opensearch.graphqls @@ -105,10 +105,15 @@ type OpenSearch implements Persistence & Node { ): IssueConnection! } +"Permission level for OpenSearch credentials." enum OpenSearchPermission { + "Read-only access." READ + "Write-only access." WRITE + "Read and write access." READWRITE + "Administrative access." ADMIN } diff --git a/internal/graph/schema/valkey.graphqls b/internal/graph/schema/valkey.graphqls index bc424f8d9..fa962ea5d 100644 --- a/internal/graph/schema/valkey.graphqls +++ b/internal/graph/schema/valkey.graphqls @@ -202,10 +202,15 @@ input ValkeyOrder { direction: OrderDirection! } +"Permission level for Valkey credentials." enum ValkeyPermission { + "Read-only access." READ + "Write-only access." WRITE + "Read and write access." READWRITE + "Administrative access." ADMIN } From 2d0ec0622ae2dc0e4eb6b60af2ad1c7fdd3704fa Mon Sep 17 00:00:00 2001 From: Thomas Krampl Date: Tue, 25 Aug 2026 09:09:59 +0200 Subject: [PATCH 3/7] Generate graphql --- internal/graph/gengql/root_.generated.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/graph/gengql/root_.generated.go b/internal/graph/gengql/root_.generated.go index 32d00563f..4889a83d1 100644 --- a/internal/graph/gengql/root_.generated.go +++ b/internal/graph/gengql/root_.generated.go @@ -25070,10 +25070,15 @@ type OpenSearch implements Persistence & Node { ): IssueConnection! } +"Permission level for OpenSearch credentials." enum OpenSearchPermission { + "Read-only access." READ + "Write-only access." WRITE + "Read and write access." READWRITE + "Administrative access." ADMIN } @@ -31256,10 +31261,15 @@ input ValkeyOrder { direction: OrderDirection! } +"Permission level for Valkey credentials." enum ValkeyPermission { + "Read-only access." READ + "Write-only access." WRITE + "Read and write access." READWRITE + "Administrative access." ADMIN } From e4e73564446b3f07a9aed2b4e06727f65c33487a Mon Sep 17 00:00:00 2001 From: Christer Edvartsen Date: Tue, 25 Aug 2026 10:27:06 +0200 Subject: [PATCH 4/7] refactor: fix incorrect names for types Also add activity log for kafka credential creation --- .../graph/gengql/activitylog.generated.go | 24 +- internal/graph/gengql/kafka.generated.go | 367 ++++++++++++++++++ internal/graph/gengql/opensearch.generated.go | 136 +++---- internal/graph/gengql/root_.generated.go | 301 ++++++++++---- internal/graph/gengql/schema.generated.go | 23 +- internal/graph/gengql/valkey.generated.go | 136 +++---- internal/graph/schema/kafka.graphqls | 39 ++ internal/graph/schema/opensearch.graphqls | 6 +- internal/graph/schema/valkey.graphqls | 6 +- .../persistence/kafkatopic/activitylog.go | 36 ++ internal/persistence/kafkatopic/queries.go | 19 +- .../persistence/opensearch/activitylog.go | 10 +- internal/persistence/opensearch/queries.go | 2 +- internal/persistence/valkey/activitylog.go | 10 +- internal/persistence/valkey/queries.go | 2 +- 15 files changed, 862 insertions(+), 255 deletions(-) diff --git a/internal/graph/gengql/activitylog.generated.go b/internal/graph/gengql/activitylog.generated.go index aca69ec88..048de627f 100644 --- a/internal/graph/gengql/activitylog.generated.go +++ b/internal/graph/gengql/activitylog.generated.go @@ -17,6 +17,7 @@ import ( "github.com/nais/api/internal/graph/model" "github.com/nais/api/internal/graph/pagination" "github.com/nais/api/internal/kubernetes/event/pubsublog" + "github.com/nais/api/internal/persistence/kafkatopic" "github.com/nais/api/internal/persistence/opensearch" "github.com/nais/api/internal/persistence/postgres" "github.com/nais/api/internal/persistence/valkey" @@ -515,13 +516,13 @@ func (ec *executionContext) _ActivityLogEntry(ctx context.Context, sel ast.Selec return graphql.Null } return ec._ValkeyDeletedActivityLogEntry(ctx, sel, obj) - case valkey.ValkeyCredentialsActivityLogEntry: - return ec._ValkeyCredentialsActivityLogEntry(ctx, sel, &obj) - case *valkey.ValkeyCredentialsActivityLogEntry: + case valkey.ValkeyCredentialsCreatedActivityLogEntry: + return ec._ValkeyCredentialsCreatedActivityLogEntry(ctx, sel, &obj) + case *valkey.ValkeyCredentialsCreatedActivityLogEntry: if obj == nil { return graphql.Null } - return ec._ValkeyCredentialsActivityLogEntry(ctx, sel, obj) + return ec._ValkeyCredentialsCreatedActivityLogEntry(ctx, sel, obj) case valkey.ValkeyCreatedActivityLogEntry: return ec._ValkeyCreatedActivityLogEntry(ctx, sel, &obj) case *valkey.ValkeyCreatedActivityLogEntry: @@ -816,13 +817,13 @@ func (ec *executionContext) _ActivityLogEntry(ctx context.Context, sel ast.Selec return graphql.Null } return ec._OpenSearchDeletedActivityLogEntry(ctx, sel, obj) - case opensearch.OpenSearchCredentialsActivityLogEntry: - return ec._OpenSearchCredentialsActivityLogEntry(ctx, sel, &obj) - case *opensearch.OpenSearchCredentialsActivityLogEntry: + case opensearch.OpenSearchCredentialsCreatedActivityLogEntry: + return ec._OpenSearchCredentialsCreatedActivityLogEntry(ctx, sel, &obj) + case *opensearch.OpenSearchCredentialsCreatedActivityLogEntry: if obj == nil { return graphql.Null } - return ec._OpenSearchCredentialsActivityLogEntry(ctx, sel, obj) + return ec._OpenSearchCredentialsCreatedActivityLogEntry(ctx, sel, obj) case opensearch.OpenSearchCreatedActivityLogEntry: return ec._OpenSearchCreatedActivityLogEntry(ctx, sel, &obj) case *opensearch.OpenSearchCreatedActivityLogEntry: @@ -830,6 +831,13 @@ func (ec *executionContext) _ActivityLogEntry(ctx context.Context, sel ast.Selec return graphql.Null } return ec._OpenSearchCreatedActivityLogEntry(ctx, sel, obj) + case kafkatopic.KafkaCredentialsCreatedActivityLogEntry: + return ec._KafkaCredentialsCreatedActivityLogEntry(ctx, sel, &obj) + case *kafkatopic.KafkaCredentialsCreatedActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._KafkaCredentialsCreatedActivityLogEntry(ctx, sel, obj) case job.JobUpdatedActivityLogEntry: return ec._JobUpdatedActivityLogEntry(ctx, sel, &obj) case *job.JobUpdatedActivityLogEntry: diff --git a/internal/graph/gengql/kafka.generated.go b/internal/graph/gengql/kafka.generated.go index 4471db4e2..31a4df9a7 100644 --- a/internal/graph/gengql/kafka.generated.go +++ b/internal/graph/gengql/kafka.generated.go @@ -8,12 +8,15 @@ import ( "math" "strconv" "sync/atomic" + "time" "github.com/99designs/gqlgen/graphql" + "github.com/nais/api/internal/activitylog" "github.com/nais/api/internal/graph/ident" "github.com/nais/api/internal/graph/model" "github.com/nais/api/internal/graph/pagination" "github.com/nais/api/internal/persistence/kafkatopic" + "github.com/nais/api/internal/slug" "github.com/nais/api/internal/team" "github.com/nais/api/internal/workload" "github.com/vektah/gqlparser/v2/ast" @@ -271,6 +274,245 @@ func (ec *executionContext) fieldContext_KafkaCredentials_schemaRegistry(_ conte return graphql.NewScalarFieldContext("KafkaCredentials", field, false, false, errors.New("field of type String does not have child fields")) } +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntry_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_KafkaCredentialsCreatedActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("KafkaCredentialsCreatedActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntry_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_KafkaCredentialsCreatedActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("KafkaCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntry_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_KafkaCredentialsCreatedActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("KafkaCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntry_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_KafkaCredentialsCreatedActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("KafkaCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntry_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_KafkaCredentialsCreatedActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("KafkaCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntry_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_KafkaCredentialsCreatedActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("KafkaCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntry_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_KafkaCredentialsCreatedActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("KafkaCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntry_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_KafkaCredentialsCreatedActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("KafkaCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntry_data(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Data, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *kafkatopic.KafkaCredentialsCreatedActivityLogEntryData) graphql.Marshaler { + return ec.marshalNKafkaCredentialsCreatedActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋkafkatopicᚐKafkaCredentialsCreatedActivityLogEntryData(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_KafkaCredentialsCreatedActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "KafkaCredentialsCreatedActivityLogEntry", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_KafkaCredentialsCreatedActivityLogEntryData(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntryData_ttl(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntryData) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntryData_ttl(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TTL, 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_KafkaCredentialsCreatedActivityLogEntryData_ttl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("KafkaCredentialsCreatedActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _KafkaTopic_id(ctx context.Context, field graphql.CollectedField, obj *kafkatopic.KafkaTopic) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -1642,6 +1884,121 @@ func (ec *executionContext) _KafkaCredentials(ctx context.Context, sel ast.Selec return out } +var kafkaCredentialsCreatedActivityLogEntryImplementors = []string{"KafkaCredentialsCreatedActivityLogEntry", "ActivityLogEntry", "Node"} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, kafkaCredentialsCreatedActivityLogEntryImplementors) + + 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("KafkaCredentialsCreatedActivityLogEntry") + case "id": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntry_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "actor": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntry_actor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntry_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntry_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceType": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntry_resourceType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceName": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntry_resourceName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamSlug": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntry_teamSlug(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "environmentName": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntry_environmentName(ctx, field, obj) + case "data": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntry_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 kafkaCredentialsCreatedActivityLogEntryDataImplementors = []string{"KafkaCredentialsCreatedActivityLogEntryData"} + +func (ec *executionContext) _KafkaCredentialsCreatedActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *kafkatopic.KafkaCredentialsCreatedActivityLogEntryData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, kafkaCredentialsCreatedActivityLogEntryDataImplementors) + + 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("KafkaCredentialsCreatedActivityLogEntryData") + case "ttl": + out.Values[i] = ec._KafkaCredentialsCreatedActivityLogEntryData_ttl(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 kafkaTopicImplementors = []string{"KafkaTopic", "Persistence", "Node", "SearchNode"} func (ec *executionContext) _KafkaTopic(ctx context.Context, sel ast.SelectionSet, obj *kafkatopic.KafkaTopic) graphql.Marshaler { @@ -2440,6 +2797,16 @@ func (ec *executionContext) marshalNKafkaCredentials2ᚖgithubᚗcomᚋnaisᚋap return ec._KafkaCredentials(ctx, sel, v) } +func (ec *executionContext) marshalNKafkaCredentialsCreatedActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋkafkatopicᚐKafkaCredentialsCreatedActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *kafkatopic.KafkaCredentialsCreatedActivityLogEntryData) 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._KafkaCredentialsCreatedActivityLogEntryData(ctx, sel, v) +} + func (ec *executionContext) marshalNKafkaTopic2githubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋkafkatopicᚐKafkaTopic(ctx context.Context, sel ast.SelectionSet, v kafkatopic.KafkaTopic) graphql.Marshaler { return ec._KafkaTopic(ctx, sel, &v) } diff --git a/internal/graph/gengql/opensearch.generated.go b/internal/graph/gengql/opensearch.generated.go index 8626a548e..6900d0aa4 100644 --- a/internal/graph/gengql/opensearch.generated.go +++ b/internal/graph/gengql/opensearch.generated.go @@ -1444,13 +1444,13 @@ func (ec *executionContext) fieldContext_OpenSearchCredentials_uri(_ context.Con return graphql.NewScalarFieldContext("OpenSearchCredentials", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_id(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID(), nil @@ -1463,17 +1463,17 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_id(ctx contex true, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_actor(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_actor(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Actor, nil @@ -1486,17 +1486,17 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_actor(ctx con true, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_createdAt(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil @@ -1509,17 +1509,17 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_createdAt(ctx true, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_message(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_message(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Message, nil @@ -1532,17 +1532,17 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_message(ctx c true, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_resourceType(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_resourceType(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ResourceType, nil @@ -1555,17 +1555,17 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_resourceType( true, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_resourceName(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_resourceName(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ResourceName, nil @@ -1578,17 +1578,17 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_resourceName( true, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_teamSlug(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_teamSlug(ctx, field) }, func(ctx context.Context) (any, error) { return obj.TeamSlug, nil @@ -1601,17 +1601,17 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_teamSlug(ctx true, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_environmentName(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_environmentName(ctx, field) }, func(ctx context.Context) (any, error) { return obj.EnvironmentName, nil @@ -1624,49 +1624,49 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_environmentNa false, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntry_data(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_data(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Data, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *opensearch.OpenSearchCredentialsActivityLogEntryData) graphql.Marshaler { - return ec.marshalNOpenSearchCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋopensearchᚐOpenSearchCredentialsActivityLogEntryData(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *opensearch.OpenSearchCredentialsCreatedActivityLogEntryData) graphql.Marshaler { + return ec.marshalNOpenSearchCredentialsCreatedActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋopensearchᚐOpenSearchCredentialsCreatedActivityLogEntryData(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "OpenSearchCredentialsActivityLogEntry", + Object: "OpenSearchCredentialsCreatedActivityLogEntry", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_OpenSearchCredentialsActivityLogEntryData(ctx, field) + return ec.childFields_OpenSearchCredentialsCreatedActivityLogEntryData(ctx, field) }, } return fc, nil } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntryData_permission(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntryData) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntryData_permission(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntryData) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntryData_permission(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntryData_permission(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Permission, nil @@ -1679,17 +1679,17 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntryData_permissio false, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntryData_permission(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntryData_permission(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntryData_ttl(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsActivityLogEntryData) (ret graphql.Marshaler) { +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntryData_ttl(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntryData) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_OpenSearchCredentialsActivityLogEntryData_ttl(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntryData_ttl(ctx, field) }, func(ctx context.Context) (any, error) { return obj.TTL, nil @@ -1702,8 +1702,8 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntryData_ttl(ctx c true, ) } -func (ec *executionContext) fieldContext_OpenSearchCredentialsActivityLogEntryData_ttl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("OpenSearchCredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_OpenSearchCredentialsCreatedActivityLogEntryData_ttl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("OpenSearchCredentialsCreatedActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _OpenSearchDeletedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *opensearch.OpenSearchDeletedActivityLogEntry) (ret graphql.Marshaler) { @@ -3815,56 +3815,56 @@ func (ec *executionContext) _OpenSearchCredentials(ctx context.Context, sel ast. return out } -var openSearchCredentialsActivityLogEntryImplementors = []string{"OpenSearchCredentialsActivityLogEntry", "ActivityLogEntry", "Node"} +var openSearchCredentialsCreatedActivityLogEntryImplementors = []string{"OpenSearchCredentialsCreatedActivityLogEntry", "ActivityLogEntry", "Node"} -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *opensearch.OpenSearchCredentialsActivityLogEntry) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, openSearchCredentialsActivityLogEntryImplementors) +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, openSearchCredentialsCreatedActivityLogEntryImplementors) 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("OpenSearchCredentialsActivityLogEntry") + out.Values[i] = graphql.MarshalString("OpenSearchCredentialsCreatedActivityLogEntry") case "id": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_id(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntry_id(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "actor": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_actor(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntry_actor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "createdAt": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_createdAt(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntry_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "message": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_message(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntry_message(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "resourceType": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_resourceType(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntry_resourceType(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "resourceName": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_resourceName(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntry_resourceName(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "teamSlug": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_teamSlug(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntry_teamSlug(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "environmentName": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_environmentName(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntry_environmentName(ctx, field, obj) case "data": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntry_data(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntry_data(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -3891,21 +3891,21 @@ func (ec *executionContext) _OpenSearchCredentialsActivityLogEntry(ctx context.C return out } -var openSearchCredentialsActivityLogEntryDataImplementors = []string{"OpenSearchCredentialsActivityLogEntryData"} +var openSearchCredentialsCreatedActivityLogEntryDataImplementors = []string{"OpenSearchCredentialsCreatedActivityLogEntryData"} -func (ec *executionContext) _OpenSearchCredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *opensearch.OpenSearchCredentialsActivityLogEntryData) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, openSearchCredentialsActivityLogEntryDataImplementors) +func (ec *executionContext) _OpenSearchCredentialsCreatedActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *opensearch.OpenSearchCredentialsCreatedActivityLogEntryData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, openSearchCredentialsCreatedActivityLogEntryDataImplementors) 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("OpenSearchCredentialsActivityLogEntryData") + out.Values[i] = graphql.MarshalString("OpenSearchCredentialsCreatedActivityLogEntryData") case "permission": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntryData_permission(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntryData_permission(ctx, field, obj) case "ttl": - out.Values[i] = ec._OpenSearchCredentialsActivityLogEntryData_ttl(ctx, field, obj) + out.Values[i] = ec._OpenSearchCredentialsCreatedActivityLogEntryData_ttl(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -4695,14 +4695,14 @@ func (ec *executionContext) marshalNOpenSearchCredentials2ᚖgithubᚗcomᚋnais return ec._OpenSearchCredentials(ctx, sel, v) } -func (ec *executionContext) marshalNOpenSearchCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋopensearchᚐOpenSearchCredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *opensearch.OpenSearchCredentialsActivityLogEntryData) graphql.Marshaler { +func (ec *executionContext) marshalNOpenSearchCredentialsCreatedActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋopensearchᚐOpenSearchCredentialsCreatedActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *opensearch.OpenSearchCredentialsCreatedActivityLogEntryData) 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._OpenSearchCredentialsActivityLogEntryData(ctx, sel, v) + return ec._OpenSearchCredentialsCreatedActivityLogEntryData(ctx, sel, v) } func (ec *executionContext) marshalNOpenSearchEdge2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdge(ctx context.Context, sel ast.SelectionSet, v pagination.Edge[*opensearch.OpenSearch]) graphql.Marshaler { diff --git a/internal/graph/gengql/root_.generated.go b/internal/graph/gengql/root_.generated.go index 4889a83d1..e4f3ecb3c 100644 --- a/internal/graph/gengql/root_.generated.go +++ b/internal/graph/gengql/root_.generated.go @@ -1354,6 +1354,22 @@ type ComplexityRoot struct { Username func(childComplexity int) int } + KafkaCredentialsCreatedActivityLogEntry 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 + } + + KafkaCredentialsCreatedActivityLogEntryData struct { + TTL func(childComplexity int) int + } + KafkaLagScalingStrategy struct { ConsumerGroup func(childComplexity int) int Threshold func(childComplexity int) int @@ -1651,7 +1667,7 @@ type ComplexityRoot struct { Username func(childComplexity int) int } - OpenSearchCredentialsActivityLogEntry struct { + OpenSearchCredentialsCreatedActivityLogEntry struct { Actor func(childComplexity int) int CreatedAt func(childComplexity int) int Data func(childComplexity int) int @@ -1663,7 +1679,7 @@ type ComplexityRoot struct { TeamSlug func(childComplexity int) int } - OpenSearchCredentialsActivityLogEntryData struct { + OpenSearchCredentialsCreatedActivityLogEntryData struct { Permission func(childComplexity int) int TTL func(childComplexity int) int } @@ -3462,7 +3478,7 @@ type ComplexityRoot struct { Username func(childComplexity int) int } - ValkeyCredentialsActivityLogEntry struct { + ValkeyCredentialsCreatedActivityLogEntry struct { Actor func(childComplexity int) int CreatedAt func(childComplexity int) int Data func(childComplexity int) int @@ -3474,7 +3490,7 @@ type ComplexityRoot struct { TeamSlug func(childComplexity int) int } - ValkeyCredentialsActivityLogEntryData struct { + ValkeyCredentialsCreatedActivityLogEntryData struct { Permission func(childComplexity int) int TTL func(childComplexity int) int } @@ -8563,6 +8579,76 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.KafkaCredentials.Username(childComplexity), true + case "KafkaCredentialsCreatedActivityLogEntry.actor": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.Actor == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.Actor(childComplexity), true + + case "KafkaCredentialsCreatedActivityLogEntry.createdAt": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.CreatedAt == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.CreatedAt(childComplexity), true + + case "KafkaCredentialsCreatedActivityLogEntry.data": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.Data == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.Data(childComplexity), true + + case "KafkaCredentialsCreatedActivityLogEntry.environmentName": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.EnvironmentName == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.EnvironmentName(childComplexity), true + + case "KafkaCredentialsCreatedActivityLogEntry.id": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.ID == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.ID(childComplexity), true + + case "KafkaCredentialsCreatedActivityLogEntry.message": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.Message == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.Message(childComplexity), true + + case "KafkaCredentialsCreatedActivityLogEntry.resourceName": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.ResourceName == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.ResourceName(childComplexity), true + + case "KafkaCredentialsCreatedActivityLogEntry.resourceType": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.ResourceType == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.ResourceType(childComplexity), true + + case "KafkaCredentialsCreatedActivityLogEntry.teamSlug": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.TeamSlug == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntry.TeamSlug(childComplexity), true + + case "KafkaCredentialsCreatedActivityLogEntryData.ttl": + if e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntryData.TTL == nil { + break + } + + return e.ComplexityRoot.KafkaCredentialsCreatedActivityLogEntryData.TTL(childComplexity), true + case "KafkaLagScalingStrategy.consumerGroup": if e.ComplexityRoot.KafkaLagScalingStrategy.ConsumerGroup == nil { break @@ -10252,82 +10338,82 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.OpenSearchCredentials.Username(childComplexity), true - case "OpenSearchCredentialsActivityLogEntry.actor": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Actor == nil { + case "OpenSearchCredentialsCreatedActivityLogEntry.actor": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.Actor == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Actor(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.Actor(childComplexity), true - case "OpenSearchCredentialsActivityLogEntry.createdAt": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.CreatedAt == nil { + case "OpenSearchCredentialsCreatedActivityLogEntry.createdAt": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.CreatedAt == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.CreatedAt(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.CreatedAt(childComplexity), true - case "OpenSearchCredentialsActivityLogEntry.data": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Data == nil { + case "OpenSearchCredentialsCreatedActivityLogEntry.data": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.Data == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Data(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.Data(childComplexity), true - case "OpenSearchCredentialsActivityLogEntry.environmentName": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.EnvironmentName == nil { + case "OpenSearchCredentialsCreatedActivityLogEntry.environmentName": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.EnvironmentName == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.EnvironmentName(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.EnvironmentName(childComplexity), true - case "OpenSearchCredentialsActivityLogEntry.id": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ID == nil { + case "OpenSearchCredentialsCreatedActivityLogEntry.id": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.ID == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ID(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.ID(childComplexity), true - case "OpenSearchCredentialsActivityLogEntry.message": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Message == nil { + case "OpenSearchCredentialsCreatedActivityLogEntry.message": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.Message == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.Message(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.Message(childComplexity), true - case "OpenSearchCredentialsActivityLogEntry.resourceName": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ResourceName == nil { + case "OpenSearchCredentialsCreatedActivityLogEntry.resourceName": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.ResourceName == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ResourceName(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.ResourceName(childComplexity), true - case "OpenSearchCredentialsActivityLogEntry.resourceType": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ResourceType == nil { + case "OpenSearchCredentialsCreatedActivityLogEntry.resourceType": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.ResourceType == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.ResourceType(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.ResourceType(childComplexity), true - case "OpenSearchCredentialsActivityLogEntry.teamSlug": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.TeamSlug == nil { + case "OpenSearchCredentialsCreatedActivityLogEntry.teamSlug": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.TeamSlug == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntry.TeamSlug(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntry.TeamSlug(childComplexity), true - case "OpenSearchCredentialsActivityLogEntryData.permission": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntryData.Permission == nil { + case "OpenSearchCredentialsCreatedActivityLogEntryData.permission": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntryData.Permission == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntryData.Permission(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntryData.Permission(childComplexity), true - case "OpenSearchCredentialsActivityLogEntryData.ttl": - if e.ComplexityRoot.OpenSearchCredentialsActivityLogEntryData.TTL == nil { + case "OpenSearchCredentialsCreatedActivityLogEntryData.ttl": + if e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntryData.TTL == nil { break } - return e.ComplexityRoot.OpenSearchCredentialsActivityLogEntryData.TTL(childComplexity), true + return e.ComplexityRoot.OpenSearchCredentialsCreatedActivityLogEntryData.TTL(childComplexity), true case "OpenSearchDeletedActivityLogEntry.actor": if e.ComplexityRoot.OpenSearchDeletedActivityLogEntry.Actor == nil { @@ -18235,82 +18321,82 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.ValkeyCredentials.Username(childComplexity), true - case "ValkeyCredentialsActivityLogEntry.actor": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Actor == nil { + case "ValkeyCredentialsCreatedActivityLogEntry.actor": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.Actor == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Actor(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.Actor(childComplexity), true - case "ValkeyCredentialsActivityLogEntry.createdAt": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.CreatedAt == nil { + case "ValkeyCredentialsCreatedActivityLogEntry.createdAt": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.CreatedAt == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.CreatedAt(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.CreatedAt(childComplexity), true - case "ValkeyCredentialsActivityLogEntry.data": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Data == nil { + case "ValkeyCredentialsCreatedActivityLogEntry.data": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.Data == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Data(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.Data(childComplexity), true - case "ValkeyCredentialsActivityLogEntry.environmentName": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.EnvironmentName == nil { + case "ValkeyCredentialsCreatedActivityLogEntry.environmentName": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.EnvironmentName == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.EnvironmentName(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.EnvironmentName(childComplexity), true - case "ValkeyCredentialsActivityLogEntry.id": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ID == nil { + case "ValkeyCredentialsCreatedActivityLogEntry.id": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.ID == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ID(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.ID(childComplexity), true - case "ValkeyCredentialsActivityLogEntry.message": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Message == nil { + case "ValkeyCredentialsCreatedActivityLogEntry.message": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.Message == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.Message(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.Message(childComplexity), true - case "ValkeyCredentialsActivityLogEntry.resourceName": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ResourceName == nil { + case "ValkeyCredentialsCreatedActivityLogEntry.resourceName": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.ResourceName == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ResourceName(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.ResourceName(childComplexity), true - case "ValkeyCredentialsActivityLogEntry.resourceType": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ResourceType == nil { + case "ValkeyCredentialsCreatedActivityLogEntry.resourceType": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.ResourceType == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.ResourceType(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.ResourceType(childComplexity), true - case "ValkeyCredentialsActivityLogEntry.teamSlug": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.TeamSlug == nil { + case "ValkeyCredentialsCreatedActivityLogEntry.teamSlug": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.TeamSlug == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntry.TeamSlug(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntry.TeamSlug(childComplexity), true - case "ValkeyCredentialsActivityLogEntryData.permission": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntryData.Permission == nil { + case "ValkeyCredentialsCreatedActivityLogEntryData.permission": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntryData.Permission == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntryData.Permission(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntryData.Permission(childComplexity), true - case "ValkeyCredentialsActivityLogEntryData.ttl": - if e.ComplexityRoot.ValkeyCredentialsActivityLogEntryData.TTL == nil { + case "ValkeyCredentialsCreatedActivityLogEntryData.ttl": + if e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntryData.TTL == nil { break } - return e.ComplexityRoot.ValkeyCredentialsActivityLogEntryData.TTL(childComplexity), true + return e.ComplexityRoot.ValkeyCredentialsCreatedActivityLogEntryData.TTL(childComplexity), true case "ValkeyDeletedActivityLogEntry.actor": if e.ComplexityRoot.ValkeyDeletedActivityLogEntry.Actor == nil { @@ -24636,6 +24722,45 @@ type CreateKafkaCredentialsPayload { "The generated credentials." credentials: KafkaCredentials! } + +type KafkaCredentialsCreatedActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + + "The identity of the actor who performed the action." + actor: String! + + "Creation time of the entry." + createdAt: Time! + + "Message that summarizes the entry." + message: String! + + "Type of the resource that was affected by the action." + resourceType: ActivityLogEntryResourceType! + + "Name of the resource that was affected by the action." + resourceName: String! + + "The team slug that the entry belongs to." + teamSlug: Slug! + + "The environment name that the entry belongs to." + environmentName: String + + "Data associated with the credential creation." + data: KafkaCredentialsCreatedActivityLogEntryData! +} + +type KafkaCredentialsCreatedActivityLogEntryData { + "The TTL that was requested for the credentials." + ttl: String! +} + +extend enum ActivityLogActivityType { + "Filter for Kafka credential creation events." + KAFKA_CREDENTIALS_CREATED +} `, BuiltIn: false}, {Name: "../schema/labels.graphqls", Input: `""" A user-defined label attached to a resource. @@ -25443,7 +25568,7 @@ type CreateOpenSearchCredentialsPayload { credentials: OpenSearchCredentials! } -type OpenSearchCredentialsActivityLogEntry implements ActivityLogEntry & Node { +type OpenSearchCredentialsCreatedActivityLogEntry implements ActivityLogEntry & Node { "ID of the entry." id: ID! @@ -25469,10 +25594,10 @@ type OpenSearchCredentialsActivityLogEntry implements ActivityLogEntry & Node { environmentName: String "Data associated with the credential creation." - data: OpenSearchCredentialsActivityLogEntryData! + data: OpenSearchCredentialsCreatedActivityLogEntryData! } -type OpenSearchCredentialsActivityLogEntryData { +type OpenSearchCredentialsCreatedActivityLogEntryData { "The permission level, if applicable." permission: String "The TTL that was requested for the credentials." @@ -31558,7 +31683,7 @@ type CreateValkeyCredentialsPayload { credentials: ValkeyCredentials! } -type ValkeyCredentialsActivityLogEntry implements ActivityLogEntry & Node { +type ValkeyCredentialsCreatedActivityLogEntry implements ActivityLogEntry & Node { "ID of the entry." id: ID! @@ -31584,10 +31709,10 @@ type ValkeyCredentialsActivityLogEntry implements ActivityLogEntry & Node { environmentName: String "Data associated with the credential creation." - data: ValkeyCredentialsActivityLogEntryData! + data: ValkeyCredentialsCreatedActivityLogEntryData! } -type ValkeyCredentialsActivityLogEntryData { +type ValkeyCredentialsCreatedActivityLogEntryData { "The permission level, if applicable." permission: String "The TTL that was requested for the credentials." @@ -34740,6 +34865,14 @@ func (ec *executionContext) childFields_KafkaCredentials(ctx context.Context, fi return nil, fmt.Errorf("no field named %q was found under type KafkaCredentials", field.Name) } +func (ec *executionContext) childFields_KafkaCredentialsCreatedActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "ttl": + return ec.fieldContext_KafkaCredentialsCreatedActivityLogEntryData_ttl(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type KafkaCredentialsCreatedActivityLogEntryData", field.Name) +} + func (ec *executionContext) childFields_KafkaTopic(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": @@ -35080,14 +35213,14 @@ func (ec *executionContext) childFields_OpenSearchCredentials(ctx context.Contex return nil, fmt.Errorf("no field named %q was found under type OpenSearchCredentials", field.Name) } -func (ec *executionContext) childFields_OpenSearchCredentialsActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { +func (ec *executionContext) childFields_OpenSearchCredentialsCreatedActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "permission": - return ec.fieldContext_OpenSearchCredentialsActivityLogEntryData_permission(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntryData_permission(ctx, field) case "ttl": - return ec.fieldContext_OpenSearchCredentialsActivityLogEntryData_ttl(ctx, field) + return ec.fieldContext_OpenSearchCredentialsCreatedActivityLogEntryData_ttl(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type OpenSearchCredentialsActivityLogEntryData", field.Name) + return nil, fmt.Errorf("no field named %q was found under type OpenSearchCredentialsCreatedActivityLogEntryData", field.Name) } func (ec *executionContext) childFields_OpenSearchEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { @@ -37434,14 +37567,14 @@ func (ec *executionContext) childFields_ValkeyCredentials(ctx context.Context, f return nil, fmt.Errorf("no field named %q was found under type ValkeyCredentials", field.Name) } -func (ec *executionContext) childFields_ValkeyCredentialsActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { +func (ec *executionContext) childFields_ValkeyCredentialsCreatedActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "permission": - return ec.fieldContext_ValkeyCredentialsActivityLogEntryData_permission(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntryData_permission(ctx, field) case "ttl": - return ec.fieldContext_ValkeyCredentialsActivityLogEntryData_ttl(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntryData_ttl(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type ValkeyCredentialsActivityLogEntryData", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ValkeyCredentialsCreatedActivityLogEntryData", field.Name) } func (ec *executionContext) childFields_ValkeyEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { diff --git a/internal/graph/gengql/schema.generated.go b/internal/graph/gengql/schema.generated.go index de8d7edc9..fd74a6fdc 100644 --- a/internal/graph/gengql/schema.generated.go +++ b/internal/graph/gengql/schema.generated.go @@ -6088,13 +6088,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._ValkeyDeletedActivityLogEntry(ctx, sel, obj) - case valkey.ValkeyCredentialsActivityLogEntry: - return ec._ValkeyCredentialsActivityLogEntry(ctx, sel, &obj) - case *valkey.ValkeyCredentialsActivityLogEntry: + case valkey.ValkeyCredentialsCreatedActivityLogEntry: + return ec._ValkeyCredentialsCreatedActivityLogEntry(ctx, sel, &obj) + case *valkey.ValkeyCredentialsCreatedActivityLogEntry: if obj == nil { return graphql.Null } - return ec._ValkeyCredentialsActivityLogEntry(ctx, sel, obj) + return ec._ValkeyCredentialsCreatedActivityLogEntry(ctx, sel, obj) case valkey.ValkeyCreatedActivityLogEntry: return ec._ValkeyCreatedActivityLogEntry(ctx, sel, &obj) case *valkey.ValkeyCreatedActivityLogEntry: @@ -6508,13 +6508,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._OpenSearchDeletedActivityLogEntry(ctx, sel, obj) - case opensearch.OpenSearchCredentialsActivityLogEntry: - return ec._OpenSearchCredentialsActivityLogEntry(ctx, sel, &obj) - case *opensearch.OpenSearchCredentialsActivityLogEntry: + case opensearch.OpenSearchCredentialsCreatedActivityLogEntry: + return ec._OpenSearchCredentialsCreatedActivityLogEntry(ctx, sel, &obj) + case *opensearch.OpenSearchCredentialsCreatedActivityLogEntry: if obj == nil { return graphql.Null } - return ec._OpenSearchCredentialsActivityLogEntry(ctx, sel, obj) + return ec._OpenSearchCredentialsCreatedActivityLogEntry(ctx, sel, obj) case opensearch.OpenSearchCreatedActivityLogEntry: return ec._OpenSearchCreatedActivityLogEntry(ctx, sel, &obj) case *opensearch.OpenSearchCreatedActivityLogEntry: @@ -6571,6 +6571,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._KafkaTopic(ctx, sel, obj) + case kafkatopic.KafkaCredentialsCreatedActivityLogEntry: + return ec._KafkaCredentialsCreatedActivityLogEntry(ctx, sel, &obj) + case *kafkatopic.KafkaCredentialsCreatedActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._KafkaCredentialsCreatedActivityLogEntry(ctx, sel, obj) case job.JobUpdatedActivityLogEntry: return ec._JobUpdatedActivityLogEntry(ctx, sel, &obj) case *job.JobUpdatedActivityLogEntry: diff --git a/internal/graph/gengql/valkey.generated.go b/internal/graph/gengql/valkey.generated.go index 292074e68..792bdd005 100644 --- a/internal/graph/gengql/valkey.generated.go +++ b/internal/graph/gengql/valkey.generated.go @@ -1512,13 +1512,13 @@ func (ec *executionContext) fieldContext_ValkeyCredentials_uri(_ context.Context return graphql.NewScalarFieldContext("ValkeyCredentials", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntry_id(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntry_id(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ID(), nil @@ -1531,17 +1531,17 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_id(ctx context.Co true, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntry_actor(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntry_actor(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Actor, nil @@ -1554,17 +1554,17 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_actor(ctx context true, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntry_createdAt(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntry_createdAt(ctx, field) }, func(ctx context.Context) (any, error) { return obj.CreatedAt, nil @@ -1577,17 +1577,17 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_createdAt(ctx con true, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntry_message(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntry_message(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Message, nil @@ -1600,17 +1600,17 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_message(ctx conte true, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntry_resourceType(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntry_resourceType(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ResourceType, nil @@ -1623,17 +1623,17 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_resourceType(ctx true, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntry_resourceName(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntry_resourceName(ctx, field) }, func(ctx context.Context) (any, error) { return obj.ResourceName, nil @@ -1646,17 +1646,17 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_resourceName(ctx true, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntry_teamSlug(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntry_teamSlug(ctx, field) }, func(ctx context.Context) (any, error) { return obj.TeamSlug, nil @@ -1669,17 +1669,17 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_teamSlug(ctx cont true, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntry_environmentName(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntry_environmentName(ctx, field) }, func(ctx context.Context) (any, error) { return obj.EnvironmentName, nil @@ -1692,49 +1692,49 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_environmentName(c false, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntry) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntry_data(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntry_data(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Data, nil }, nil, - func(ctx context.Context, selections ast.SelectionSet, v *valkey.ValkeyCredentialsActivityLogEntryData) graphql.Marshaler { - return ec.marshalNValkeyCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋvalkeyᚐValkeyCredentialsActivityLogEntryData(ctx, selections, v) + func(ctx context.Context, selections ast.SelectionSet, v *valkey.ValkeyCredentialsCreatedActivityLogEntryData) graphql.Marshaler { + return ec.marshalNValkeyCredentialsCreatedActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋvalkeyᚐValkeyCredentialsCreatedActivityLogEntryData(ctx, selections, v) }, true, true, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ValkeyCredentialsActivityLogEntry", + Object: "ValkeyCredentialsCreatedActivityLogEntry", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.childFields_ValkeyCredentialsActivityLogEntryData(ctx, field) + return ec.childFields_ValkeyCredentialsCreatedActivityLogEntryData(ctx, field) }, } return fc, nil } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntryData_permission(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntryData) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntryData_permission(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntryData) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntryData_permission(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntryData_permission(ctx, field) }, func(ctx context.Context) (any, error) { return obj.Permission, nil @@ -1747,17 +1747,17 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntryData_permission(ct false, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntryData_permission(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntryData_permission(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) } -func (ec *executionContext) _ValkeyCredentialsActivityLogEntryData_ttl(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsActivityLogEntryData) (ret graphql.Marshaler) { +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntryData_ttl(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyCredentialsCreatedActivityLogEntryData) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return ec.fieldContext_ValkeyCredentialsActivityLogEntryData_ttl(ctx, field) + return ec.fieldContext_ValkeyCredentialsCreatedActivityLogEntryData_ttl(ctx, field) }, func(ctx context.Context) (any, error) { return obj.TTL, nil @@ -1770,8 +1770,8 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntryData_ttl(ctx conte true, ) } -func (ec *executionContext) fieldContext_ValkeyCredentialsActivityLogEntryData_ttl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("ValkeyCredentialsActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) +func (ec *executionContext) fieldContext_ValkeyCredentialsCreatedActivityLogEntryData_ttl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("ValkeyCredentialsCreatedActivityLogEntryData", field, false, false, errors.New("field of type String does not have child fields")) } func (ec *executionContext) _ValkeyDeletedActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *valkey.ValkeyDeletedActivityLogEntry) (ret graphql.Marshaler) { @@ -3842,56 +3842,56 @@ func (ec *executionContext) _ValkeyCredentials(ctx context.Context, sel ast.Sele return out } -var valkeyCredentialsActivityLogEntryImplementors = []string{"ValkeyCredentialsActivityLogEntry", "ActivityLogEntry", "Node"} +var valkeyCredentialsCreatedActivityLogEntryImplementors = []string{"ValkeyCredentialsCreatedActivityLogEntry", "ActivityLogEntry", "Node"} -func (ec *executionContext) _ValkeyCredentialsActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *valkey.ValkeyCredentialsActivityLogEntry) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, valkeyCredentialsActivityLogEntryImplementors) +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *valkey.ValkeyCredentialsCreatedActivityLogEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, valkeyCredentialsCreatedActivityLogEntryImplementors) 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("ValkeyCredentialsActivityLogEntry") + out.Values[i] = graphql.MarshalString("ValkeyCredentialsCreatedActivityLogEntry") case "id": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_id(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntry_id(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "actor": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_actor(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntry_actor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "createdAt": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_createdAt(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntry_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "message": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_message(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntry_message(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "resourceType": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_resourceType(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntry_resourceType(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "resourceName": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_resourceName(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntry_resourceName(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "teamSlug": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_teamSlug(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntry_teamSlug(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "environmentName": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_environmentName(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntry_environmentName(ctx, field, obj) case "data": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntry_data(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntry_data(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -3918,21 +3918,21 @@ func (ec *executionContext) _ValkeyCredentialsActivityLogEntry(ctx context.Conte return out } -var valkeyCredentialsActivityLogEntryDataImplementors = []string{"ValkeyCredentialsActivityLogEntryData"} +var valkeyCredentialsCreatedActivityLogEntryDataImplementors = []string{"ValkeyCredentialsCreatedActivityLogEntryData"} -func (ec *executionContext) _ValkeyCredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *valkey.ValkeyCredentialsActivityLogEntryData) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, valkeyCredentialsActivityLogEntryDataImplementors) +func (ec *executionContext) _ValkeyCredentialsCreatedActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *valkey.ValkeyCredentialsCreatedActivityLogEntryData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, valkeyCredentialsCreatedActivityLogEntryDataImplementors) 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("ValkeyCredentialsActivityLogEntryData") + out.Values[i] = graphql.MarshalString("ValkeyCredentialsCreatedActivityLogEntryData") case "permission": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntryData_permission(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntryData_permission(ctx, field, obj) case "ttl": - out.Values[i] = ec._ValkeyCredentialsActivityLogEntryData_ttl(ctx, field, obj) + out.Values[i] = ec._ValkeyCredentialsCreatedActivityLogEntryData_ttl(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -4636,14 +4636,14 @@ func (ec *executionContext) marshalNValkeyCredentials2ᚖgithubᚗcomᚋnaisᚋa return ec._ValkeyCredentials(ctx, sel, v) } -func (ec *executionContext) marshalNValkeyCredentialsActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋvalkeyᚐValkeyCredentialsActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *valkey.ValkeyCredentialsActivityLogEntryData) graphql.Marshaler { +func (ec *executionContext) marshalNValkeyCredentialsCreatedActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋpersistenceᚋvalkeyᚐValkeyCredentialsCreatedActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *valkey.ValkeyCredentialsCreatedActivityLogEntryData) 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._ValkeyCredentialsActivityLogEntryData(ctx, sel, v) + return ec._ValkeyCredentialsCreatedActivityLogEntryData(ctx, sel, v) } func (ec *executionContext) marshalNValkeyEdge2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdge(ctx context.Context, sel ast.SelectionSet, v pagination.Edge[*valkey.Valkey]) graphql.Marshaler { diff --git a/internal/graph/schema/kafka.graphqls b/internal/graph/schema/kafka.graphqls index 261589e2a..fd6621cc2 100644 --- a/internal/graph/schema/kafka.graphqls +++ b/internal/graph/schema/kafka.graphqls @@ -224,3 +224,42 @@ type CreateKafkaCredentialsPayload { "The generated credentials." credentials: KafkaCredentials! } + +type KafkaCredentialsCreatedActivityLogEntry implements ActivityLogEntry & Node { + "ID of the entry." + id: ID! + + "The identity of the actor who performed the action." + actor: String! + + "Creation time of the entry." + createdAt: Time! + + "Message that summarizes the entry." + message: String! + + "Type of the resource that was affected by the action." + resourceType: ActivityLogEntryResourceType! + + "Name of the resource that was affected by the action." + resourceName: String! + + "The team slug that the entry belongs to." + teamSlug: Slug! + + "The environment name that the entry belongs to." + environmentName: String + + "Data associated with the credential creation." + data: KafkaCredentialsCreatedActivityLogEntryData! +} + +type KafkaCredentialsCreatedActivityLogEntryData { + "The TTL that was requested for the credentials." + ttl: String! +} + +extend enum ActivityLogActivityType { + "Filter for Kafka credential creation events." + KAFKA_CREDENTIALS_CREATED +} diff --git a/internal/graph/schema/opensearch.graphqls b/internal/graph/schema/opensearch.graphqls index d485f2a6f..0c6887512 100644 --- a/internal/graph/schema/opensearch.graphqls +++ b/internal/graph/schema/opensearch.graphqls @@ -478,7 +478,7 @@ type CreateOpenSearchCredentialsPayload { credentials: OpenSearchCredentials! } -type OpenSearchCredentialsActivityLogEntry implements ActivityLogEntry & Node { +type OpenSearchCredentialsCreatedActivityLogEntry implements ActivityLogEntry & Node { "ID of the entry." id: ID! @@ -504,10 +504,10 @@ type OpenSearchCredentialsActivityLogEntry implements ActivityLogEntry & Node { environmentName: String "Data associated with the credential creation." - data: OpenSearchCredentialsActivityLogEntryData! + data: OpenSearchCredentialsCreatedActivityLogEntryData! } -type OpenSearchCredentialsActivityLogEntryData { +type OpenSearchCredentialsCreatedActivityLogEntryData { "The permission level, if applicable." permission: String "The TTL that was requested for the credentials." diff --git a/internal/graph/schema/valkey.graphqls b/internal/graph/schema/valkey.graphqls index fa962ea5d..371979d4a 100644 --- a/internal/graph/schema/valkey.graphqls +++ b/internal/graph/schema/valkey.graphqls @@ -499,7 +499,7 @@ type CreateValkeyCredentialsPayload { credentials: ValkeyCredentials! } -type ValkeyCredentialsActivityLogEntry implements ActivityLogEntry & Node { +type ValkeyCredentialsCreatedActivityLogEntry implements ActivityLogEntry & Node { "ID of the entry." id: ID! @@ -525,10 +525,10 @@ type ValkeyCredentialsActivityLogEntry implements ActivityLogEntry & Node { environmentName: String "Data associated with the credential creation." - data: ValkeyCredentialsActivityLogEntryData! + data: ValkeyCredentialsCreatedActivityLogEntryData! } -type ValkeyCredentialsActivityLogEntryData { +type ValkeyCredentialsCreatedActivityLogEntryData { "The permission level, if applicable." permission: String "The TTL that was requested for the credentials." diff --git a/internal/persistence/kafkatopic/activitylog.go b/internal/persistence/kafkatopic/activitylog.go index 7dc8eac4f..6b0b9b807 100644 --- a/internal/persistence/kafkatopic/activitylog.go +++ b/internal/persistence/kafkatopic/activitylog.go @@ -1,9 +1,45 @@ package kafkatopic import ( + "fmt" + "github.com/nais/api/internal/activitylog" ) const ( ActivityLogEntryResourceTypeKafkaTopic activitylog.ActivityLogEntryResourceType = "KAFKA_TOPIC" ) + +func init() { + activitylog.RegisterTransformer(ActivityLogEntryResourceTypeKafkaTopic, func(entry activitylog.GenericActivityLogEntry) (activitylog.ActivityLogEntry, error) { + switch entry.Action { + case activitylog.ActivityLogEntryActionCredentialsCreated: + data, err := activitylog.UnmarshalData[KafkaCredentialsCreatedActivityLogEntryData](entry) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal Kafka credentials creation activity log entry data: %w", err) + } + + msg := fmt.Sprintf("Created credentials for %q", entry.ResourceName) + msg += fmt.Sprintf(" (TTL: %s)", data.TTL) + + return KafkaCredentialsCreatedActivityLogEntry{ + GenericActivityLogEntry: entry.WithMessage(msg), + Data: data, + }, nil + default: + return nil, fmt.Errorf("unsupported kafka topic activity log entry action: %q", entry.Action) + } + }) + + activitylog.RegisterFilter("KAFKA_CREDENTIALS_CREATED", activitylog.ActivityLogEntryActionCredentialsCreated, ActivityLogEntryResourceTypeKafkaTopic) +} + +type KafkaCredentialsCreatedActivityLogEntry struct { + activitylog.GenericActivityLogEntry + + Data *KafkaCredentialsCreatedActivityLogEntryData `json:"data"` +} + +type KafkaCredentialsCreatedActivityLogEntryData struct { + TTL string `json:"ttl"` +} diff --git a/internal/persistence/kafkatopic/queries.go b/internal/persistence/kafkatopic/queries.go index 9fb24c2ac..185945b2d 100644 --- a/internal/persistence/kafkatopic/queries.go +++ b/internal/persistence/kafkatopic/queries.go @@ -5,12 +5,15 @@ import ( "strings" "time" + "github.com/nais/api/internal/activitylog" + "github.com/nais/api/internal/auth/authz" "github.com/nais/api/internal/graph/ident" "github.com/nais/api/internal/graph/model" "github.com/nais/api/internal/graph/pagination" "github.com/nais/api/internal/kubernetes/watcher" "github.com/nais/api/internal/persistence/aivencredentials" "github.com/nais/api/internal/slug" + "github.com/sirupsen/logrus" ) const maxTTLKafka = 365 * 24 * time.Hour // 365 days — used by Kafka @@ -75,7 +78,7 @@ func CreateKafkaCredentials(ctx context.Context, input CreateKafkaCredentialsInp "protected": true, "expiresAt": expiresAt.Format(time.RFC3339), "kafka": map[string]any{ - "pool": "nav-" + input.EnvironmentName, + "pool": "nav-" + input.EnvironmentName, // @TODO(chredvar): this will only work for Nav "secretName": secretName, }, } @@ -95,6 +98,20 @@ func CreateKafkaCredentials(ctx context.Context, input CreateKafkaCredentialsInp return nil, err } + if err = activitylog.Create(ctx, activitylog.CreateInput{ + Action: activitylog.ActivityLogEntryActionCredentialsCreated, + Actor: authz.ActorFromContext(ctx).User, + ResourceType: ActivityLogEntryResourceTypeKafkaTopic, + ResourceName: input.EnvironmentName, + EnvironmentName: &input.EnvironmentName, + TeamSlug: &input.TeamSlug, + Data: KafkaCredentialsCreatedActivityLogEntryData{ + TTL: input.TTL, + }, + }); err != nil { + logrus.WithError(err).Warn("failed to create activity log entry for kafka credentials creation") + } + return &CreateKafkaCredentialsPayload{Credentials: result.(*KafkaCredentials)}, nil } diff --git a/internal/persistence/opensearch/activitylog.go b/internal/persistence/opensearch/activitylog.go index 8b809c2fe..d60e27aeb 100644 --- a/internal/persistence/opensearch/activitylog.go +++ b/internal/persistence/opensearch/activitylog.go @@ -36,7 +36,7 @@ func init() { GenericActivityLogEntry: entry.WithMessage("Started service maintenance"), }, nil case activitylog.ActivityLogEntryActionCredentialsCreated: - data, err := activitylog.UnmarshalData[OpenSearchCredentialsActivityLogEntryData](entry) + data, err := activitylog.UnmarshalData[OpenSearchCredentialsCreatedActivityLogEntryData](entry) if err != nil { return nil, fmt.Errorf("failed to unmarshal OpenSearch credentials creation activity log entry data: %w", err) } @@ -47,7 +47,7 @@ func init() { } msg += fmt.Sprintf(" (TTL: %s)", data.TTL) - return OpenSearchCredentialsActivityLogEntry{ + return OpenSearchCredentialsCreatedActivityLogEntry{ GenericActivityLogEntry: entry.WithMessage(msg), Data: data, }, nil @@ -86,13 +86,13 @@ type OpenSearchDeletedActivityLogEntry struct { activitylog.GenericActivityLogEntry } -type OpenSearchCredentialsActivityLogEntry struct { +type OpenSearchCredentialsCreatedActivityLogEntry struct { activitylog.GenericActivityLogEntry - Data *OpenSearchCredentialsActivityLogEntryData `json:"data"` + Data *OpenSearchCredentialsCreatedActivityLogEntryData `json:"data"` } -type OpenSearchCredentialsActivityLogEntryData struct { +type OpenSearchCredentialsCreatedActivityLogEntryData struct { Permission string `json:"permission,omitempty"` TTL string `json:"ttl"` } diff --git a/internal/persistence/opensearch/queries.go b/internal/persistence/opensearch/queries.go index 7a14f8c66..f29857ece 100644 --- a/internal/persistence/opensearch/queries.go +++ b/internal/persistence/opensearch/queries.go @@ -382,7 +382,7 @@ func CreateOpenSearchCredentials(ctx context.Context, input CreateOpenSearchCred ResourceName: req.InstanceName, EnvironmentName: &req.EnvironmentName, TeamSlug: &req.TeamSlug, - Data: OpenSearchCredentialsActivityLogEntryData{ + Data: OpenSearchCredentialsCreatedActivityLogEntryData{ Permission: req.Permission, TTL: req.TTL, }, diff --git a/internal/persistence/valkey/activitylog.go b/internal/persistence/valkey/activitylog.go index a8ee29141..8c3247da7 100644 --- a/internal/persistence/valkey/activitylog.go +++ b/internal/persistence/valkey/activitylog.go @@ -37,7 +37,7 @@ func init() { GenericActivityLogEntry: entry.WithMessage("Started service maintenance"), }, nil case activitylog.ActivityLogEntryActionCredentialsCreated: - data, err := activitylog.UnmarshalData[ValkeyCredentialsActivityLogEntryData](entry) + data, err := activitylog.UnmarshalData[ValkeyCredentialsCreatedActivityLogEntryData](entry) if err != nil { return nil, fmt.Errorf("failed to unmarshal Valkey credentials creation activity log entry data: %w", err) } @@ -47,7 +47,7 @@ func init() { } msg += fmt.Sprintf(" (TTL: %s)", data.TTL) - return ValkeyCredentialsActivityLogEntry{ + return ValkeyCredentialsCreatedActivityLogEntry{ GenericActivityLogEntry: entry.WithMessage(msg), Data: data, }, nil @@ -86,13 +86,13 @@ type ValkeyDeletedActivityLogEntry struct { activitylog.GenericActivityLogEntry } -type ValkeyCredentialsActivityLogEntry struct { +type ValkeyCredentialsCreatedActivityLogEntry struct { activitylog.GenericActivityLogEntry - Data *ValkeyCredentialsActivityLogEntryData `json:"data"` + Data *ValkeyCredentialsCreatedActivityLogEntryData `json:"data"` } -type ValkeyCredentialsActivityLogEntryData struct { +type ValkeyCredentialsCreatedActivityLogEntryData struct { Permission string `json:"permission,omitempty"` TTL string `json:"ttl"` } diff --git a/internal/persistence/valkey/queries.go b/internal/persistence/valkey/queries.go index 5b843c1b9..9d5a4ac0f 100644 --- a/internal/persistence/valkey/queries.go +++ b/internal/persistence/valkey/queries.go @@ -372,7 +372,7 @@ func CreateValkeyCredentials(ctx context.Context, input CreateValkeyCredentialsI ResourceName: req.InstanceName, EnvironmentName: &req.EnvironmentName, TeamSlug: &req.TeamSlug, - Data: ValkeyCredentialsActivityLogEntryData{ + Data: ValkeyCredentialsCreatedActivityLogEntryData{ Permission: req.Permission, TTL: req.TTL, }, From 5f16e962309f2bb1bf0ac042ef50098ed9028a5b Mon Sep 17 00:00:00 2001 From: Christer Edvartsen Date: Tue, 25 Aug 2026 10:30:10 +0200 Subject: [PATCH 5/7] fix: inject logger --- internal/cmd/api/http.go | 2 +- internal/persistence/kafkatopic/dataloader.go | 9 ++++++--- internal/persistence/kafkatopic/queries.go | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/cmd/api/http.go b/internal/cmd/api/http.go index b17466200..9864a1ed5 100644 --- a/internal/cmd/api/http.go +++ b/internal/cmd/api/http.go @@ -343,7 +343,7 @@ func ConfigureGraph( ctx = bigquery.NewLoaderContext(ctx, watchers.BqWatcher) ctx = bucket.NewLoaderContext(ctx, watchers.BucketWatcher) ctx = job.NewLoaderContext(ctx, watchers.JobWatcher, watchers.RunWatcher) - ctx = kafkatopic.NewLoaderContext(ctx, watchers.KafkaTopicWatcher) + ctx = kafkatopic.NewLoaderContext(ctx, watchers.KafkaTopicWatcher, log) ctx = workload.NewLoaderContext(ctx, watchers.PodWatcher) ctx = secret.NewLoaderContext(ctx, watchers.SecretWatcher, secretClientCreator, dynamicClients, clusters, log) ctx = config.NewLoaderContext(ctx, watchers.ConfigWatcher, log) diff --git a/internal/persistence/kafkatopic/dataloader.go b/internal/persistence/kafkatopic/dataloader.go index 52d08d70c..51ab6734a 100644 --- a/internal/persistence/kafkatopic/dataloader.go +++ b/internal/persistence/kafkatopic/dataloader.go @@ -4,6 +4,7 @@ import ( "context" "github.com/nais/api/internal/kubernetes/watcher" + "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -12,8 +13,8 @@ type ctxKey int const loadersKey ctxKey = iota -func NewLoaderContext(ctx context.Context, watcher *watcher.Watcher[*KafkaTopic]) context.Context { - return context.WithValue(ctx, loadersKey, newLoaders(watcher)) +func NewLoaderContext(ctx context.Context, watcher *watcher.Watcher[*KafkaTopic], logger logrus.FieldLogger) context.Context { + return context.WithValue(ctx, loadersKey, newLoaders(watcher, logger)) } func NewWatcher(ctx context.Context, mgr *watcher.Manager) *watcher.Watcher[*KafkaTopic] { @@ -38,10 +39,12 @@ func fromContext(ctx context.Context) *loaders { type loaders struct { watcher *watcher.Watcher[*KafkaTopic] + log logrus.FieldLogger } -func newLoaders(watcher *watcher.Watcher[*KafkaTopic]) *loaders { +func newLoaders(watcher *watcher.Watcher[*KafkaTopic], logger logrus.FieldLogger) *loaders { return &loaders{ watcher: watcher, + log: logger, } } diff --git a/internal/persistence/kafkatopic/queries.go b/internal/persistence/kafkatopic/queries.go index 185945b2d..25f623ed4 100644 --- a/internal/persistence/kafkatopic/queries.go +++ b/internal/persistence/kafkatopic/queries.go @@ -13,7 +13,6 @@ import ( "github.com/nais/api/internal/kubernetes/watcher" "github.com/nais/api/internal/persistence/aivencredentials" "github.com/nais/api/internal/slug" - "github.com/sirupsen/logrus" ) const maxTTLKafka = 365 * 24 * time.Hour // 365 days — used by Kafka @@ -109,7 +108,7 @@ func CreateKafkaCredentials(ctx context.Context, input CreateKafkaCredentialsInp TTL: input.TTL, }, }); err != nil { - logrus.WithError(err).Warn("failed to create activity log entry for kafka credentials creation") + fromContext(ctx).log.WithError(err).Warn("failed to create activity log entry for kafka credentials creation") } return &CreateKafkaCredentialsPayload{Credentials: result.(*KafkaCredentials)}, nil From 8489ad3ab78a26f4a02df8c3568ad1295f2309e3 Mon Sep 17 00:00:00 2001 From: Thomas Krampl Date: Tue, 25 Aug 2026 11:05:32 +0200 Subject: [PATCH 6/7] Add ActivityLogEntryResourceType for kafka to graphql --- internal/graph/gengql/root_.generated.go | 5 +++++ internal/graph/schema/kafka.graphqls | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/internal/graph/gengql/root_.generated.go b/internal/graph/gengql/root_.generated.go index e4f3ecb3c..85f459f78 100644 --- a/internal/graph/gengql/root_.generated.go +++ b/internal/graph/gengql/root_.generated.go @@ -24761,6 +24761,11 @@ extend enum ActivityLogActivityType { "Filter for Kafka credential creation events." KAFKA_CREDENTIALS_CREATED } + +extend enum ActivityLogEntryResourceType { + "All activity log entries related to Kafka topics will use this resource type." + KAFKA_TOPIC +} `, BuiltIn: false}, {Name: "../schema/labels.graphqls", Input: `""" A user-defined label attached to a resource. diff --git a/internal/graph/schema/kafka.graphqls b/internal/graph/schema/kafka.graphqls index fd6621cc2..4a244974f 100644 --- a/internal/graph/schema/kafka.graphqls +++ b/internal/graph/schema/kafka.graphqls @@ -263,3 +263,8 @@ extend enum ActivityLogActivityType { "Filter for Kafka credential creation events." KAFKA_CREDENTIALS_CREATED } + +extend enum ActivityLogEntryResourceType { + "All activity log entries related to Kafka topics will use this resource type." + KAFKA_TOPIC +} From a1a2259acc9f628768dcb01a475906ba15d26f14 Mon Sep 17 00:00:00 2001 From: Thomas Krampl Date: Tue, 25 Aug 2026 11:18:39 +0200 Subject: [PATCH 7/7] Fix tests --- integration_tests/aiven_credentials.lua | 31 +++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/integration_tests/aiven_credentials.lua b/integration_tests/aiven_credentials.lua index 176f2484b..37b027cc1 100644 --- a/integration_tests/aiven_credentials.lua +++ b/integration_tests/aiven_credentials.lua @@ -381,15 +381,16 @@ Helper.SQLExec(string.format([[ INSERT INTO activity_log_entries (actor, action, resource_type, resource_name, team_slug, environment, data, created_at) VALUES ('%s', 'CREDENTIALS_CREATED', 'OPENSEARCH', 'my-instance', '%s', 'dev', '{"permission":"READ","ttl":"1d"}', NOW() - INTERVAL '2 minutes'), - ('%s', 'CREDENTIALS_CREATED', 'VALKEY', 'my-valkey', '%s', 'dev', '{"ttl":"7d"}', NOW() - INTERVAL '1 minute') -]], user:email(), team:slug(), user:email(), team:slug())) + ('%s', 'CREDENTIALS_CREATED', 'VALKEY', 'my-valkey', '%s', 'dev', '{"ttl":"7d"}', NOW() - INTERVAL '1 minute'), + ('%s', 'CREDENTIALS_CREATED', 'KAFKA_TOPIC', 'dev', '%s', 'dev', '{"ttl":"7d"}', NOW() - INTERVAL '5 minute') +]], user:email(), team:slug(), user:email(), team:slug(), user:email(), team:slug())) Test.gql("Activity log returns credentials entries without panic", function(t) t.addHeader("x-user-email", user:email()) t.query(string.format([[ { team(slug: "%s") { - activityLog(first: 10, filter: { activityTypes: [VALKEY_CREDENTIALS_CREATED, OPENSEARCH_CREDENTIALS_CREATED] }) { + activityLog(first: 10, filter: { activityTypes: [VALKEY_CREDENTIALS_CREATED, OPENSEARCH_CREDENTIALS_CREATED, KAFKA_CREDENTIALS_CREATED] }) { nodes { __typename message @@ -397,18 +398,23 @@ Test.gql("Activity log returns credentials entries without panic", function(t) resourceType resourceName environmentName - ... on ValkeyCredentialsActivityLogEntry { + ... on ValkeyCredentialsCreatedActivityLogEntry { data { permission ttl } } - ... on OpenSearchCredentialsActivityLogEntry { + ... on OpenSearchCredentialsCreatedActivityLogEntry { data { permission ttl } } + ... on KafkaCredentialsCreatedActivityLogEntry { + data { + ttl + } + } } } } @@ -421,7 +427,7 @@ Test.gql("Activity log returns credentials entries without panic", function(t) activityLog = { nodes = { { - __typename = "ValkeyCredentialsActivityLogEntry", + __typename = "ValkeyCredentialsCreatedActivityLogEntry", message = "Created credentials for \"my-valkey\" (TTL: 7d)", actor = user:email(), resourceType = "VALKEY", @@ -433,7 +439,7 @@ Test.gql("Activity log returns credentials entries without panic", function(t) }, }, { - __typename = "OpenSearchCredentialsActivityLogEntry", + __typename = "OpenSearchCredentialsCreatedActivityLogEntry", message = "Created credentials for \"my-instance\" with \"read\" permission (TTL: 1d)", actor = user:email(), resourceType = "OPENSEARCH", @@ -444,6 +450,17 @@ Test.gql("Activity log returns credentials entries without panic", function(t) ttl = "1d", }, }, + { + __typename = "KafkaCredentialsCreatedActivityLogEntry", + message = "Created credentials for \"dev\" (TTL: 7d)", + actor = user:email(), + resourceType = "KAFKA_TOPIC", + resourceName = "dev", + environmentName = "dev", + data = { + ttl = "7d", + }, + }, }, }, },